0

I have a sama5d36 device running Debian jessie (kernel 4.1.10) with a DMA USART. To get the DMA USART to output correctly I had to turn off ECHO and ONLCR.

stty -F /dev/ttyS2 -echo -onlcr speed 115200

If I do a test where I send a bunch of bytes, I will receive 2048 bytes and then it stops receiving until I restart.

cat testLines > /dev/ttyS2
cat < /dev/ttyS2

Here is the output of /proc/tty/driver/atmel_serial

2: uart:ATMEL_SERIAL mmio:0xF0020000 irq:31 tx:2185 rx:2048 DSR|CD|RI

Here is my stty output (stty -F /dev/ttyS2 -a):

atmel_usart f0020000.serial: using dma0chan4 for rx DMA transfers
atmel_usart f0020000.serial: using dma0chan5 for tx DMA transfers
speed 115200 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

The DMA buffer for atmel_serial is 512 bytes.

Any insight?

Update: Further playing has demonstrated that the serial will write more than 2048 bytes but it freezes after 2048 bytes and then will only write once 2048 bytes have been written. Looking at atmel_serial.c in the kernel it looks like the ring buffer is set for 1024. So I am still confused why 2048 bytes is significant.

  • You should really use stty raw if receiving arbitrary binary data. For example you still have isig so input characters can be converted to signals. – meuh Dec 17 '16 at 18:28
  • I tried stty -f /dev/ttyS2 -echo -onlcr raw speed 115200 and no difference. I actually have tried many different combinations but nothing seems to make a difference. My test characters are just numbers and return. – cajjed Dec 17 '16 at 23:57
1

Upgrade your kernel to a newer kernel. There were issues with this driver in the earlier kernels.

  • I upgraded to 4.8.12 and used mostly the default settings from arch/arms/configs/sama5_defconfig and it works great. Thanks for the insight. – cajjed Dec 20 '16 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.