cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F767ZI UART DMA RX LOCK(STOP)

Snam.2
Associate

After system initialization, UART DMA Rx function is normal.

When time passes, data is not received in the DMA buffer and the phenomenon is stopped.

To solve the problem, we checked the normal operation by repeating the DMA initialization as shown below.

[Questions]

1. I wonder if there is any problem with the system even if I use it as follows.

2. If there is any related data on UART DMA Rx stop phenomenon, please ask.

MX_DAM_Init();

HAL_UART_Receive_DMA(&huart3, dmabuff, DAM_BUF_SIZE);

 while(1)

{

   uart3_rx_dma_handler(); //DMA buffer receive function

  MX_DAM_Init(); //<< additional code

  HAL_UART_Receive_DMA(&huart3, dmabuff, DAM_BUF_SIZE); //<< additional code

4 REPLIES 4
LCE
Principal

> MX_DAM_Init(); //<< additional code

(I guess you mean MX_DMA_Init?)

This will probably not help, when DMA(s?) are constantly initialized.

When anything happens on the UART while DMA is initialized you might lose or get some corrupt data.

I'm pretty sure that you will never get reliable data: while receiving only one bit at a baud rate of e.g. 115k2, the DMA will be initialized several times.

Anyway, even if working, that looks like some very poor workaround, so better check all register settings of UART and DMA, and read the reference manual.

Snam.2
Associate

Thank you for answer.

The baud rate is 19200

I receive 30 bytes of data

It's okay to lose incoming data

Repeatedly transmitted from the sending device.

It doesn't matter if it is received only once out of several times.

In order to avoid the problem of completely stopping, every 5 seconds

Initialized MX_DMA_Init() and HAL_UART_Receive_DMA().

MX_DAM_Init();

HAL_UART_Receive_DMA(&huart3, dmabuff, DAM_BUF_SIZE);

 while(1)

{

   uart3_rx_dma_handler(); //DMA buffer receive function

 if(5sec)

{

   MX_DAM_Init();  //<< additional code

   HAL_UART_Receive_DMA(&huart3, dmabuff, DAM_BUF_SIZE);  //<< additional code

}

If the uart dma Rx function works without stopping, why not use it?

​Hello @Snam.2​ and welcome to the Community :)

> MX_DAM_Init();

I think you mean MX_DMA_Init.

I advise you to refer to the UART example within STM32CubeF7 MCU package:

\STM32Cube_FW_F7_V1.16.0\Projects\STM32F769I_EVAL\Examples\UART\UART_HyperTerminal_DMA

You may update the example according to your needs, and you will find a readme file describing how to test the example.

When your question is answered, please close this topic by choosing Select as Best.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
TDK
Guru

I would normally assume that MX_DAM_Init is a typo, but the typo is so prevalent in everything (e.g. DAM_BUF_SIZE) it's hard to know for sure.

In any case, MX_DMA_Init() should only be called once. HAL_UART_Receive_DMA() shouldn't be called continuously, but rather only when the peripheral is ready. It's better to identify and fix the source of the issue rather than add code in the hope that it will fix it.

If reception "stops", there is likely a reason such as a framing error, or overrun error, or the transmission just completed with no additional RX call.

If you feel a post has answered your question, please click "Accept as Solution".