Hi Has anybody had problem with configuring UART4 of STM32L162VD? I initialized USART1,USART2,USART3 and UART5 but not able to do for UART4! I checked it with second board to make sure no hardware problem. Is it possible to debug UART 4 and 5 in Keil?
below is my code:
void uart4_configuration(void) { USART_InitTypeDef USART_InitStructure; GPIO_InitTypeDef GPIO_InitStructure; RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_UART4,ENABLE); GPIO_PinAFConfig(GPIOC, GPIO_PinSource10|GPIO_PinSource11, GPIO_AF_UART4); /* Configure UART4 pins: Rx and Tx ----------------------------*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10|GPIO_Pin_11; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOC, &GPIO_InitStructure); USART_InitStructure.USART_BaudRate = 9600; USART_InitStructure.USART_WordLength = USART_WordLength_8b; USART_InitStructure.USART_StopBits = USART_StopBits_1; USART_InitStructure.USART_Parity = USART_Parity_No; USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; USART_Init(UART4, &USART_InitStructure); USART_Cmd(UART4,ENABLE); // /* Enable RXNE interrupt */ USART_ITConfig(UART4, USART_IT_RXNE, ENABLE); // /* Enable USART1 global interrupt */ NVIC_EnableIRQ(UART4_IRQn); }
Thanks.