cancel
Showing results for 
Search instead for 
Did you mean: 

UART reception problem when SysTick Interrupt is enabled

fbakhtiyar
Associate II
Posted on December 15, 2015 at 13:41

I'm using STM32F411RE-Nucleo board and generating a project with Cube MX for System Workbench. The problem is that,

HAL_UART_Receive
function doesn't receive input from the user, even though I don't change any UART, GPIO, RCC or NVIC configuration.

Surprisingly, when I comment two lines in SysTick Interrupt Handler function i.e.

SysTick_Handler
,
HAL_UART_Receive
starts working but this comes with another problem.

void SysTick_Handler(void){ HAL_IncTick(); HAL_SYSTICK_IRQHandler();}
HAL_Delay()
function doesn't work when I disable those two lines. I guess it's because the processor can't handle the ticks.

How to work

HAL_UART_Receive
and
HAL_Delay
work at the same time? I'm a bit new in embedded programming and I'm sorry if I couldn't get myself clear.

Thanks.

#uart #stm32 #nucleo
1 REPLY 1
Posted on December 15, 2015 at 18:48

Well you'll have to be careful about creating dead-locks and priority-inversions.

Your USART IRQ/Callback should do very little and leave. The HAL hides a lot of what it's doing, and I suspect there are lots of issues about what functions can be called, and when, that's not clearly addressed anywhere and is fluid.

HAL_Delay() should really use the count of a hardware timer, not an interrupt sourced ticker.

Large parts of the HAL/Cube stuff appear to be coded by, and for, neophytes which is really one of my biggest problems with it.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..