Whack a mole with MxCube interrupt configuration
I am programming on the STM32L4R9I-EVAL dev board, but my project is configured
for the STM32L4S9AII6. I am clocked at 120MHz.
I have been fighting the following bug off and on for about 3 months. I queried for help on this a couple months ago and thought I had resolved the issue.
I think I fix the issue and then it randomly pops back to ruin my day about every 2-4 days. The problem first manifest itself in my project as I was trying to get a one-shot timer configured. Since then I have observed enough to be 97% convinced that this is an interrupt configuration issue with MxCube, but as I debug the code and analyze the auto-generated code by MxCube everything seems correct.
The cycle goes like this. I have to make some change to MxCube for various reasons like deleting a mutex or queue from FreeRTOS or adjusting settings with DMA or ADC interrupts. The ADC and DMA interrupts that I crawled through was the worst of all and I have since abandoned any hope of being able to use DMA and/or ADC interrupts at all. I have also noticed a very strong correlation with the previously mentioned one shot timer. This peripheral cannot be scrapped from my project.
Anyways, every time the bug comes back the behavior is the same. I run my code in the IDE via debug mode. The program enters HAL_Init() and right after the timebase timer (TIM3, but I've tried several others) IRQ is enabled I notice 3 interrupts become pending that were never configured (DMA1_ch3, DMA1_ch5, & OTG_FS). Its like the MCU just totally looses it. I made the following flow chart to illustrate what I see as I debug it.
So then I wrestle around with the NVIC tab within MxCube for hours or days and then the problem just goes away and everything is fine. It is like the MCU is possessed with evil spirits. I've never seen anything like this.
I even tried re-creating my project so that I am starting with the newest version of MxCube (6.5) and I haven't noticed a difference. I also noticed today that about 4mA starts to drain into one of the MCU's ADC pins (PA7) right as soon as the program gets to the crashing point.
Is it possible this is because I am running STM32L4S9AII6 firmware on the STM32L4R9I-EVAL dev board, which uses a different MCU?
Any help would be greatly appreciated. Thanks!


