iMX28 WinCE 6.0 UART driver update to fix the RX DMA data lost issue.

Document created by Qiang Li Employee on Jan 28, 2015
Version 1Show Document
  • View in full screen mode

The lastest iMX28 WinCE 6.0 BSP "WCE600_MX28_SDK1008" has a UART RX DMA data lost issue.

 

Test case to duplicate the issue:

Connect iMX28 UART1 and PC with UART cable, then run some UART test application on iMX28 and PC side, PC can send a file to IMX28, file size should bigger than the default RX DMA buffer size 1024 bytes, then from iMX28 side, there will be data lost.

 

The attached "SERIALAPP.zip" is the updated UART driver code to fix this issue, you can unzip and update it to "wince600\platform\common\src\soc\common_fsl_v2_pdk1_9\serialapp" folder, and rebuild the WinCE image.

 

The followed improvement had been implemented in this update for UART RX DMA:

1. Added DMA recover code.

    When UART error happens in DMA mode, the driver will re-initialize the DMA for next transfer..

 

2. Set UART DMA timeout interrupt to 5ms. "#define SERIAL_DMA_RX_TIMEOUT      5"

    After UART DMA interrupt happens, the IST need copy data from DMA buffer to MDD buffer, so it needs time. The default BSP had set this delay to 31 bits transfer time, this is very short, if the PC send "DMA buffer + 1" bytes to iMX28, after first DMA buffer full interrupt happens, the second DMA timeout interrupt will happen in a short time, this interrupt will be lost, because the driver is still processing the pre-interrupt.

 

3. Updated MDD code to make sure the buffer send to PDD is always bigger than the RX DMA buffer.

    This MDD code modification will only active in DMA mode, so there is no impact for PIO mode.

 

4. Update UART DMA interrupt handler code.

    When UART DMA interrupt happens, set up the next DMA transfer at once, so DMA can continue to receive data with another DMA buffer, the same time the IST will copy data from pre-DMA buffer to MDD buffer.

Attachments

Outcomes