cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L151 USART Rx + DMA length of received data is not updated

Dimitry
Associate

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:

https://github.com/MaJerle/stm32-usart-uart-dma-rx-tx/blob/main/projects/usart_rx_polling_rtos_F4/Src/main.c

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?

0 REPLIES 0