Raspberry Pi Serial
Pages: 1 2
Jonathan Bond (2397) 41 posts |
Hi. First post, go gentle ;) – I wasn’t sure whether to post this in here, General or Community Support, please move if you feel it is in the wrong place. I have done a search, but couldn’t turn up anything relevant. Has anyone managed to get serial working over GPIO? I am interested in ANY implementation that is working with RiscOS on the Pi, but ultimately I am looking to connect a keyboard or mouse via it. (And yes – I am fully aware that USB Keyboards and Mice are working – this is for a very specific project) Thanks in advance. |
Ronald May (387) 407 posts |
PiSerial blockdrivers can be found here |
Jonathan Bond (2397) 41 posts |
Thanks. I’ll take a look. Questions. What software under RISCos should I use to monitor the raw data (new to all this). And - I am attempting to connect an Archimedes keyboard as opposed to a PS/2 keyboard. Will I need to pass it through a Max232 or max3232, or will a simple voltage divider over the input to the pi suffice? The pinouts are 1. Reset Of which I only plan to use pins 3,4,5 and 6 (I may connect 1 to a reset board in the future). |
Tank (53) 375 posts |
A divider may have been ok for the Serial In, but the Serial Out will need to be buffered, so its probably easier to use MAX233A (you don’t need any external components with that chip…see ). Power the chip with 3V3 and the voltage in can be +/-5V. |
Jonathan Bond (2397) 41 posts |
When you say buffered, do you mean so that the keyboard receives a 5v signal? I have been looking at the circuit diagrams and note that it makes use of the HC14 which accepts a wide range of input voltages up to 5v but it also uses HCT14’s which have a much narrower input range (4.5-5v according to the data sheets i have been looking at). |
Steve Pampling (1551) 8170 posts |
The MAX233 deals with voltage shift and sourcing/sinking more current than the low power GPIO circuitry can handle. Edit: Only took three attempts to post that, and of course the forum software helps throw failed attempts away… |
Jonathan Bond (2397) 41 posts |
Thanks. Can I use the MAX3232, so I can utilise other lower voltage circuits or does it HAVE to be the MAX232? Thanks. |
Steve Pampling (1551) 8170 posts |
Take your pick from the current product list, your limitation is basically the power voltage feed available on the board you are sourcing power from. |
Jonathan Bond (2397) 41 posts |
Ok. I understand that the 3232 is better for the pi as it accepts 3v3 input where the 232 only accepts 5v. This is plenty for me to be getting on with. |
Ronald May (387) 407 posts |
By using a cheap level shifter / 9 pin adapter, the RasPi can then connect with all serial equipment using a standard cable. I found this necessary for connecting to other computers via serial consoles, for example. |
Rick Murray (539) 13840 posts |
For those looking to connect a Pi to a modern PC, it is worth mentioning that you can get 3.3V serial to USB cables as well; inexpensively on eBay… |
Dave Higton (1515) 3526 posts |
What is the interface to an Archimedes keyboard? What protocol and what voltage levels? |
Rick Murray (539) 13840 posts |
Off the top of my head, a custom serial bitshift protocol (should be described in an old TRM) at 5V. Update: http://chrisacorns.computinghistory.org.uk/docs/Acorn/Manuals/Acorn_A300_SMCLSup.pdf page 17. |
Wouter Rademaker (458) 197 posts |
maybe http://chrisacorns.computinghistory.org.uk/docs/Acorn/Manuals/Acorn_A500R200SM.pdf page 1-10 to 1-14 ? |
Dave Higton (1515) 3526 posts |
Right, thanks. The Archimedes keyboard interface appears to be 31.25 kBaud serial, but with levels straight into and out of a 5 V UART. MAX3232 etc won’t help in this case. To go to and from the RPi serial pins requires non-inverting level shifters. |
Jonathan Bond (2397) 41 posts |
That’s why I was looking at a voltage divider for input to the pi. The query is whether or not the keyboard will accept a 3v3 signal or whether it has to be 5v. Right now I don’t even have the keyboard (waiting on eBay). Once I get one I will be concentrating on just getting a signal first and worry about decoding or bit-banging it later. Is there a non inverting level shifter? |
Rick Murray (539) 13840 posts |
I think it will accept logic signals down to 3.3V, but be aware that if powered at 5V, it will blast back 5V signals. As for whether or not you can run the entire keyboard at 3.3V…. the PDF I linked to says this: “Operating voltage range (measured at the cable plug) is 5 V ±0.5 V. Maximum current consumption of the of the keyboard is 60 mA (note that the mouse may use up to an additional 100 mA).” which I would interpret as a “no”.
Something like this perhaps: http://www.adafruit.com/products/757 |
Chris Evans (457) 1614 posts |
Mmm I could have sworn that you could plug a PS/2 mouse into to an Arc. You don’t have anywhere to plug a mouse into of course! So not a lot of use. I’ll try one tomorrow! |
Jonathan Bond (2397) 41 posts |
That’s why I was planning on using a voltage divider on the keyboards output.
That’s OK, provided I can use a voltage divider I should be OK. D1 on the pi is rated to 200mA so I am informed. The only “ps2” port on an arc (up until the a5000) was the keyboard, and while it shares the same min-DIN-6 plug that ps2 uses, it is nothing like ps2. The arc mouse was mini-DIN-9. The a7000 was ps2 proper. |
Rick Murray (539) 13840 posts |
Not until the RiscPC generation. |
Dave Higton (1515) 3526 posts |
They exist; what sort of construction technology are you comfortable with? Surface mount ICs exist, but they can be challenging for home constructors, and can sometimes involve buying adaptor boards from the Far East. The most basic of level shifters is a transistor with two resistors. If you use a bipolar transistor in common base mode, you can make it shift up or down without inverting. I would normally construct something like that with surface mounted components (SOT-23 transistors) on square pad board, but of course it can also be done with through hole components. |
Chris Evans (457) 1614 posts |
Oops I’m not totally off my trolley, what I meant to write was: |
Jonathan Bond (2397) 41 posts |
Well I’m not looking at surface mount. Probably plain ol’ veroboard.
Thanks, very useful.
Physically you could, but you might fry the keyboard or the socket. It was only the a7000/RiscPC and onwards where they changed to the PS/2 spec for nice and keyboards. The pins on the Archimedes keyboards are wired as follows: 1. Reset Compared to the IBM PS/2 specification: 1. Data |
Ronald May (387) 407 posts |
Dave said “The Archimedes keyboard interface appears to be 31.25 kBaud serial” That’s interesting, the same speed as serial MIDI. Tank was going to add that speed to his drivers, as there is simple MIDI hardware that can be added to the RasPi that can use that speed setting. I can’t find a link to Terry Swanborough’s driver which could be simpler for setting a custom speed and making a protocol to suit the archimedes keyboard. |
Jonathan Bond (2397) 41 posts |
Is this it? https://www.riscosopen.org/forum/forums/5/topics/1362?page=2 |
Pages: 1 2