First of all, sorry if this is answered somewhere else and I'm just repeating...I likely am, but I don't understand half of what I'm reading at this point, so I most likely missed it entirely. I'm not a coding/development guy, but I've been tasked with trying to make this work, since I'm the only one in my office that can actually spell the word computer, much less make one work. Once again, sorry in advance.
I have a device that I need to communicate via serial UART with in hex. I can only communicate at 3.3 VDC levels, so the Pi looks like a good option. Most things I'm seeing just specify a RX, TX, and GND connection on the GPIO header, but I also need a 3.3 VDC RTS, or "Handshake" line. The communication I'm trying to do basically goes:
1). Pi is monitoring the peripheral, any serial data that comes from the device is put up on screen.
2). I type a data string to transmit and press enter.
3). The Pi raises the "Handshake" line.
4). The Pi sends the serial data.
5). The Pi waits for an acknowledgement response to the command and displays it once received.
5). The Pi lowers the "Handshake" line.
6). The Pi goes back to monitoring.
Am I missing a program/configuration to do this with the Pi? Or do I need to look elsewhere?
Re: Serial Communication Question
You first need to enable Serial communication. Here is a guide that will get you started.
http://www.instructables.com/id/Read-an ... pberry-Pi/
http://www.instructables.com/id/Read-an ... pberry-Pi/
Re: Serial Communication Question
Generally, you can ignore the handshake line.
It's a holdover from the days when processors were really, really slow. Now, with interrupt-driven I/O, the Pi can keep up with the input data. So, just set the RTS line high, and capture the data as in comes in.
It's a holdover from the days when processors were really, really slow. Now, with interrupt-driven I/O, the Pi can keep up with the input data. So, just set the RTS line high, and capture the data as in comes in.
Re: Serial Communication Question
The handshake isn't for the Pi, it's for the peripheral. The Pi is the "Master" unit, but it has to set the "Handshake" line high or the "Slave" unit will ignore it. Not my design, I wish it wasn't set up that way, because I think that's going to make my life miserable...
Re: Serial Communication Question
Cacti:
OK, that covers enabling the software, and I understand the UART TX and RX on the GPIO are 3.3VDC, and the GND pin speaks for itself, but which pin can I use for the 3.3VDC handshake?
OK, that covers enabling the software, and I understand the UART TX and RX on the GPIO are 3.3VDC, and the GND pin speaks for itself, but which pin can I use for the 3.3VDC handshake?
Re: Serial Communication Question
You can use any general purpose GPIO pin. For example to use GPIO2 (pin 3).
To switch GPIO2 high (3.3v) do the following:
$ sudo python
>>> import RPi.GPIO as GPIO
>>> GPIO.setup(2, GPIO.OUT)
>>> GPIO.output(2, True)
To switch GPIO2 high (3.3v) do the following:
$ sudo python
>>> import RPi.GPIO as GPIO
>>> GPIO.setup(2, GPIO.OUT)
>>> GPIO.output(2, True)
Re: Serial Communication Question
I'm not sure which RPi board you are using. Check this out for differences and a short tutorial on GPIO in Python.
http://www.raspberrypi-spy.co.uk/2012/0 ... -and-pins/
http://www.raspberrypi-spy.co.uk/2012/0 ... -and-pins/
Re: Serial Communication Question
Sounds like you can just connect it to the 3.3v pin and forget about it but if it really needs to be raised and lowered then a GPIO pin will do the trick.TrickyT wrote:The handshake isn't for the Pi, it's for the peripheral. The Pi is the "Master" unit, but it has to set the "Handshake" line high or the "Slave" unit will ignore it. Not my design, I wish it wasn't set up that way, because I think that's going to make my life miserable...
Last edited by Cancelor on Mon Jun 13, 2016 6:25 pm, edited 1 time in total.
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org
Re: Serial Communication Question
No, the device doesn't actually carry out the command until the handshake line is set low.Cancelor wrote:Sounds like you can just connect it to the 3.3v pin and forget about it.TrickyT wrote:The handshake isn't for the Pi, it's for the peripheral. The Pi is the "Master" unit, but it has to set the "Handshake" line high or the "Slave" unit will ignore it. Not my design, I wish it wasn't set up that way, because I think that's going to make my life miserable...
Re: Serial Communication Question
This is going to be very helpful, as I'm probably going to have to write some python for several parts of this solution.cacti wrote:I'm not sure which RPi board you are using. Check this out for differences and a short tutorial on GPIO in Python.
http://www.raspberrypi-spy.co.uk/2012/0 ... -and-pins/
Re: Serial Communication Question
GPIO2 is Pin 3 on my board....Would that output a 3.3V signal or a 5V signal?cacti wrote:You can use any general purpose GPIO pin. For example to use GPIO2 (pin 3).
To switch GPIO2 high (3.3v) do the following:
$ sudo python
>>> import RPi.GPIO as GPIO
>>> GPIO.setup(2, GPIO.OUT)
>>> GPIO.output(2, True)
Re: Serial Communication Question
I don't think the external device will send any data while the handshake line is high (in step 1).Cancelor wrote:Sounds like you can just connect it to the 3.3v pin and forget about it but if it really needs to be raised and lowered then a GPIO pin will do the trick.TrickyT wrote:The handshake isn't for the Pi, it's for the peripheral. The Pi is the "Master" unit, but it has to set the "Handshake" line high or the "Slave" unit will ignore it. Not my design, I wish it wasn't set up that way, because I think that's going to make my life miserable...
Re: Serial Communication Question
All the GPIO pins will output 3.3v for a logical high.TrickyT wrote:GPIO2 is Pin 3 on my board....Would that output a 3.3V signal or a 5V signal?cacti wrote:You can use any general purpose GPIO pin. For example to use GPIO2 (pin 3).
To switch GPIO2 high (3.3v) do the following:
$ sudo python
>>> import RPi.GPIO as GPIO
>>> GPIO.setup(2, GPIO.OUT)
>>> GPIO.output(2, True)
Re: Serial Communication Question
While the handshake line is high, the device pauses its actual work and listens for a command. Once it receives that command, it replies with an acknowledgment and checksum, and then waits for further commands if the checksum was incorrect. If the "Master" device agrees that the acknowledgement is correct, it sets the handshake low, at which point the device executes the command it was given.cacti wrote:I don't think the external device will send any data while the handshake line is high.Cancelor wrote:Sounds like you can just connect it to the 3.3v pin and forget about it but if it really needs to be raised and lowered then a GPIO pin will do the trick.TrickyT wrote:The handshake isn't for the Pi, it's for the peripheral. The Pi is the "Master" unit, but it has to set the "Handshake" line high or the "Slave" unit will ignore it. Not my design, I wish it wasn't set up that way, because I think that's going to make my life miserable...
Re: Serial Communication Question
Using the above info you will be able to get it working. Good luck and enjoyTrickyT wrote:While the handshake line is high, the device pauses its actual work and listens for a command. Once it receives that command, it replies with an acknowledgment and checksum, and then waits for further commands if the checksum was incorrect. If the "Master" device agrees that the acknowledgement is correct, it sets the handshake low, at which point the device executes the command it was given.
