2023-06-25 02:45 AM
Hi, team.
I'm working on STM32L151 and have implement data transfer over USART + DMA, the implementation is very closed (but contains some modifications) to the following example:
My occasional problem is getting a data from DMA.
Short description of the design
When STM32L151 wakes up as result of USART Rx, I, among other things, initialize DMA max data to read (MAX_RX_SIZE) by call LL_DMA_SetDataLength() and then, start polling the DMA by 1 mS timer in order to read the data. When polling DMA I use the function LL_DMA_GetDataLength() to determine when the data have been taken by the DMA.
Usually, this works, but sometimes the following problem occurs:
- after USART have received a data and DMA is initialized, for any number of polls, the LL_DMA_GetDataLength() function returns exactly same value (MAX_RX_SIZE), as was set by LL_DMA_SetDataLength() function on initialization.
What could be the problem and how can I debug it?