2019-05-22 12:23 AM
What is wrong with the following code that the RX Interrupt isn't called. On the osziloscope I see Send and Receive correctly.
HAL_Init();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_USART6_CLK_ENABLE();
#define CONSOLE_TXD_PIN LL_GPIO_PIN_11
/* Configure Tx Pin as : Alternate function, High Speed, Push pull, Pull up */
LL_GPIO_SetPinSpeed(GPIOA, CONSOLE_TXD_PIN, LL_GPIO_SPEED_FREQ_HIGH);
LL_GPIO_SetPinOutputType(GPIOA, CONSOLE_TXD_PIN, LL_GPIO_PULL_NO);
LL_GPIO_SetPinPull(GPIOA, CONSOLE_TXD_PIN, LL_GPIO_PULL_UP);
LL_GPIO_SetPinMode(GPIOA, CONSOLE_TXD_PIN, LL_GPIO_MODE_ALTERNATE);
LL_GPIO_SetAFPin_8_15(GPIOA, CONSOLE_TXD_PIN, LL_GPIO_AF_8);
#define CONSOLE_RXD_PIN LL_GPIO_PIN_12
/* Configure Rx Pin as : Alternate function, High Speed, Push pull, Pull up */
LL_GPIO_SetPinSpeed(GPIOA, CONSOLE_RXD_PIN, LL_GPIO_SPEED_FREQ_HIGH);
LL_GPIO_SetPinOutputType(GPIOA, CONSOLE_RXD_PIN, LL_GPIO_OUTPUT_PUSHPULL);
LL_GPIO_SetPinPull(GPIOA, CONSOLE_RXD_PIN, LL_GPIO_PULL_UP);
LL_GPIO_SetPinMode(GPIOA, CONSOLE_RXD_PIN, LL_GPIO_MODE_ALTERNATE);
LL_GPIO_SetAFPin_8_15(GPIOA, CONSOLE_RXD_PIN, LL_GPIO_AF_8);
NVIC_SetPriority(USART6_IRQn, 0);
NVIC_EnableIRQ(USART6_IRQn);
LL_USART_EnableIT_TXE(USART6);
LL_USART_EnableIT_RXNE(USART6);
LL_USART_SetTransferDirection(USART6, LL_USART_DIRECTION_TX_RX);
/* 8 data bit, 1 start bit, 1 stop bit, no parity */
LL_USART_ConfigCharacter(USART6, LL_USART_DATAWIDTH_8B, LL_USART_PARITY_NONE, LL_USART_STOPBITS_1);
LL_USART_SetHWFlowCtrl(USART6, LL_USART_HWCONTROL_NONE);
/* Reset value is LL_USART_OVERSAMPLING_16 */
LL_USART_SetOverSampling(USART6, LL_USART_OVERSAMPLING_16);
const uint32_t pclk = __LL_RCC_CALC_PCLK2_FREQ(SystemCoreClock,
LL_RCC_GetAPB2Prescaler());
LL_USART_SetBaudRate(USART6, pclk, LL_USART_OVERSAMPLING_16, 9600);
LL_USART_Enable(USART6);