displaced
Posts: 2
Joined: Sat Sep 20, 2014 1:54 pm

Using both UARTs to monitor/inject data

Tue Feb 12, 2019 7:58 am

Hi!

I have a Pi Zero W that I’m interested in using for a project.

The idea is to use the Zero to tap the serial link between the keyboard controller and motherboard of an old Atari ST computer.

The link is 5V serial at a baud rate of 7812.5. I have an appropriate voltage shifter to deal with the levels.

I’ve been reading about the Zero’s two UARTs and I’ve (hopefully correctly) inferred that it’s possible to expose both UARTs on the GPIO header with a bit of configuration. Is that the case?

My plan is to connect the keyboard to one UART and the ST itself to the other. Then, write a bit of code to copy from one to the other whilst dumping the transferred bytes.

From there, I can use existing protocol documentation to translate USB HID events and push them out to the ST, allowing modern USB keyboards, joysticks and mice to be used with the ST.

Any advice greatly appreciated!

Chris

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6219
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Using both UARTs to monitor/inject data

Tue Feb 12, 2019 9:51 am

displaced wrote:
Tue Feb 12, 2019 7:58 am
I’ve been reading about the Zero’s two UARTs and I’ve (hopefully correctly) inferred that it’s possible to expose both UARTs on the GPIO header with a bit of configuration. Is that the case?
Certainly not directly off the GPIO header.
Read the permitted pinmuxings in https://www.raspberrypi.org/documentati ... herals.pdf (section 6.2).
UART0 can be muxed to Broadcom GPIOs 14&15 (alt0), 32&33 (alt3), or 36&37 (alt2).
UART1 can be muxed to Broadcom GPIOs 14&15 (alt5), 32&33 (alt5), or 40&41 (alt5).
Of those, only 14&15 are accessible via the 40 pin GPIO header, but you can't mux both UARTs to the same pins simultaneously.

You may be able to fiddle it on a Pi0 (NOT Pi0W) to get UART1 out via the camera connector. GPIO32 can be set for TXD1 (alt5), but is normally used for the camera LED line. GPIO41 can be set to RXD1 (alt5), but is normally used for the camera shutdown line. Refer to https://www.raspberrypi.org/documentati ... educed.pdf for the pinout of the camera connector. You'll need to make appropriate device tree changes to mux the pins accordingly.
Modifications such as this are entirely at your own risk!
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

ElEscalador
Posts: 653
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

Re: Using both UARTs to monitor/inject data

Tue Feb 12, 2019 12:36 pm

If I understand what you want to accomplish, you may not need two uarts - to me it sound like you can use just the rx pin to listen to the keyboard, and just the tx pin for sending to the Atari. Unless you need to read AND write to these devices, in which case...
You could try bit-banging with pigpio - where you use another non-uart gpio pin for serial comms. It's possible I just don't know how to tune it properly, but I found myself losing a lot of bits when I tried it.... Alternatively, you could use a USB -> FTDI chip.
My Autonomous Robot Project and a few of my other projects below.

https://lloydbrombach.wordpress.com/

Return to “Interfacing (DSI, CSI, I2C, etc.)”