UART Receive Non-Functioning with HAL Firmware

groger57 wrote on Sunday, March 17, 2019:

Hello:
This issue is using and STM32L4, and FreeRTOS v9.

HAL is being a problem with interrupts on the UART. My FreeRTOSConfig.h has this:
~~#define configPRIO_BITS 4
~~#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 3
~~#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 3
~~#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
~~#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )

I know the scheduler is working OK because the systick is generated by TIM17, at the end of SystemClock_Config() this code:
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
HAL_NVIC_SetPriority(SysTick_IRQn, 15, 0);

And a task has no problem executing after scheduler launch. The UART is configured for interrupt callback and at the end of the configuration file:
HAL_NVIC_SetPriority(USART3_IRQn, 3, 0);
HAL_NVIC_EnableIRQ(USART3_IRQn);

The callback (toggle a LED when active rx)
void HAL_UART_RxCpltCallback(UART_HandleTypeDef* uartHandle)
{
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_8);
HAL_UART_Receive_IT(&huart3, rxBuff, 4);
}

In main():
MX_USART3_UART_Init();
HAL_UART_Receive_IT(&huart3, rxBuff, 4);

At the start of the program the LED is on momentarily, then off, and does not come back on. I have this same interrupt functioning in a non-FreeRTOS application so I know the interrupt and callback appears to be working.

I have read the section on M4 implementation, as mentioned, I have used FreeRTOS in quite a few CMSIS based firmware projects without problems, and in fact I am using the same FreeRTOSConfig file.

What can the issue be?

groger57 wrote on Sunday, March 17, 2019:

Hi, figured it out. Didn’t have one of the priorities set in HAL correctly.