View Full Version : CTS/RTS handshake using pyserial

03-03-2005, 09:37 PM
I'm trying soooo hard to get RTS/CTS flow control working with pyserial (http://pyserial.sourceforge.net (http://pyserial.sourceforge.net/)).· Basically on my basic stamp 2 I've got:

And on my PC I've got:

import serial
s = serial.Serial(0, 9600, rtscts=1)

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.

Peter Verkaik
03-03-2005, 10:17 PM
on pc side:

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

03-04-2005, 10:22 AM
So you would recommend using a max232 chip? Cause I've done pretty much everything you just said except I am not using max232... also I connected p5 to ground via a 10Kohm resistor... maybe I just short it directly? I will try these things and look into getting a max232 chip (I heard of them before, but don't really know what it is).

Thanks for your time!

Peter Verkaik
03-04-2005, 03:47 PM
Do not short P5 to ground

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


regards peter