2024-07-30 09:34 AM
I have an STM32L452 part in a system with multiple DMA and interrupt operations going on.
The main problem I'm having right now is _sometimes_ I don't get the interrupt for DMA RX on UART4. Sometimes I do, sometimes I don't.
I have been adjusting the NVIC priorities and have set "UART4 Global Interrupt", and "DMA2 Channel 2 Global Interrupt" (the DMA for UART4) at the highest priority (0), and given that DMA the highest priority among the other DMAs
I have a strong feeling that the issue is related to interrupt preemption, and that the UART 4 interrupts not being reset correctly. However, the issue persists even when when I give UART 4 max priority over everything.
The code is to complex to post, but I'm hoping that someone can throw out some ideas for me to check out?
Thank you!
2024-07-30 10:49 AM
Does the problem go away if you disable other interrupt sources other than what's necessary for the channel you're having issues with?
2024-07-30 11:02 AM
Interesting... just as an experiment i disabled the other interrupts and DMAs and the issue is still happening. Maybe its not interrupt related? I've implemented the HAL_UART_ErrorCallback(), and HAL_DMA_ErrorCallback() functions to check for DMA and UART errors, but they never get called.
I do see the data coming back into the board as expected with a scope.. so its coming.. just sometimes not getting detected for some reason.Reply
2024-07-30 11:31 AM
> The code is to complex to post, but I'm hoping that someone can throw out some ideas for me to check out?
Probably a bug in the code as opposed to a bug in silicon.
Missing volatile, bad logic, race condition, could be any number of things.
2024-07-30 07:22 PM
Create a new project with simplest code you can to replicate the functionality. If it works, you need to identify the difference between the two. If it doesn't work, you're doing something wrong, and you can ask a more detailed question here with specific code examples.