UART1 with SDMA IDLE Detection full duplex causes memory overwrite of the TX buffer

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

UART1 with SDMA IDLE Detection full duplex causes memory overwrite of the TX buffer

491件の閲覧回数
okobelnc
Contributor I

Hi, I am using IMX8MN cortex-M7 with SDK 2.16.000. When using UART1 with SDMA in IDLE detection mode, when there is full duplex transfer (TX and RX at the same time), when the SDMA RX callback is called, the beginning of the TX buffer is overwritten (most of the times it is the first byte, but sometimes it is even more than the first byte).

The IDLE condition is set to 4 frames (the shortest period). If the RX received N bytes, the N+1 byte of the RX buffer is overwritten with a value that was not received (I do not know from where), and the same value is written to the beginning of the TX buffer also.

For example, if UART RX received 30 bytes, the 31st byte of the RX buffer is overwritten with a dummy byte, but also the 1st byte of the TX buffer. It happens only for the TX when TX is sent at the same time that RX is done also.

My configuration of the SDMA is as follow:

  1. UART1 TX channel is 6.
  2. UART1 RX channel is 5.
  3. UART1 TX channel priority is 4
  4. UART1 RX channel priority is 5.
  5. UART1 TX FIFO watermark is 2.
  6. UART1 RX FIFO watermark is 1.
  7. UART1 RTS watermark is 16 (half of the RX FIFO size).
  8. RX buffer size is 4120 bytes (aligned to 4), while every RX transaction is up to 3090 bytes (actually most of the RX transactions are around ~30 bytes). The same RX buffer is used for every RX transaction (the transactions start from the same memory address).
  9. TX buffer size is up to 4124 bytes (aligned to 256), while every TX transaction is up to 3093 bytes (actually most of the TX transactions are around ~300 bytes). The same TX buffer is used for every TX transaction (the transactions start from the same memory address). The TX buffer starts with 0xBD byte, and I see that in those scenarios, the 0xBD is replaced by the N+1 byte in the RX buffer.

What can be the reason for this, and how it can be resolved?

ラベル(1)
0 件の賞賛
返信
3 返答(返信)

446件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi Okobelnc:

Do you use RTOS or bare metal?
 
Could you please check if there are some error bits in USR1 and USR2  state registers when this issue happens?
 
Regards
Daniel
0 件の賞賛
返信

423件の閲覧回数
okobelnc
Contributor I

Hi Daniel.

 

Yes, I am using FreeRTOS. Here are the registers USR1 and USR2 of UART1 values:

okobelnc_0-1747287920782.png

 

0 件の賞賛
返信

333件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi  @okobelnc 

 

According to ERR050362 in https://www.nxp.com/docs/en/errata/IMX8MN_0N14Y.pdf , AXI bus may experience error when dealing with unaligned burst writes.

You may try 64-bit aligned data (e.g. 32 bytes) and see if the issue is gone. If so, make your buffer 64-bit aligned and leave margin between buffers to mitigate the impact.

 

Regards

Daniel

0 件の賞賛
返信