cancel
Showing results for 
Search instead for 
Did you mean: 

DMA - USART transfer Peripheral to Peripheral

lotou
Associate II

Hi,

I am experiencing a packet loss issue using Peripheral-to-Peripheral DMA between UARTs.

While Peripheral-to-Peripheral configuration is referenced in the STM32U585's Reference Manual, it is not available in the HAL library. Therefore, the DMA is configured for Peripheral-to-Memory mode, with the destination address set to the UART's Transmit Data Register (TDR). FIFO mode is not used.

The reference setup I am using is based on the B-U585I-IOT02A, where no packet loss occurs.

(MSI Clock)

  • USART2_RX → USART3_TX
  • USART3_RX → USART2_TX

The packet loss issue occurs on another STM32U5 (u585cit6q) with the same software but different UART configurations. 

(HSE Clock)

  • USART3_RX to UART4_TX
  • UART4_RX to USART3_TX

USART3 is configured to use the RS485 protocol.

The packet loss varies between 0.0025% and 10%, depending on the baud rate, and it is not correlated to an increase in speed.

Is it possible to experience synchronization issues between USART and UART? 
Can the addition of the RS85 be the source of the issue ?


Regards,
Loïc

3 REPLIES 3
Andrew Neil
Super User

Please post your schematic and a minimum but complete example which illustrates the problem

How to insert source code

 


@lotou wrote:

Can the addition of the RS85 be the source of the issue ?


Have you tried without it?

Have you tried without DMA?

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

Sure,
here is the application code:

while ((UART_A.Instance->ISR & USART_ISR_TXE) != USART_ISR_TXE);
while ((UART_B.Instance->ISR & USART_ISR_TXE) != USART_ISR_TXE);

HAL_UART_Receive_DMA(&UART_A,(uint8_t *)&UART_B.Instance->TDR,1);
HAL_UART_Receive_DMA(&UART_B,(uint8_t *)&UART_A.Instance->TDR,1);	


The main difference is the mcu and its configuration, both done with CubeMX.
 STM32U585AII6Q :
- UART_A = USART2
- UART_B = USART3
- MSI Clock

STM32U585CIT6Q:
- UART_A = USART3 - RS485 (PB1 set High)
- UART_B = UART4
- HSE Clock


Test procedure :
Read from UART_A_TX (/dev/ttyUSBx) and store it to result.bin file.
Send a random binary file to UART_B_RX ( /dev/ttyUSBy).
Compared sent file and result.bin: must be exactly the same.

Repeat the test but send to UART_A_RX and read from UART_B_TX
Baudrate: 4M bauds

 

Test results:

STM32U585AII6Q: OK
STM32U585CIT6Q: NOK - Change baudrate changes the amount of byte loss.

4M bauds: 0.0025% loss

3M bauds: ~0.0025% loss
1M bauds: 10% loss

 

  • Have you tried without it (RS485) ?

No and i am not suppose to.

  • Have you tried without DMA ? 

That's also a no.




TDK
Super User

> The packet loss varies between 0.0025% and 10%, depending on the baud rate, and it is not correlated to an increase in speed.

What is the nature of the packet loss? Garbled characters? Missing characters? Do parity or frame or noise errors get triggered?

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