Strange problem while using UART with DMA

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

Strange problem while using UART with DMA

2,176 Views
jarodnan
Contributor I

I've got a RSB4210(i.MX536) from Advantech and trying to use UART4 with DMA.

The bsp is from the manufacturer, and the kernel version is 2.36.35. Strange things appear if I enable the DMA of UART4.

Using printk to output some debuf message in the mxcuart_dmaread_callback() funtion of mxc_uart.c, I've got things below.

If I send 64 bytes to the RSB4210, mxcuart_dmaread_callback() is called 3 times, and the received data each time is:

1   bytes:  0x00

46 bytes: 45bytes 0x00

19 bytes: 19bytes

If I send 128 bytes to the RSB4210, mxcuart_dmaread_callback() is called 4 times, and the received data each time is:

1   bytes:  0x00

46 bytes: 45bytes 0x00

46 bytes: 45bytes 0x00

38 bytes: 38bytes

I've also merge the sdma_script_code_mx53.h, mxc_uart.c, mxc_uart.h, serial.c, serial.h from the freescale git server (http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/log/?h=imx_2.6.35_maintain). But it's still the same.

I've consult Advantech's engineers, they tell me that engineers from freescale said that it should be connected with 4 wires in DMA mode in order to avoid errors. I don't thing it has anything to do with the strange things.

Labels (2)
0 Kudos
Reply
3 Replies

1,351 Views
igorpadykov
NXP Employee
NXP Employee

Hi Jarod

Freescale DMA driven UART driver uses flow control

(CTSTL (UARTx_UCR4) you can check below links

https://community.freescale.com/thread/304428

https://gitorious.org/u-mobo/linux-imx/commits/ed51f22bea310805bfdcc1be236cc56ff0832b3a

Best regards

chip

1,351 Views
Yuri
NXP Employee
NXP Employee

  The user should use hardware-driven hardware flow control when using
DMA data transfer. For more information, see the Linux documentation
on the serial driver in the kernel source tree.

  Please take a look at section “Hardware Flow Control (RTS/CTS etc.)”
of the next document :

http://www.tldp.org/HOWTO/Text-Terminal-HOWTO-11.html


Have a great day,
Yuri

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,351 Views
jarodnan
Contributor I

Thanks Yuri.

Could you please explain some more for me? I've read the mx53 ref manual, but couldn't find much useful information.

How can uart without hardware flow control affect the DMA callback?

Does the RTS/CTS of mx53 works in the modern fashion or the old fashion?

0 Kudos
Reply