usb-serial ports send weird characters

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

usb-serial ports send weird characters

3,550 Views
jsmith883
Contributor III

Hello,

I am connecting a modem to the i.MX6 via USB, which enumerates 4 different ttyACM ports.  If I open one of the ports in minicom or screen, when I type in "AT+CGMI", it will type "@T*BLFH" instead.  This worked in kernel 3.14, but it seems that USB serial ports are having issues in kernel 4.1.15.  The two strings seem to be off by the least-significant bit in each byte. 

Someone else had a similar problem, and seems to be related to DMA (see link below).  In this case it was a dedicated UART port and disabling DMA solved the problem.  Is there a way to disable DMA on a USB serial device?

iMX6 Linux serial port buffer 

 

EDIT: After some more research, I've eliminated some possibilities and dug deeper into the rabbit hole.  It turns out it has nothing to do with the kernel version after all.  If I connect a USB to Serial converter (I'm using Prolific PL2303), and I short the RX and TX together so I read back what I write, I've noticed that I can send data correctly, but when I receive data it is off by one bit.  I've verified this by using a logic analyzer to make sure that when I type "A", the logic analyzer also reads "A".  But when looking at the echo from minicom, it shows "@" instead.

Any ideas why I can send data correctly, but when I receive data it is not correct?  I do not think this is a hardware issue since sending works... right?

Any thoughts on how to get this working?

Here is how the serial port is configured:

# stty -F /dev/ttyACM0 -a
speed 9600 baud;stty: /dev/ttyACM0
line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^H; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 100; time = 2;
-parenb -parodd 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

Labels (4)
0 Kudos
5 Replies

2,298 Views
igorpadykov
NXP Employee
NXP Employee

Hi jsmith883

what bsp used in the case, one can try with nxp demo images

https://www.nxp.com/webapp/Download?colCode=L4.1.15_2.0.0_MX6QDLSOLO&appType=license&location=null 

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

0 Kudos

2,298 Views
jsmith883
Contributor III

igorpadykov

I updated my question now that I dug a little deeper.  Still confused as to what is going on.  Any thoughts?

0 Kudos

2,298 Views
igorpadykov
NXP Employee
NXP Employee

one can try with unit tests (./mxc_usb_test folder)

imx-test
www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-test-5.7.tar.gz

Best regards
igor

0 Kudos

2,298 Views
jsmith883
Contributor III

Hi igorpadykov‌,

I ran the USB unit tests and it does pass.  Do you have any other ideas?  I posted to the linux-serial mailing list to get some help debugging the issue.  Could it be a hardware issue?  Do you want to see the schematic or any signals on the o-scope?

Here is the result of the USB unit test:

root@imx6qdlsolo:~/imx-test-5.7/imx-test-5.7/test/mxc_usb_test# ./autorun-usb-host.sh
USB Ethernet Host test
autorun-usb-host.sh: Exiting PASS

0 Kudos

2,298 Views
jsmith883
Contributor III

Hi Igor,

I am using that exact BSP, found here: http://git.freescale.com/git/cgit.cgi/imx/linux-imx.git/log/?h=imx_4.1.15_2.0.0_ga .

I am using Buildroot, in case that matters.  Any idea why the LSB is always missing on each byte that is sent?  The interesting this is if I copy and paste a command from the clipboard, it works.  If I type the command it doesn't work.

In other words, if I paste this command "AT+CGMI", it shows up as "AT+CGMI" and works.  If I type this command "AT+CGMI", it shows up as "@T*BLFH", where each byte is missing the LSB (A => ascii 0x41 -> ascii 0x40 = @ and I = ascii 0x49 -> ascii 0x48 -> H).

I can't tell if this is an issue with the serial driver (DMA issue or something else), or if it's just a tty setting that needs to change.  Thoughts?

0 Kudos