Reply
Thread Tools
Posts: 92 | Thanked: 9 times | Joined on Nov 2009 @ Germany, Bavaria
#1
Hi!

I know it's very off-topic, but i think here are many linux professionals which have experience with such things.

I want to send a defined bit pattern to the RS232-interface of my NAS-System (NSLU2 running debian linux).

Is it possible? Which sofware do i need?

My target is to send a defined sequence of bits to a connected board which controls the color of RGB-LEDs. (future plan: controlled by my N900 - like the light switch on&off process at the moment)

The board will be assembled by a friend (electrician) - therefore it is not the topic of the question. My question is only how i can send the bits to the rs232-port.

Thanks in advance for you answers

Last edited by RouterRebooter; 2010-01-26 at 14:17.
 
Posts: 3,841 | Thanked: 1,079 times | Joined on Nov 2006
#2
The RS232 ports on a Linux box are named /dev/ttyS0 (for com1), /dev/ttyS1 (for com2) and so on.

You can send data to the port simply by using any application that writes to those device files. They don't need root access, just make the user account part of the 'dialout' group (just do 'ls -l /dev/ttyS0' to verify the group - if it's 'dialout' or not depends on the distro).

You can use the 'stty' program to set/inspect/change parameters for baud rate, xon/xoff support (on/off), etc. Another tool is 'setserial' (try 'man setserial'. It has a lot of information.)

If your RS-232 programming interface is more binary oriented than can be handled by the above, or if you need full control over the pins (e.g. for hardware flow control), then you may need to write an application accessing the serial port(s) directly, and use 'fcntl' or 'ioctl' system calls to control the pins. Then you use write/read calls to write or read bytes to/from the port.
__________________
N800/OS2007|N900/Maemo5
-- Metalayer-crawler delenda est.
-- Current state: Fed up with everything MeeGo.
 
brendan's Avatar
Posts: 531 | Thanked: 79 times | Joined on Oct 2006 @ This side of insane, that side of genius
#3
depending on the version of linux your PC is running, the group that you need to be part of can be the older group "uucp" (unix-to-unix-copy) or the newer group "dialout". Fedora 10 and 11 have this difference.

I have found that gtkTerm is a nice GUI app for serial connection work.
__________________
Nokia n800
OS 2008
Pharos iGPS 360-BT
ElmScan 5 BlueTooth
BlackBerry Bold (9000)
AT&T Wireless
 
Posts: 92 | Thanked: 9 times | Joined on Nov 2009 @ Germany, Bavaria
#4
Thank you!
This takes me a step closer to my target

Last edited by RouterRebooter; 2010-01-26 at 18:08.
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 09:59.