I developed a python class which communicates with a device via serial port.
The device needs the host to set RTS low in order to wake up. At that point
the device sets CTS low allowing the host to send its data.Going from my
linux desktop to the device, my python class works flawlessly.
Unfortunately, it doesn't work so well when run on the Gumstix through the
BTUART. Looking at a scope, I can see that the RTS line is set low right as
soon as the port is opened. This isn't the case when I run the software on
The first image attached shows the oscilloscope output when I use my desktop
instead of the gumstix. The RTS (red) and CTS (green) lines are clear and as
expected. As soon as CTS is brought low data is transmitted (blue). Once
the RTS is brought high the device replies (yellow).
Unfortunately, it looks like the gumstix starts out low when the port is
opened. I think this is what causes the bulk of my problems because the
device ends up thinking that I'm sending data when I'm not. It also looks
like the RTS line gets toggle a number of times which just confuses me. The
only time I toggle the RTS line is before writing and after writing.
I would very thankful if anyone can help me diagnose the problem.
Here's the snippet of code that sets up the serial port. serialPort =
self._serialPort = serialPort
self._serFD = serial.Serial(port=serialPort,
#Open the serial port
#Store whether the serial port is opened
self._serIsOpen = self._serFD.isOpen()
#Start the serial reading thread
This is the snippet of code that writes to the serial port.
Write - to the Serial Port, this controls the RTS
def Write(self,command, payload):
print "Serial Port is opened"
print "Serial Port is not opened"
#Create the packet
#Request to send
#Wait till it is clear to send
NotExit = True
NotExit = False
#Write packet to the serial port
for k in range(0,self.packetLength):
#print "0x%04X" % self.packet[k]
#Drain the output buffer
#Turn off the request to send
#Set the number of bytes to expect
self._serBytesExpected = [self.bytesExpected[command]+5]
The additional five bytes are from 0xAA, byte count, command
number, and 2 CRC bytes
time.sleep(.05) #Make sure there's enough time for device to
Communications between the desktop and the device under test:
Communications between the Gumstix and the device under test:
Note: The write function is called twice in the preceding images.
View this message in context: http://www.nabble.com/Problems-with-RTS-via-Python-tp22255535p22255535.html
Sent from the Gumstix mailing list archive at Nabble.com.