Linux Serial port
Zetsu
Posts: 186
Having a little bit of an issue trying to use stty to set up a serial port to communicate to a prop.
I issued stty -F /dev/ttyS0 9600
I have a cable between the serial port on this computer and my laptop ( via usb to serial adapter on laptop side )
On the Linux machine I can then echo "1" > /dev/ttyS0
except on the laptop I get nothing in the Terminal ;x
Plugging my prop in doesn't work as expected too.
Is there something else I am forgetting to do ??
I issued stty -F /dev/ttyS0 9600
I have a cable between the serial port on this computer and my laptop ( via usb to serial adapter on laptop side )
On the Linux machine I can then echo "1" > /dev/ttyS0
except on the laptop I get nothing in the Terminal ;x
Plugging my prop in doesn't work as expected too.
Is there something else I am forgetting to do ??
Comments
If thats not the problem. Do you have a known working different device to test with?
I used an Rs-232 breakout box in between and I can see the server is sending the info, but at the laptop with PST I cant send or receive according to the breakout box ??
Expanded background:
I am going to have a linux server with about 30 serial ports ( via a USB to Serial header called 'rocket port')
each serial port will connect to a different propeller which will preform specific functions depending on what it receives from its respective serial port.
Currently I am just testing this is going to work so, I have a single serial port on my linux box connected to a breakout box ( just lights up leds showing that signals are happening ). Which then is connected to my USB to Serial converter ( this works no problems via windows to propeller via a serial port)....
which plugs into the laptop.
Now I can't seem to communicate from the laptop to the server ( send or receive ).
What I tried next was, I then connected via serial port on Linux box1 to my rs232-breakout box, to a serial port on another linux box...
Same situation, one can send the other cant send or receive ;x
Frustration ;x
If you're on Ubuntu, then you might need to run the following command after you plug in the USB to serial adapter:
I'd recommend starting with a USB to Serial device that has the RX line connected directly to the TX line via a resistor in order to form a loopback. Then open up cutecom and try sending a character. You should see it appear.
After you plug in your USB to serial device, what is the output of the following command:
The linux box I am just doing stty -F /dev/ttyS0 9600 ; echo "1" > /dev/ttyS0
On the laptop I get nothing ;x
Linux server ====> Rs-232 breakoutbox ( this is just for testing) =====> Laptop running windows and PST
Would it help if I uploaded some pictures ??
1) Are you using an FTDI chip (USB), or connecting directly to the RS232 port?
2) Why are you using the stty and echo commands instead of a com program?
3) What flavor of Linux are you using?
3.) SLES linux ( its the enterprise version of open suse)
2) because I want a shell script to do this ( shell script will be called from a Informix application, it will pass some values, the shell script will then preform the serial communications, in the Genero/Informix language ( i dont get a choice) there is no native rs232 support, or anything that would let me get there.
1.) Currently its Just from db9 connecter on linux server to a trend-net usb to serial converter.
Ill take pictures in about 30 minutes and upload them, I am not very good at explaining myself I guess ;x
This is the server rack /shrug
These are a bunch of serial ports coming of the back of the server, the one I am pointing at is the one I am currently using.
The serial cable I was pointing at in the last image, plugs into this... The other end ( thats currently unplugged), goes into this
This then is plugging into my laptop ( running PST )
The laptop, and the Rs-232 to USB converter will be replaced by this ( but on a pcb this is just for testing right now)
Ok now for the best explanation I can give:
We have a programming language that we lease its called Genero ( it use to be IBMS Informix ), This language is more like cobal then anything. It is very business application logic tailored, thus no hardware communications support. My Seniors want me to keep this project in that native language, and a shell script ( they dont want to have to maintain a C script or anything if I were to leave the company...)
So, What happens is I have created/written a time clock it runs on a thin client as can be seen here...
(time clock processes actualy takes place on server but thats getting kinda out of the scope)
When ever someone sounds a firealarm from this terminal, or the time gets to a select point and a break alarm is needed,
the server then will send a Numerical value out a serial port where my prop will be to capture said value and sound the correct alarm...
Picture 3 is just a test device to prove there was data actually being sent from the server.
From what you say, these RS-232 ports will be generic -- without USB conversion. But your laptop is currently using a RS232 to USB for benchwork. Can you loopback that portion to confirm correct opereation and loopback the other portion to confirm correct operation. Just one loop-back is verifying only that one side might be good.
Above is a SUSE forum for serial port problems. I use Ubuntu, so I am not 100% that an Ubuntu solution would help. The main thing is that the serial port in Linux must be mounted properly to work.
I suspect that the 'echo' is not a true loopback. It just echos your keyboard on your video screen. Use hardwire loopbacks for testing the ports.
It also could be that you want ttyS00, not ttyS0. Take a good look at how the serial ports are listed in the /dev directory. Mine in Ubuntu are listed as ttyS0, ttyS1, and so on. So this may be a 'non-issue'
The thing is, this all works fine if its done under windows... and just typing in the control number into PST, my prop lights up appropriately ;x
prop plugged into linux no lights ;x
Linux requires learning a different point of view.
EVERYTHING in Linux is mounted as a file. And there are basically only two modes of transport - block devices and character devices. A hard disk does block tranfers, a serial port does character transfers.
Stty certainly seems to be the right tool to establish a Linux serial port, but if you are using a ttyUSB## serial port, there is an added level of complexity due to the USB port.
http://unixhelp.ed.ac.uk/CGI/man-cgi?stty
If you can uses something higher level in the Linux environment to reach your laptop first, this might be simpler. Try using Minicom or PuTTY in Linux. Both will allow you to select a serial port such at ttyS0 or ttyUSB0. Once you are sure that works, it may be easier to resolve the stty problems.
http://www.novell.com/products/linuxpackages/opensuse/setserial.html
http://linux.about.com/library/cmd/blcmdl8_setserial.htm
http://www.tldp.org/HOWTO/Serial-HOWTO.html
Have you tried useing in the prop plug on the Linux box yet? I use opensuse at home and have had no problem. I used bst and putty with out a problem.
when I do my echo command those leds light up showing that Yes Serial comms is infact happening, although the prop doesnt do anything ....
Hooked up o scope All my signals are going logic lows instead of logic highs. Very strange, my windows computer worked fine, but I had to reverse the ground and Rx pin when I went to linux ;x
Can you expand on that a little more ? I am not quite sure how it would generate enough current or voltage to harm the prop io pin ? ( I do have a voltage divider in the circuit for the Rx line )
Very simply, the Propeller i/o is designed for a range from 0 volts to 3.3 volts. Your RS233 to USB device may have as much as a -12 volt output, but may be something like -3.3 volts. If you are lucky, it doesn't even go negative.
The Propeller i/o was never designed to go safely go below 0 volts. For RS-232, either some transistors or a level shifter chip is suppose to be between the Propeller and the real world.