resolving a conflict between using Timer3 interrupt and HAL_Delay()
Hi all,
Hardware - STM32L4R9 Disco with STEVAL-MK172V1 eCompass
I'm stuck trying to resolve some kind of conflict I'm having with Hal_Delay. I've lowered the priority of the timer interrupt so that SysTick is a higher priority. I've tried using both the TIM3_IRQHandler() found in the stm32xxxx_it.c file in core, and writing in HAL_TIM_PeriodElapsedCallback at the bottom of my main. with either of those methods, if there is no code to be handled, the loops and interrupts function so that I get the output loop over UART I'm using as a method of output for now, just without the data I'm ultimately calculating. I've made use of __disable and __enable_irq() in the interrupt handlers in an attempt to prevent conflict, but any time I try to execute any portion of what I'd like to be updating, the controller gets stuck in an infinite loop either as a result of of trying to run HAL_Delay, HAL_TIM_Base_Start_IT or printf (which is set up to print to the UART connection I have set up over the USB cable.
When I run debug and step through everything, sometimes it gets to main while loop before getting frozen, sometimes its when I run HAL_TIM_Base_Start_IT is where it gets stuck in a loop. when I pause the debugger after hitting this loop, it's almost always in either HAL_Delay or HAL_GetTick, with the variables showing delay = 5, tickstart = ~1545 and wait = 6.
I suspect I'm missing something fundamental about timing interrupts that my brain is skipping over that has to do with the fact that the process I want run at each interrupt is more complex than flipping a bit or an LED. I've tried to break down my function to only execute the most basic need (polling a set of 12 registers over i2c on another device) but It doesn't rectify the issue. what am I missing about using a timer interrupt that would create this conflict?
