MCU is an STM32L422
FreeRTOS (CMSIS-V2), 3 simple tasks, they run just fine on their own. USART1 is configured to receive data via IDLE detection and DMA circular buffer. Again it works fine on it's own.
To couple them I call
__HAL_UART_CLEAR_IDLEFLAG(rf->port); __HAL_UART_ENABLE_IT(rf->port, UART_IT_IDLE); HAL_UART_Receive_DMA(rf->port, RxBuffer1, RX_BFR_SIZE);
from one of the tasks. It was getting stuck before I started clearing the IDLE flag as seen above. It is now fine, DMA interrupt is activated and RTOS keeps running happily.
Problem is when I actually receive some data. Something smaller than the size of the buffer so no overflows etc. Upon receiving data it gets stuck within
stm32l4xx_hal_uart.c and the actual Callback function never gets called.
Started debugging, no error flags, isrflags only include IDLE, TC, and TXE. I suppose all are as expected. It keeps looping in and out of
void HAL_UART_IRQHandler(UART_HandleTypeDef *huart) in the same file above. It is hard to tell why my Callback function never gets called, and because it is not get called IDLE flag stays up permanently, explaining the loop behaviour.
However I noticed that when I let it go through few times within debug, it eventually brakes out freertos routines and everything goes back to normal, until the next piece of data is received. It never works when a normal run though.
Feels very much like a timing / priority issue, I increased USART and DMA interrupt priorities (initially they were 5) to 6 or 10 from CubeIDE but nothing changed.
Not sharing code to not to clutter, I am not doing anything significant other than the ones described above.