manishgdev
Posts: 6
Joined: Tue Apr 14, 2015 8:04 am

Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 8:19 am

I have just aligned myself in a queue of those who admire to buy a Raspberry Pi, the only thing which is stopping me to do so is the absence of dedicated serial port in Raspberry Pi.

I wanted to know if we can have dedicated serial Port in Raspberry PI, where in we can have all the handshake pins (DTR, CTS, DSR, RTS & RI) connected on the board other than the RX,TX & GND pins.

We can have the RX, TX and GND from the GPIO pins and use them with voltage level conversion.

But the serial Device is communication with computer only through Dedicated serial ports (where it finds all the handshake signals) not through the USB-Serial converter (where the handshake pins are left open).

My question is how can we have the complete DB9 pins from the Raspberry Pi board

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

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 8:33 am

The Pi has TXD, RXD, CTS, RTS signals. If you need any other signals you'll need to create them yourself.

Heater
Posts: 13704
Joined: Tue Jul 17, 2012 3:02 pm

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 8:42 am

We have hardware directly connected to the serial port on the GPIO that needs control signal to get communications working.

It's simply done by using another GPIO pin for that control signal and manipulating it in software when sending and receiving serial data. We use C to do this but I guess it can be done in any language.

Just extend that idea to as many control lines as you need.
Memory in C++ is a leaky abstraction .

Heater
Posts: 13704
Joined: Tue Jul 17, 2012 3:02 pm

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 8:44 am

joan,
The Pi has TXD, RXD, CTS, RTS
You mean I have been wasting my time doing what I described above? How do you get to use those signals normally?
Memory in C++ is a leaky abstraction .

manishgdev
Posts: 6
Joined: Tue Apr 14, 2015 8:04 am

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 9:47 am

@heather,
I agree with you , The Pi is not having the TXD, RXD, CTS, RTS .
So with manipulation on the hardware side, like sorting the control signals on the output end of the DB9 connector can we have a DB9 output with control signals to communicate with the hardware.

can you please post an image of the hardware which you are having with you.

manishgdev
Posts: 6
Joined: Tue Apr 14, 2015 8:04 am

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 9:55 am

@Joan,
i would love to see if you can post some images showing TXD, RXD, CTS, RTS pins on Raspberry Pi board

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

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 10:05 am

On a B+ or 2B, you can enable CTS/RTS on GPIO16/17. On an A/B Rev2 you can use GPIO30/31 on the unpopulated I²S connector. For a B Rev1 you would need to modify the board.

If you want a DE-9, use a USB-RS232 adapter. (If you want a DB-9, start with a DB-25 and remove sixteen pins.)

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5132
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 10:19 am

manishgdev wrote:I have just aligned myself in a queue of those who admire to buy a Raspberry Pi, the only thing which is stopping me to do so is the absence of dedicated serial port in Raspberry Pi.
I wanted to know if we can have dedicated serial Port in Raspberry PI, where in we can have all the handshake pins (DTR, CTS, DSR, RTS & RI) connected on the board other than the RX,TX & GND pins.
We can have the RX, TX and GND from the GPIO pins and use them with voltage level conversion.
But the serial Device is communication with computer only through Dedicated serial ports (where it finds all the handshake signals) not through the USB-Serial converter (where the handshake pins are left open).
My question is how can we have the complete DB9 pins from the Raspberry Pi board
I'm intrigued as to why you need all the handshake pins - in my experience it's been many years since the full (original) DTE <--> DCE interface has been implemented on equipment (mainly used with the old "telephone line modems" at low baud rates). Even way back in 2000 (and earlier) the full interface was not in use - as shown in one of my oldest webpages:
http://www.cpmspectrepi.webspace.virgin ... /rs232.htm
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, A+ and a B2) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

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

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 10:31 am

For a guide to the functions available on the gpios see BCM2835 ARM Peripherals page 102.

There are at least three types of board.

Type 1

26 pin header (P1).

Hardware revision numbers of 2 and 3.

User gpios 0-1, 4, 7-11, 14-15, 17-18, 21-25.

Type 2

26 pin header (P1) and an additional 8 pin header (P5).

Hardware revision numbers of 4, 5, 6, and 15.

User gpios 2-4, 7-11, 14-15, 17-18, 22-25, 27-31.

Type 3

40 pin expansion header (J8).

Hardware revision numbers of 16 or greater.

User gpios 2-27 (0 and 1 are reserved).

The compute module has gpios 0-53.

Heater
Posts: 13704
Joined: Tue Jul 17, 2012 3:02 pm

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 10:53 am

That's all as clear as mud :)

The up shot of it all is that the original Pi did not have those control signals. 50% of my Pi are originals so I'm sticking with the way I do it now.

Further it's probably better to keep the code working with the lowest common denominator and I'm not going to faff around adding options for newer configurations.

@manishgdev,

I cannot provide images I'm afraid. I do not have that hardware set up to hand. But really there is nothing to see only wires connected to the GPIO header pins Tx, Rx, GPIO 17 and ground. Those wires go over to another board and are directly connected to the chip there. Which also runs on 3.3 volts.

The code on the Pi that uses this serial link is here: https://github.com/ZiCog/pi-propeller-load Specifically the module osint_linux.c is diving the serial port and control lines.
Memory in C++ is a leaky abstraction .

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

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 11:24 am

Heater wrote:That's all as clear as mud :)
...
What are you finding confusing?

Most software intended for general Pi use would have to be at least aware of the different Pi variants.

Heater
Posts: 13704
Joined: Tue Jul 17, 2012 3:02 pm

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 11:54 am

Confusing.

1) The different Pi models may or may not have the serial control lines we want to use.

2) The different Pi models have these pins on different GPIO pins (Correct me if I am wrong)

3) I'm sure none of them work out of the box. That is we cannot just use the regular Linux open, close, read, write, ioctal calls immediately. One has to do some "alternate function" setting first (Correct me if I am wrong).

4) A quick google search for Pi GPIO pin outs does not reveal any of the above information in the fist dozen diagrams one finds.

5) I have just bee directed to a 300 page manual describing BCM2835 ARM Peripherals. Great.

Now, I have been tweaking with registers and ports and hardware details for decades. Frankly I'm bored with it. Especially when I all want to do is use a serial port.
Memory in C++ is a leaky abstraction .

Heater
Posts: 13704
Joined: Tue Jul 17, 2012 3:02 pm

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 11:58 am

joan,
Most software intended for general Pi use would have to be at least aware of the different Pi variants.
Is it really so that I have to change my code that uses early model GPIO in order for it to work on new models? Surely the original pins are still in their places and the /sys/gpio stuff works the same.
Memory in C++ is a leaky abstraction .

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

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 12:03 pm

Two pages (102/103) of a 300 page document.

My guess is the hits aren't there because so few people need the extra signals.

The few people that do only need to ask to be pointed to the information they need.

manishgdev
Posts: 6
Joined: Tue Apr 14, 2015 8:04 am

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 1:48 pm

@joan @heather,
Thanks guys for your interest

@joan,
I'll try to go through the document that you have provided in the link

@heather,
the only reason why I am looking for full control signals from the PI is that I am working on a Cash Drawer which recieves escape sequence to open the Cash Drawer from the serial port. The problem is, when I am sending signals from the PC's dedicated serial port the cash drawer opens up, but when I send the command to the Cash Drawer using USB to Serial Converter it is not opening.
Which leads me to a make a guess that the Cash Drawer might be looking for Handshake signals on the Serial port which is not connected in USB to serial converter (because the USB to serial converter will only be doing voltage level conversions for RX, TX pins) and second conclusion is USB to Serial converter might not be generating the signals of proper Voltage and current as that of dedicated serial port.

W. H. Heydt
Posts: 11019
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 4:01 pm

manishgdev wrote:@joan @heather,
Thanks guys for your interest

@joan,
I'll try to go through the document that you have provided in the link

@heather,
the only reason why I am looking for full control signals from the PI is that I am working on a Cash Drawer which recieves escape sequence to open the Cash Drawer from the serial port. The problem is, when I am sending signals from the PC's dedicated serial port the cash drawer opens up, but when I send the command to the Cash Drawer using USB to Serial Converter it is not opening.
Which leads me to a make a guess that the Cash Drawer might be looking for Handshake signals on the Serial port which is not connected in USB to serial converter (because the USB to serial converter will only be doing voltage level conversions for RX, TX pins) and second conclusion is USB to Serial converter might not be generating the signals of proper Voltage and current as that of dedicated serial port.
Ummm...doesn't the documentation on the cash drawer specify what it's looking for?

klricks
Posts: 6609
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 6:24 pm

manishgdev wrote:... Which leads me to a make a guess that the Cash Drawer might be looking for Handshake signals on the Serial port which is not connected in USB to serial converter .......
IMO guessing could lead you to spend countless hours in the wrong direction..... Find the specifications of the equipment and/or use volt meter, scope etc to trace exactly what is going on.
Can commands be sent via a generic terminal program? If so you might want to use a program like Realterm on your Windows computer which shows real time status of all the handshaking signals. http://realterm.sourceforge.net/
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

User avatar
davidcoton
Posts: 4212
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 7:25 pm

Can you see which pins are actually connected to the Cash Drawer?

Do you have specifications (signals implemented, voltages used) for the USB to serial converter?

Are there any other clues in the labelling of the Cash drawer port? Is it definitely RS232, or possibly V24? Hope I've remembered the standards correctly :?.

The problems could be with handshake, with voltage (RS232 is a notorious non-standard, voltage can be from +/-3V to +/-24V, not all implementations are fully compatible with others), or with the software protocol at the Pi end. Guessing is probably futile. You need to work out logically what is different, and then adapt the Pi setup to match. Even then it might not be the first or most obvious difference that is significant -- for example, even if you find that the Windows PC does implement some hardware handshake, that doesn't prove that the Cash Drawer is using it, the problem could be elsewhere.
Signature retired

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5132
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Dedicated Serial Port in Raspberry PI

Tue Apr 14, 2015 8:18 pm

davidcoton wrote: ...
The problems could be with handshake, with voltage (RS232 is a notorious non-standard, voltage can be from +/-3V to +/-24V, not all implementations are fully compatible with others), or with the software protocol at the Pi end. Guessing is probably futile. You need to work out logically what is different, and then adapt the Pi setup to match. Even then it might not be the first or most obvious difference that is significant -- for example, even if you find that the Windows PC does implement some hardware handshake, that doesn't prove that the Cash Drawer is using it, the problem could be elsewhere.
+1
(It was those sorts of problems that led to what became the webpage(s) linked to in my previous post, but, at the time, only visible on the workplace Unix network, way back in the late 1990's, when internet access was only available to "the few")
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, A+ and a B2) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

manishgdev
Posts: 6
Joined: Tue Apr 14, 2015 8:04 am

Re: Dedicated Serial Port in Raspberry PI

Wed Apr 15, 2015 4:49 am

@klricks
Thanks,
Now I'll be sitting with the voltmeter to measure the Electrical specifications (in terms of voltage and current) obtained from both the dedicated serial port and USB to Serial Converter.

I am using Posiflex CR-3104 cash drawer and Prolific PL2303 HX USB to Serial Converter.

I'll have to go for usage of Voltmeter again after 3 years since completion of my Engineering degree which I was thinking to prevent :lol:

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: Korea

Re: Dedicated Serial Port in Raspberry PI

Wed Apr 15, 2015 5:03 am

manishgdev wrote:the only reason why I am looking for full control signals from the PI is that I am working on a Cash Drawer which recieves escape sequence to open the Cash Drawer from the serial port. The problem is, when I am sending signals from the PC's dedicated serial port the cash drawer opens up, but when I send the command to the Cash Drawer using USB to Serial Converter it is not opening.
Which leads me to a make a guess that the Cash Drawer might be looking for Handshake signals on the Serial port which is not connected in USB to serial converter (because the USB to serial converter will only be doing voltage level conversions for RX, TX pins) and second conclusion is USB to Serial converter might not be generating the signals of proper Voltage and current as that of dedicated serial port.
Most USB->serial converters do full handshaking. Maybe you are using different software on the PC and the Pi?

It would be trivial for you to make a simple wiring adapter that has only 3 wires, Tx, Rx and GND. Insert this into the cable from the PC to the cash-drawer and test again. If it works, then you know that handshaking is not needed. If it doesn't work, you could try shorting out the handshaking lines on the cash-drawer end, like a null-modem would.

manishgdev
Posts: 6
Joined: Tue Apr 14, 2015 8:04 am

Re: Dedicated Serial Port in Raspberry PI

Wed Apr 15, 2015 6:48 am

@ame
I am using same software to send the Escape Sequence to the Cash Drawer..ie JAVA & ECLIPSE .
I have tried to open the Cash Drawer from computer's Dedicated Serial port and USB to Serial Converter, of which Computer's dedicated Serial port is able to open the Cash Drawer but same sequence sent from the USB to Serial Converter is not able to open the Cash Drawer
I have not done this through PI and I am planing to buy a PI but before that I am thinking to achieve some solution where if Raspberry PI is not having dedicated Serial (DB9) port then also I should be able to open the Cash Drawer

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: Korea

Re: Dedicated Serial Port in Raspberry PI

Wed Apr 15, 2015 6:51 am

manishgdev wrote:@ame
I am using same software to send the Escape Sequence to the Cash Drawer..ie JAVA & ECLIPSE .
I have tried to open the Cash Drawer from computer's Dedicated Serial port and USB to Serial Converter, of which Computer's dedicated Serial port is able to open the Cash Drawer but same sequence sent from the USB to Serial Converter is not able to open the Cash Drawer
I have not done this through PI and I am planing to buy a PI but before that I am thinking to achieve some solution where if Raspberry PI is not having dedicated Serial (DB9) port then also I should be able to open the Cash Drawer
Ok. So make a wiring adapter as I suggested, with only Tx, Rx and GND connected through, and see if the PC port still works.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5132
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Dedicated Serial Port in Raspberry PI

Wed Apr 15, 2015 8:34 am

ame wrote:
manishgdev wrote:@ame
I am using same software to send the Escape Sequence to the Cash Drawer..ie JAVA & ECLIPSE .
I have tried to open the Cash Drawer from computer's Dedicated Serial port and USB to Serial Converter, of which Computer's dedicated Serial port is able to open the Cash Drawer but same sequence sent from the USB to Serial Converter is not able to open the Cash Drawer
I have not done this through PI and I am planing to buy a PI but before that I am thinking to achieve some solution where if Raspberry PI is not having dedicated Serial (DB9) port then also I should be able to open the Cash Drawer
Ok. So make a wiring adapter as I suggested, with only Tx, Rx and GND connected through, and see if the PC port still works.
+1
For the majority of serial com'n systems handshake signals are usually used to either establish that the physical connection exists or to "slow down" communication. Use as another type of control signal is "non-standard"!
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, A+ and a B2) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

davidmam
Posts: 101
Joined: Tue Dec 06, 2011 4:13 pm

Re: Dedicated Serial Port in Raspberry PI

Mon May 16, 2016 4:43 pm

I've run into a similar issue trying to talk to some lab equipment. It requires DTR to be held high, and I'm not sure about CTS/RTS. Unfortunately the interface I have (The AB electronics one) is a rather minimal effort with just +ve/GND/TX/RX, though it has plenty of free connections to allow a custom modification to the other pins.

How do I enable the CTS/RTS on GPIO 16/17 in Python? I am planning to manually set a line from a different GPIO pin to set DTR high (or possibly just hard wire it high with a resistor.) This is required by the hardware.

..d

Return to “General discussion”