CTS/RTS handshake using pyserial
julia_nosewater
Posts: 4
Hi!
I'm trying soooo hard to get RTS/CTS flow control working with pyserial (http://pyserial.sourceforge.net).· Basically on my basic stamp 2 I've got:
...
SERIN 6\5, BAUDMODE, [noparse][[/noparse]DEC1 CODE]
...
And on my PC I've got:
import serial
s = serial.Serial(0, 9600, rtscts=1)
s.write("3")
The program just hangs once I call write.· The serial·driver is waiting for something to happen on the CTS or RTS or something.· I tried·zillions of different combinations of pins.· Also, if I set rtscts=0 then data is sent and received OK... so this means I·think I have the baudmode set properly.· But I really need the RTS/CTS handshake because I'm sending data one byte at a time from PC to BS2.
I tried putting a 10KOhm resistor in series (and I also tried in parallel) with the FPIN (pin 5 in my case), but that didn't work either.
This is the pin config I was using on the rs232 (Im only using 3 pins and no pins are looped):
PIN 5: Ground
PIN 3: Connects to P6 on the Basic Stamp 2
PIN 7 (also tried·8): Connects to P5 on the Basic Stamp 2
Does anybody have any suggestions?· Jeez I've been trying to get this to work for soooo long.
julia
I'm trying soooo hard to get RTS/CTS flow control working with pyserial (http://pyserial.sourceforge.net).· Basically on my basic stamp 2 I've got:
...
SERIN 6\5, BAUDMODE, [noparse][[/noparse]DEC1 CODE]
...
And on my PC I've got:
import serial
s = serial.Serial(0, 9600, rtscts=1)
s.write("3")
The program just hangs once I call write.· The serial·driver is waiting for something to happen on the CTS or RTS or something.· I tried·zillions of different combinations of pins.· Also, if I set rtscts=0 then data is sent and received OK... so this means I·think I have the baudmode set properly.· But I really need the RTS/CTS handshake because I'm sending data one byte at a time from PC to BS2.
I tried putting a 10KOhm resistor in series (and I also tried in parallel) with the FPIN (pin 5 in my case), but that didn't work either.
This is the pin config I was using on the rs232 (Im only using 3 pins and no pins are looped):
PIN 5: Ground
PIN 3: Connects to P6 on the Basic Stamp 2
PIN 7 (also tried·8): Connects to P5 on the Basic Stamp 2
Does anybody have any suggestions?· Jeez I've been trying to get this to work for soooo long.
julia
Comments
pin 5 = gnd
pin 3 = tx
pin 8 = cts (handshake input paired with tx)
on stamp side:
P6 = rx
P5 = rts (handshake output paired with rx)
P6 connects through level converter (max232) to pc pin 3
P5 connects through level converter (max232) to pc pin 8
stamp GND connects to pc pin 5
That are the required connnections.
The stamp baudrate must be non-inverted (aka true).
regards peter
Thanks for your time!
julia
and also do not connect P6 and P5 directly to
the pc comport pins. This will destroy the stamp pins.
The stamp uses TTL level (0 to 5 volt), whereas the
pc comport uses RS232 levels (-10 to +10 volt).
So you need a level converter. The max232 and max233
are widely available. The 233 requires no external
capacitors, the 232 requires 4 external capacitors.
Or get the RS232 DCE appmod
http://www.parallax.com/detail.asp?product_id=29120
regards peter
·