Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 02 Oct 2014, 02:25
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
How to talk to serial device via command line?
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
Rickrandom

Joined: 21 Jan 2006
Posts: 195
Location: Bedfordshire, UK

PostPosted: Sun 16 Jan 2011, 05:21    Post_subject:  How to talk to serial device via command line?  

I am trying to communicate with an electronics device with a serial connection, and I have two different USB to serial adaptors. If I plug either in to my Puppy 511 machine, it shows up as ttyUSB0, so that seems promising.

I thought I would just use the command line, and I think I know how to set the baud rate (stty -F /dev/ttyUSB0 ispeed 2400) and how to log the response into a file (cat /dev/ttyUSB0 > /root/my-documents/log_file.txt) (by cribbing from http://www.futuretimes.webfreehosting.net/USB_multimeter.html).

However what I have no idea about is how to send anything out, e.g. the commands that I need to send to my electronics device, so it then replies with the data that I can log.

Any help gratefully received.
Back to top
View user's profile Send_private_message 
MagicZaurus

Joined: 05 Jan 2009
Posts: 88

PostPosted: Sun 16 Jan 2011, 06:43    Post_subject: Serial communication  

You can send something (ABC) to the device with the following command.

Code:
echo "ABC" > /dev/ttyUSB0


More interactive would be the use of a terminal program like minicom.
Back to top
View user's profile Send_private_message 
Rickrandom

Joined: 21 Jan 2006
Posts: 195
Location: Bedfordshire, UK

PostPosted: Sun 16 Jan 2011, 06:51    Post_subject:  

Thanks.

I will look at Minicom, but thought I'd simply start with the command line.
Back to top
View user's profile Send_private_message 
MagicZaurus

Joined: 05 Jan 2009
Posts: 88

PostPosted: Sun 16 Jan 2011, 09:20    Post_subject: Serial communication  

You are right to try from the command line first to see if the communication with your device works fine. I only have the experience with some of these USB-To-Serial adapters under Windows and my experience is that not all of them work with all devices. The best way is still a good old COM port, but they are getting more difficult to find.
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0652s ][ Queries: 11 (0.0265s) ][ GZIP on ]