cancel
Showing results for 
Search instead for 
Did you mean: 

Why placing breakpoints after enabling and starting USART DMA transfer in STM32F429I Discovery board corrupts my program execution?

MSaif
Associate II

Hi Everyone

I am working on a FreeRTOS based application in which I have to enable USART DMA channel to transmit 16 bytes of buffer from memory to USART Data Register in a task. It happens every time my task is invoked. Everything seems to work fine unless I put a breakpoint inside my task. When I put a breakpoint after DMA Start it gets hit only once. Then the program is lost somewhere and never returns to my task. I want to ask why putting breakpoints after DMA start never returns my program control to my task? On the contrary if there are no breakpoints my code works fine.

2 REPLIES 2
Jack Peacock_2
Senior III

A gotcha when using DMA with a debugger is in exactly what happens when the debugger takes over. If it happens to display the latest USART register settings (Atollic does this) it also reads the USART data register...at the same time as DMA.

Make sure you have the debugger window for SFRs closed.

On the other hand it may have nothing to do with DMA. Does your program work without the breakpoint? Does the DMA or USART status show an error?

Jack Peacock

MSaif
Associate II

thanks @Community member​  for your reply. I just checked that unpredictable behavior of my program due to breakpoints has nothing to do with the DMA. Keil MDK5 Just behaves strangely when you put breakpoints in the FreeRTOS tasks. If I remove breakpoints and run my program freely then every thing seems fine.