LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 08-23-2016, 04:36 PM   #1
streamholder
LQ Newbie
 
Registered: Aug 2016
Posts: 4

Rep: Reputation: Disabled
CDC-ACM driver returning garbage data


Hello.

I'm trying to connect a u-Blox USB GPS device to an embedded (armel) Linux 2.6.32 system based on BusyBox. The device has a native CDC ACM USB interface. The system didn't come with cdc_acm, so I cross-compiled it, transferred & insmodded it, and it loaded successfully (confirmed by dmesg).

I connected the device and it correctly got enumerated by the USB driver with address 001:003, and assigned to the cdc_acm driver that created the /dev/ttyACM0 file. However, opening the device with a serial terminal or even with the cat command, results in garbage being printed, whereas ASCII NMEA commands should be printed (this is confirmed to work on two other systems).

stty runs on the file without errors (however the reported data is obviously invalid/arbitrary, due to the device being a USB device and not a serial device). lsusb -v -s 1:3 also reports the correct information for the device.
I don't know how to further debug the issue, as BusyBox is a pretty limited environment and I don't have much experience with Linux. Any help would be greatly appreciated.

Thank you.
 
Old 08-24-2016, 07:49 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 7,214
Blog Entries: 12

Rep: Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656
You should be able to cat /dev/ttyACM0 and see the data. What bit rate is the ublox running at? When you run stty, what do you see?
Code:
stty -F/dev/ttyACM0
You should have the correct bit rate set to match what the device is showing. I usually put serial ports into raw mode to avoid any translation errors, this argument is available in the stty call.
 
Old 08-24-2016, 10:30 AM   #3
streamholder
LQ Newbie
 
Registered: Aug 2016
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rtmistler View Post
You should be able to cat /dev/ttyACM0 and see the data. What bit rate is the ublox running at? When you run stty, what do you see?
Code:
stty -F/dev/ttyACM0
You should have the correct bit rate set to match what the device is showing.
Ah, I didn't know it should match. I figured it always showed 9600, and then determined the right speed when the port was opened, like it happens on Windows systems. Sorry about that.

The uBlox is running at 57600 bps, stty reports 9600 bps, so I guess we have a problem here.

About raw mode, I can't see/test it right now. I'll post the entire stty output ASAP.

Last edited by streamholder; 08-24-2016 at 10:32 AM.
 
Old 08-24-2016, 10:42 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 7,214
Blog Entries: 12

Rep: Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656Reputation: 2656
Use the stty command to change the resource to be 57600, just add that as an argument after the -F/dev/ttyACM0 term.
 
Old 08-25-2016, 04:15 AM   #5
streamholder
LQ Newbie
 
Registered: Aug 2016
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rtmistler View Post
Use the stty command to change the resource to be 57600, just add that as an argument after the -F/dev/ttyACM0 term.
You're right. I issued the commands
Code:
stty -F /dev/ttyACM0 57600
stty -F /dev/ttyACM0 raw
and I can now read meaningful data from the device.

Thank you!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
udev rules 3g modem cdc acm actmnophn Linux - Hardware 0 08-18-2011 09:51 PM
missing /dev/ttyACM0 , modprobe cdc-acm agentchange Linux - Software 5 01-26-2010 12:46 AM
USB -> CDC-ACM with TI eZ430u OMAP3 Linux - Hardware 2 04-15-2009 08:18 AM
BUG in cdc-acm driver, kppp, pppd don't know which or how to find out. rbees Programming 1 09-22-2008 08:15 PM
cdc-acm does not run at startup LeeJam Mandriva 0 06-01-2004 05:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 12:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration