[i.MX RT1040 EVK] SAI EDMA Local Loopback Issue: RX buffer data shifted by 4 bytes

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[i.MX RT1040 EVK] SAI EDMA Local Loopback Issue: RX buffer data shifted by 4 bytes

814 Views
nikonz66
Contributor I

Hi NXP Team,

I am currently working on the official i.MX RT1040 EVK and trying to use the SAI interface for custom pure data transfer (not standard audio). To verify my logic, I am performing a Local Loopback Test by physically shorting the SAI TX and RX pins on the EVK, completely bypassing the external audio codec.I want to use the I2S (SAI) interface as a high-speed communication peripheral for pure data transfer (not standard audio) and encapsulate it into a custom communication driver layer. I am currently in the testing phase verifying the basic logic.

I initialized the SAI to work in classic I2S master mode (generating BCLK and SYNC internally) and used SAI_TransferSendEDMA() and SAI_TransferReceiveEDMA() with a buffer size of 128 bytes.

When I populate my tx_buffer starting with 0xAA (e.g., [0xAA, 0x01, 0x02, ...]) and start the DMA transfers, the rx_buffer receives the data, but the entire payload is shifted by 4 bytes. Specifically:

1   rx_buffer[0] to rx_buffer[3] are always 0x00.

2   My actual first byte 0xAA appears at rx_buffer[4].

3   The rest of the data follows sequentially, which means the last 4 bytes of my payload are truncated/lost because the DMA transfer size is strictly 128 bytes.

(Please see the attached Keil debug screenshot showing the tx_buffer and rx_buffer memory windows.)
Any guidance or reference code would be greatly appreciated. Thank you!

0 Kudos
Reply
1 Reply

737 Views
nikonz66
Contributor I

solved
If both the transmitter and receiver use the transmitter bit clock and frame sync:
• Configure the transmitter for asynchronous operation and the receiver for
synchronous operation.
• Enable the receiver in synchronous mode only after both the transmitter and receiver
are enabled.
• Enable the transmitter last and disable the tranmitter first.