9pin serial for RPI 1
Jamie Bradbury (10282) 2 posts |
Hi guys, My first post. Just getting into this interesting is for the first time. So far it seems the very best possible use for my issue one pi. I would like to wire up a standard 9pin serial port to the gpio pins, and then use it with putty and other software to speak a) to my Cambridge Computers Z88, and b) maybe to my canon bjc80 printer, for which I have a serial to centronics adapter. Do you think either of these will work, and are possible please? |
Rick Murray (539) 13840 posts |
Absolutely never do this. A traditional serial port can work on anything from +/- 3V to around +/- 24V (typically +/- 5V to 12V, depends on the hardware). Note, that’s plus minus, or a voltage swing in the order of 6V minimum to around 48V maximum. Your GPIO works at +3.3V. Only at 3.3V. Anything less than zero or more than 3.3 will kill it. The sorts of signals present on a serial port may well destroy the entire chip. You’ll need a serial port interface, something like this: https://www.kiwi-electronics.com/en/serial-pi-plus-rs232-interface-for-raspberry-pi-1192 Google or whatever will find you other options. |
Colin (478) 2433 posts |
I haven’t seen a rs232 to ttl converter which connects all pins the ones I use something like these are only rx and tx. The one Rick linked to also looks just rx and tx judging by the chip similarities to the devices I linked to and the fact that it only has tx,rx and ground pins marked on the circuit board. It may be easier to use a usb converter but that is frought with danger. some devices are only ttl and not true rs232. |
Colin (478) 2433 posts |
Judging from this it could be doable just having rs232 for rx and tx other pins can be joined together – if you can get at them – maybe a cheap module and a hacksaw :-). |
Elesar (2416) 73 posts |
The RPI 1 is going to restrict choices now, as it only has a 26 pin GPIO header and the vast majority of expansions available will be expecting a 40 pin GPIO header, not least because the ID pins used to detect the HAT are…pins 27 and 28. Blatent plug: our Serial/Parallel HAT is one such expansion, and does pin out the CTS/RTS handshake lines to the 9 D-Sub should you need them. Note that the DCD/DSR/DTR/RI aren’t wired in. |
Colin (478) 2433 posts |
You must have scoured the internet and found something that no-one else thought of making then thought one day this subject will come up on the ROOL forums and today is that day :-) |
Colin (478) 2433 posts |
No need for a hacksaw the pins are soldered through the board. |
Rick Murray (539) 13840 posts |
Oh my god, it’s not even joining the ground on each side. Note the big disclaimer: DO NOT USE THIS CABLE TO CONNECT TO A COMPUTER. IT WILL NOT WORK.
Generally: If it has four wires dangling out, it’s a TTL level interface (with it left rather random what exactly they mean by “TTL”; I’m ancient enough that it means 5V to me).
The thing I linked to was a five second Google search. Support your friendly RISC OS dealer. It’s only about twice as expensive and it gives a better wired serial port and a parallel port, that appears to come with a module to work as a parallel port with RISC OS. Hmm – does it work with Zip drives and such? I’ve found USB to parallel interfaces to be rather lacking. I don’t even know if they work at all on RISC OS, I misplaced mine ages ago because it was so bloody useless under Windows! |
Colin (478) 2433 posts |
Above that disclaimer
I’m talking about devices with a 9 way D socket only being +5v/0v |
Steve Fryatt (216) 2105 posts |
Four wires? 0V, TX, RX and …? Generally, the term “UART Interface” is likely to be understood by most people who use the things these days. They’re either 5V or 3V3, with the latter being a lot more common now – the documentation will tell you which (it usually depends on what voltage the host system is using). It’s also not uncommon for the 3V3 ones to be “5V tolerant” (so that you can join a 3V3 and a 5V device together, so long as you just connect the grounds and data lines), but I’d strongly suggest reading the documentation before trying that in practice.
While not uncommon, it is often just the TX which is +5V/0V. RX will usually be RS232 tolerant (even if it uses a +5V/0V-style threshold internally), and it relies on the fact that most RS232 receivers are quite forgiving of the voltages that they can make sense of. Maybe it’s because I’ve always used this stuff in a work context (and have not been buying cheap stuff off eBay or Amazon), but I’ve yet to encounter anything with a D9 which can’t handle being fed +/-24V by the other end. I have seen a lot of stuff which is pulling the 0V/5V transmit trick, though – it saves the manufacturer the cost of a MAX232 IC and associated stuff, which lets them flog their multimeters a bit cheaper (or make more profit on each one). I’m guessing that the Z88 might be doing something along these lines? Edit Who knew that Textile treated |
Rick Murray (539) 13840 posts |
Well spotted. I was looking at the diagram which… let’s just say NetSurf renders it as TxD to RxD, RxD to TxD, RTS to CTS.
That’s really bad practice to the point of being fundamentally flawed. If it’s not real serial, don’t use a bloody serial plug!
If it’s a USB dongle, the red is usually sort of 5V, the black is 0v, and the other two (white/green, yellow/green, or some other combination) are the TxD/RxD. If you’re lucky it might be labelled or indicated or you have a header to plug the wires into that are marked. If you aren’t lucky, there’s a 50% chance you’ll get it right the first time. ;)
A lot of the “maker style” UART USB ones have a little jumper to select if the serial chip is powered from 5V or 3.3V (which determines the voltages present on the circuit). Those that don’t have jumpers often output 3.3V (still a logic ‘1’) and are 5V tolerant on the inputs so can work with either. But as Steve says, best to verify before hooking up to anything.
That’s technically non-conformant. The 5V is fine, as it’s more than 3V, but the span between +3V and -3V is supposed to be a dead area for absorbing noise on the line, with -3V being the opposite signal to +3V. I guess it stands testament to how often a simple protocol gets implemented badly that stuff like 5V/0V work.
I have a WS-2300 weather station (hooked to the Pi) with a standard USB to serial dongle. But how it actually works is anything but standard. The weather station has no serial port. It has a four wire serial connection. RxD, TxD, DTR, and RTS. No GND. In order to talk to the device, you set DTR low and RTS high. This provides the voltage levels for serial data. The weather station then simply switches to make a serial bitstream at 2,400 baud. |
Jamie Bradbury (10282) 2 posts |
Hello, thank you for all the replies. Very intriguing stuff. It’s worth noting that I am painful aware the the z88 serial is not standard, and I have already made an adapter that I use with a usb serial adapter to connect my z88 to windows 10. I realise that I’d need a max232 type adapter. But maybe the first thing is to get it working over usb. The next thing will be which terminal software to use, please let me know if you have any recommendations? Re software, there is some very old z88 software for an older version of RISC OS, I guess… Probably no use now? |
Steffen Huber (91) 1953 posts |
I think we are down to basically two options: Connector (downloadable from here, hidden in the “Bonus Binaries”) and Hearsay (see here for the David Pilling original version and here the Colin-Granville-better-with-USBSerial-version). |