setting up serial communication from desktop through USB port in linux terminal
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
setting up serial communication from desktop through USB port in linux terminal
I am new to linux terminal programming and all but i want to set up a simple serial communication from my desktop through USB port. The actual idea to to write some data in the terminal and build a terminal program that sends the data to the usb port with a fixed baud rate. are there ready made terminal programs available for this simple communication?or atleast any Graphical tools which could help me build and design such a terminal in ubuntu 9.04?
USB is a packetized bus with many device types, so there is no one thing called USB to send data to. What type of device are you trying to communicate with? What are you trying to do with it?
well i am trying to establish a serial connection between the desktop and RS232 interface on my dev board.The objective is to build a terminal program which will transmit what ever character i type in the terminal with to fixed baud rate to the board interface...
OK, so the device on the other end of the cable is an RS-232 adapter. Linux has drivers for a lot of those. What you want to do is get it to show up as a TTY (probably /dev/ttyS0) so you can attach a terminal emulator to it. With the device plugged in, run 'lsusb' from a root terminal. It will print one line for each USB device on your system. Look for the line describing your device and post it. If you can't find it, just post the whole thing.
If your dev board's USB port is a USB serial port adapter then it might already be recognized as /dev/ttyUSB0. Check the output of the dmesg command. Also post the output of the lsusb command. The output will display the chipset information. You can use minicom to communicate with the board or search for linux serial programming to help you get started with writing your on program
I want to send/receive data via usb port in C on Linux machine
my dmesg output is
[15246.867897] usb 1-2: pl2303 converter now attached to ttyUSB0
[15246.867897] usb 1-2: New USB device found, idVendor=050d, idProduct=0257
[15246.867897] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[15246.867897] usb 1-2: Product: USB-Serial Controller
[15246.867897] usb 1-2: Manufacturer: Prolific Technology Inc.
my lsusb output is
Bus 001 Device 012: ID 050d:0257 Belkin Components F5U257 Serial
I want to code to send and recieve data can anyone please help me.
cadd,
Please explain in detail what you are trying to accomplish. Your device seems to be recognized so I assume it is just a matter of writing some program to communicate with your device.
cadd, it looks like you have a Belkin USB to RS-232 adapter plugged in, which uses the Prolific PL-2303 chipset. It's been recognized by the pl2303 driver, which is exposing it as the TTY device /dev/ttyUSB0. It's a plain old TTY, so you can treat it just like a normal serial terminal and ignore the USB part entirely. USB is being handled for you by the kernel.
If you just want to send a data file across the wire and no special protocol is required, you may be able to do so with shell IO redirection. For example:
Code:
$ cat my-data-file > /dev/ttyUSB0
If you want to interact with it like a normal terminal you need a terminal emulator like minicom.
I am doing it as a serial communication only in C under linux. I have a specific protocol to follow. I am very new to serial port communication. You have suggested 3 methods for programming through C for specific protocol. which one do you think is best.
I am also trying to use minicom to see how is the dumb device doing as I have no clue what it is taking and giving me as output. How can I do it in minicom. I have minicom working on my machine but do not know how to send data to my serial port and read data using minicom.
Hi CADD
I am new to LQ as well as minicom. I have connected my serial device through USB to RS232 converter and it is showing the USB device as online status. Now i want to check if i can send and receive some data on my controller (roboclaw)? Is it possible to check transmitted and receiving data on minicom?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.