USART with DMA pauses after receiving 2048 bytes

Discussion around products based on ARM Cortex-A5 core.

Moderator: nferre

cajjed
Posts: 9
Joined: Thu Aug 25, 2016 3:12 am

USART with DMA pauses after receiving 2048 bytes

Fri Dec 16, 2016 8:40 pm

I have a samda5d36 running debian linux kernel 4.1.10 which is running two serial ports, bluetooth low energy, and several other peripherals so I was occasionally missing a byte on my serial lines. Thus I have tried implementing DMA by turning off i2c and SPI DMA so that I would have room for the USARTs:

Code: Select all

			usart1: serial@f0020000 {
				pinctrl-0 = <&pinctrl_usart1 &pinctrl_usart1_rts_cts>;
				atmel,use-dma-rx;
				atmel,use-dma-tx;
				status = "okay";
			};

			usart2: serial@f8020000 {
				pinctrl-0 = <&pinctrl_usart2 &pinctrl_usart2_rts_cts>;
				atmel,use-dma-rx;
				atmel,use-dma-tx;
				status = "okay";
			};
I had to adjust the stty by turning off ECHO and ONLCR to get my loopback to work normally.

stty -F /dev/ttyS2 -echo -onlcr

The problem is after receiving 2048 bytes the USART just stops receiving until I restart the USART.

I am just sending bytes from a file to /dev/ttyS2

cat testLines > /dev/ttyS2

and then

cat < /dev/ttyS2

Here is my current stty configuration

Code: Select all

stty -F /dev/ttyS3 -a   
atmel_usart f8020000.serial: using dma1chan6 for rx DMA transfers
atmel_usart f8020000.serial: using dma1chan7 for tx DMA transfers
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -ixon -ixoff
-iuclc -ixany imaxbel -iutf8
opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
Any insight on what might be causing this?
blue_z
Location: USA
Posts: 1508
Joined: Thu Apr 19, 2007 10:15 pm

Re: USART with DMA pauses after receiving 2048 bytes

Mon Dec 19, 2016 8:26 pm

cajjed wrote:The problem is after receiving 2048 bytes the USART just stops receiving until I restart the USART.
How do you "restart" a USART?
cajjed wrote:Any insight on what might be causing this?
Your contrived test (with deferred read) requires input buffers with infinite capacity.
You could be saturating the line discipline buffer, although it's typically 4KB.

Regards
cajjed
Posts: 9
Joined: Thu Aug 25, 2016 3:12 am

Re: USART with DMA pauses after receiving 2048 bytes

Mon Dec 19, 2016 9:08 pm

Thanks for the reply, restarting just means that I ctrl-c the cat < /dev/ttyS2 and restart it.

Further play has shown me that it doesn't halt at 2048 bytes but after the first 2048 bytes it will only output 2048 bytes at a time?

Also I run the cat < /dev/ttyS2 in one terminal and then run the cat testFile > /dev/ttyS2 in another terminal. I also see the same results if I use a different serial port (say /dev/ttyS3).
cajjed
Posts: 9
Joined: Thu Aug 25, 2016 3:12 am

Re: USART with DMA pauses after receiving 2048 bytes

Tue Dec 20, 2016 1:10 am

So I updated to kernel 4.8.12 and mostly left the configuration file default as found in /arch/arm/config and that fixed the issue. So not sure if it is the kernel or a configuration file related to DMA?

Return to “SAMA5D Cortex-A5 MPU”

Who is online

Users browsing this forum: No registered users and 1 guest