Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a serial device running which I need to read data from(I have absolutely no control over the device itself) except reading its output; using hyper terminal in Windows I am able to detect a meaningful traffic and yesterday when I used cat (or my own little C program to read the data and print it to stdout) it worked fine.

Today, when I use cat/my program all I get is a sort-of corrupted data, yet hyper terminal still shows the data.

What could possibly be wrong? how could it have worked yesterday but not today?

The file I am/was reading is /dev/ttyUSB1

*Please note that I am never running BOTH my program and cat, only one of them at a time.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Someone on SO hinted in the right direction; the problem was with the baudrate, it was set to a different value than what I need.

To check the baudrate: stty -F /dev/ttyUSB1
To set the baudrate: stty -F /dev/ttyUSB1 57600 (57600 in my case is the baudrate my device needs)

It's working like a charm now.

share|improve this answer

Serial ports are especially weird beasts. You'll want to use an Old School terminal emulation program. I used to think tip was the best, but nobody seems to have the source for it any more. cu comes with UUCP, and it's a complete hassle to install and configure, don't even bother.

A quick google around tells me that people tend to use minicom these days. Here's a Stack Overflow question that seems like it has some bearing, at least on using minicom to talk to a USB serial device.

Let us know how this turns out. Update your question or leave a comment or something.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.
{"cc_re__cc_re__cc_by_sa_3_0": ["                  <li><a href=\"//area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2015 stack exchange inc; user contributions licensed under <a href=\"http://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a> \r\n                with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2015.7.1.2692\r\n            </div>\r\n                <div id=\"additional-notices\">\r\n                    Linux is a registered trademark of Linus Torvalds. UNIX is a registered trademark of The Open Group. <br>This site is not affiliated with Linus Torvalds or The Open Group in any"], "copyright__copyright__copyright": ["gle around tells me that people tend to use minicom these days. Here's a Stack Overflow question that seems like it has some bearing, at least on using minicom to talk to a USB serial device.\n\nLet us know how this turns out. Update your question or leave a comment or something.\n\nshare|improve this answer\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}