fruit-bat / pico-zxspectrum

ZX Spectrum for Raspberry Pico Pi RP2040
453 stars 48 forks source link

Where I can find the USB pins? #75

Closed Chandler-Kluser closed 1 year ago

Chandler-Kluser commented 1 year ago

Hello, I am assembling the Breadboard Version of pico-zxspectrum and I saw it is compatible with USB and PS2 keyboards.

I do not have any PS2 keyboards with me, but I looked for the D+ and D- pins to connect to my USB keyboard at pinout figure but I did not find any dedicated pin.

Could someone help me finding that? Thanks in advance!

fruit-bat commented 1 year ago

You can use an OTG adapter like this https://www.amazon.co.uk/CentBest-Splitter-Enhancer-Charging-Converter/dp/B072Z9QHYR/

Some have a built in hub, like this https://www.amazon.co.uk/Mavis-Laven-Extension-Compatible-Smartphone-default/dp/B07R3X9RCH/

With the hub you can connect keyboard and joysticks. I'm afraid only friendly joysticks that produce a sensible hid description work.

Or, if you are good at soldering, there are a couple of small pads on the back of the Pi Pico near the USB connector. If you add your own host connector, only use either the Pi Pico usb connector or yours, not both at the same time.

ArnoldUK commented 1 year ago

The OTG pass through pads on the Pico are labeled TP2 (D-) and TP3 (D+). If you are wiring your own cables to the Pico then you should also wire the 5V (VBUS) and GND cables, otherwise your USB keyboard would have no power. A dedicated OTG cable works fine also. There are not enough pins available for PS/2 support on the pico-zxspectrum so you would require some form of PS/2 to USB adapter.

Chandler-Kluser commented 1 year ago

Thanks, I will try that :)

Chandler-Kluser commented 1 year ago

I have made a small prototype with and HDMI PMOD Adapter + TF Adapter + USB Type A Connector:

01 02

Then I connected:

USB CONNECTOR RPI PICO
VBUS VBUS
D+ TP3
D- TP2
GND GND

as @ArnoldUK mentioned. The HDMI pins were connected too.

The Board gave video output, as expected:

Video Output

But when I attached my USB keyboard, it did not work...

USB Type A keyboard

I also switched the D+ and D- just in case of I exchanged the pins by myself for accident, but it did not work either...

Are you sure the breadboard version does really support USB keyboards? Thanks in advance for your support!

ArnoldUK commented 1 year ago

If you are using your own USB OTG wiring to the D+ and D- pads then you cannot use the micro-usb socket as the D+ and D- in the micro-usb socket conflict. You should remove that micro-usb cable labeled USLION and power the pi directly with 5V to VSYS or VUSB. Or use a micro-usb cable with the DATA and ID wires disconnected, leaving only +5V and GND wires connected.

The manual wiring method only works when you power the PI directly through VSYS or VUSB and not through the micro-usb port. Some USB power banks or sockets pull the DATA pins low, which is probably why your USB keyboard would not work. The micro-usb port can still be used to flash the PI as the ID pin gets priority, but the USB keyboard adapter without an ID pin will not work when the micro-usb cable is plugged in or connected to a PC system.

More info on how OTG works here: usb-otg

Chandler-Kluser commented 1 year ago

Thanks a lot!!

Wiring 5V power at VBUS and GND worked flawlessly!!!

I thought that connecting a Power Supply at OTG connector would not face issues but you are right. Thanks a lot!!

ArnoldUK commented 1 year ago

Yeah, glad to hear that worked. Like a said, some power adapters pull those data line low, others leave them floating.