2017-02-02 06:44 AM
Hey there, I am relatively new to STM32 Development (coming from an AVR Background).
I am currently working on a LoRaWAN sample project using the STM32L053 Discovery board and the SX1272 Modem with IBM LMiC Library. According to the Docs i have implemented all needed functions.
So there is this function i have to implement: void hal_waitUntil(uint32_t time).
So i just call HAL_Delay(time) inside the function. But if I run the code on the controller the delay never exits.
Getting the Systick Value with GDB or PRINTF shows, that the systick isn't increasing anymore after entering the delay. But if I call HAL_Delay() somewhere in the main.c it works without problems (so the systick must work).
I attached my eclipse project.
In the src folder there are main.c, hardware.c (where i init the peripherals) and hal.c (where the LMiC functions are declared).
Would be awesome if someone could help me I'm hangin' there for days...
#systick #hal_delay #stm32Solved! Go to Solution.
2017-02-02 07:01 AM
I had a rapid look to the code and it seems that in radio_init() you are disabling all interrupts (including Systick) so the Systick counter stops. Afterwards, you call hal_waitUntil() which never exists as time has stopped.
2017-02-02 07:01 AM
I had a rapid look to the code and it seems that in radio_init() you are disabling all interrupts (including Systick) so the Systick counter stops. Afterwards, you call hal_waitUntil() which never exists as time has stopped.
2017-02-02 08:14 AM
Well, yeah, thats it...
Thanks a lot man! U You saved my day.
2017-02-03 05:34 AM
So the next question would be, how can i stop the systick from interrupting?
The LMiC manual says i have to provide the delay in systicks. Should I use a timer instead?
2017-02-03 10:33 AM
If you really need to disable all interrupts you'd need to poll on a timer or on CPU cycle counter.
If however you can tolerate SysTick (and possibly other) interrupts you may want to arrange your interrupt priorities so that instead of disabling all interrupts with __disable_irq() you disable only the ones with a priority level lower than a given threshold with __set_BASEPRI().
2018-08-22 04:45 AM
Hi,
I'm having the same problem.
There is no code included in the post. Could anyone tell me where these interrupts are being disabled / how to enable them?
Thanks in advance.
2018-08-22 05:13 AM
Check TICK_INT_PRIORITY in stm32fxyz_hal_conf.h
This needs to be a low number so the tick will keep ticking even when you are inside another interrupt (callbacK).
2018-08-22 08:50 AM
@Community member
I have it set to (uint32_t)0U
2018-08-22 09:57 AM
Levels for other interrupts would need to be higher so the SysTick can preempt them so the tick increments, and HAL_Delay() functions.
You should avoid using HAL_Delay() in interrupt, and by inference callback, functions.
2018-08-22 11:28 AM
There is a straightforward way to use the SysTick timer in polling mode for delay, which works even if interrupts are disabled (as long as SysTick is still running), see in this post: