User avatar
Posts: 14473
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Pull up - Pull down, have I got it right?

Tue Jul 29, 2014 9:16 am

il_diavolo wrote:Sorry, I'll try to be a bit precise. The spec from the device says-
Upon detecting a low-to-high signal edge on the DCD line, your driver should:
(I'm ok with that bit, the "DCD" line can simply be connected to another GPIO pin rather than one used by the UART)
Open the serial port, if not already open.
If the signal on the RTS line is LOW, RAISE it from low to HIGH.
If the signal on the RTS line is HIGH, TOGGLE it from high to LOW back to HIGH

Note that RTS is the device's RTS which will be connected to pin 8 (TXD) on the RPi header.

I'm in the deep end but my forum life vest is still keeping me afloat.
Why not just use another gpio for RTS? As you have done so for DCD. TXD isn't really the same thing as RTS.

User avatar
Posts: 3085
Joined: Tue Oct 11, 2011 8:38 pm

Re: Pull up - Pull down, have I got it right?

Tue Jul 29, 2014 12:39 pm

If you were only using PySerial, then there would be some logic in connecting TXD to "RTS". The idle state of a TTL UART when not transmitting data happens to be logic high. Toggling to low and back, relatively slowly, is called a serial break and can be done easily with PySerial's sendBreak() method. That would have the advantage that you only need permissions for the serial port, not for raw GPIO.

However, if you are using RPi.GPIO already, you may as well connect any other GPIO pin to "RTS". The pin does not understand true serial signalling. It is just a logic input that puts the device into low power mode when driven low.

(There is a third option, too. GPIO17 on the Pi can be configured as RTS. That normally tells the remote device whether there is room in the input buffer to receive characters, but it can also be driven as an arbitrary logic signal using PySerial's setRTS() method. This was obviously the intention and why they labelled the power/sleep input as "RTS" in the first place. But it is not a good choice on a Pi because RTS is disabled by default, and neither RPi.GPIO nor PySerial include a method to configure it on GPIO17.)

Posts: 139
Joined: Mon Dec 02, 2013 7:56 pm

Re: Pull up - Pull down, have I got it right?

Wed Jul 30, 2014 1:09 pm

I think I've got it straight in my mind now, you've been a great help people. I shall try programming it tonight (I'll leave "coding" to the young guns, along with "apps"). Should work first go, shouldn't it? :-)

Return to “Beginners”