Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 00:37 17 May 2022 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : pico talking to a USB keyboard

Author Message
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 1987
Posted: 12:50pm 27 Jan 2022
Copy link to clipboard 
Print this post

happened upon this, and thought it may be of interest:
https://forums.raspberrypi.com/viewtopic.php?t=310801#p1896289
(Re: Connecting USB keyboard to Pico)

note: it shouldn't preclude using the USB port to upload firmware to the pico.


and a youtube video, featuring someone else doing similar:
https://www.youtube.com/watch?v=2eB8p8vo7lw
which also seems to show the pico generating composite video. includes a github link to code:
https://github.com/pa-art/test_usb_host


cheers,
rob   :-)
Edited 2022-01-27 23:03 by robert.rozee
 
KD5ZXG
Regular Member

Joined: 21/01/2022
Location: United States
Posts: 53
Posted: 05:32pm 01 Feb 2022
Copy link to clipboard 
Print this post

We have all seen the old adaptors from USB-F to PS/2-M, nothing inside but wire.
Reading that this only works if your keyboard (or mouse) handles both protocols.
Some do, some don't? Physical USB-F connection might work as well as MiniDIN6.
Fair warning: I am talking like I know something without having actually tried it.

PS/2 over USB
pin1 = +5V
pin2 = Data
pin3 = Clock
pin4 = Ground

Just saying PS/2 is about having a compatible keyboard, not about being round.
Ideally we also want a keyboard that works with +3.3V power and logic levels.
Not talking about connecting with the real USB port on the end of your PICO.
Edited 2022-02-02 03:59 by KD5ZXG
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 2185
Posted: 06:09pm 01 Feb 2022
Copy link to clipboard 
Print this post

Things are not always what they seem. :)
The keyboard I use with my CMM2 has a USB plug and runs fine as it's PS/2 compatible.
The keyboard I use with my PicoMite VGA is an "official" PS/2 one but it'll run happily on 3.3V.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs
 
Amnesie
Senior Member

Joined: 30/06/2020
Location: Germany
Posts: 193
Posted: 06:39pm 01 Feb 2022
Copy link to clipboard 
Print this post

Yes,
but this only works if the keyboard supports the PS/2 protocol. I have a lot of mechanical Keyboards that feature a USB connector but supporting PS/2, too. In fact I am using one right now on the Pico! Since USB connectors are more common, I use them all the time for my "PS/2-only" builts and PCBs. The so called PS/2 connector isn't even a "PS/2 connector", but a mini DIN connector. To not confuse people with my own PCBs, which use a USB connector for PS/2 keyboards, I always write it on the PCB (silk screen layer) "PS/2 protocol ONLY" :)
Edited 2022-02-02 04:42 by Amnesie
 
KD5ZXG
Regular Member

Joined: 21/01/2022
Location: United States
Posts: 53
Posted: 08:11pm 03 Feb 2022
Copy link to clipboard 
Print this post

I made a thing to plug-in a PS/2 over USB keyboard.
A row of USB3 only pins has been cut out of the way.
Edge pins soldered to the shield for mechanical support.
Adhesive foot belt sanded to sit level with the pins.



If only my VGA hack was going so well...
Edited 2022-02-04 09:03 by KD5ZXG
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 1987
Posted: 02:14am 04 Feb 2022
Copy link to clipboard 
Print this post

my mistake, i fear, was in not making the title clear enough. it should have been:

"pico talking to a USB keyboard that is NOT PS/2 compatible"

at the moment it is still possible to buy new USB keyboards that are PS/2 backwards compatible, but i see these becoming increasingly difficult to find. even now, few are marketed (or in any way marked) as supporting PS/2, and successfully finding a compatible keyboard new is a matter hit-and-miss.

hardly any piece of new consumer electronics has a PS/2 keyboard or mouse port, and there is little incentive for keyboard manufacturers to go to the effort of continuing to having their USB keyboards support the PS/2 protocol. soon, this will render the pico-based VGA version of MMbasic considerably less useful.


cheers,
rob   :-)
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 8081
Posted: 02:19am 04 Feb 2022
Copy link to clipboard 
Print this post

  Quote  soon, this will render the pico-based VGA version of MMbasic considerably less useful.


I wouldn't go that far.

2nd hand PS/2 keyboards and mice are still very easy to find, so I don't think that is really much of a problem Rob.
Go to pretty much any PC or computer service shop, and they will probably have piles of old PS/2 mice and keyboards out the back you can buy for five bucks or less.

As to NEW keyboards and mice, yes, they are most certainly more likely to be USB-only at this point, but the unavailability of BRAND NEW keyboards that are PS/2 compatible is not any serious issue as far as I am concerned - just use one of the piles and piles of 2nd hand native PS/2 ones.
Smoke makes things work. When the smoke gets out, it stops!
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 1987
Posted: 05:17am 04 Feb 2022
Copy link to clipboard 
Print this post

  Grogster said  2nd hand PS/2 keyboards and mice are still very easy to find.


i also have a box full of PS/2 keyboards in the garage... but dare i say that we do not represent the typical 'person on the street'     the average person does not have years of accumulated computer drek dating back to the late 20th century, and most don't even know about the few remaining computer service (or recycling) shops that still exist.

all most folks know about is the Jaycars and Altronics of the world. and they've never even heard of (or could imagine) Dick Smiths, David Reids, Tricity House, or any of the dozens of other outlets that used to exist 20+ years ago.

any product design needs not cater to the inventor, but to the consumer masses.


cheers,
rob   :-)
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 2185
Posted: 07:31am 04 Feb 2022
Copy link to clipboard 
Print this post

The problem probably lies in getting a properly working and reliable version of tiny usb. Apparently it's not all that easy to get info out of its developers. Connection would almost certainly be via a OTG adapter and the tiny usb stack on the PicoMite would have to make it respond as a HID device. Whether that would get in the way of the USB socket being used as a console device I don't know. I don't know anything about USB protocol. How much RAM would be lost to support the bigger stack vs what's used for PS/2 support is another factor.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 1987
Posted: 01:03pm 04 Feb 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  The problem probably lies in getting a properly working and reliable version of tiny usb. Apparently it's not all that easy to get info out of its developers. Connection would almost certainly be via a OTG adapter and the tiny usb stack on the PicoMite would have to make it respond as a HID device. Whether that would get in the way of the USB socket being used as a console device I don't know. I don't know anything about USB protocol. How much RAM would be lost to support the bigger stack vs what's used for PS/2 support is another factor.


as i wrote at the very top of this thread:

  robert.rozee said  happened upon this, and thought it may be of interest:
https://forums.raspberrypi.com/viewtopic.php?t=310801#p1896289
(Re: Connecting USB keyboard to Pico)


it looks like people HAVE made it work. YES, you need to use a suitable adapter cable. NO, you could not use the same USB socket for a console connection at the same time!

it is unlikely the RAM overhead would be significantly different.

simplest solution would be for a VGA/USB keyboard/pico MMbasic version to:
1. use the USB socket exclusively for keyboard (socket configured as USB host) or firmware upgrade (mass storage device, handled by bootloader). NO USB CDC support, as having this also configurable would be just too confusing!
2. if a console is required, the user can attach via a comm port.


i'm just floating the idea, not wanting to make a meal out of the whole polava.


cheers,
rob   :-)
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 2185
Posted: 02:29pm 04 Feb 2022
Copy link to clipboard 
Print this post

Whether they've managed to get tinyusb to perform *reliably* as a keyboard host I don't know. No, you couldn't use the port for a console at the same time, but that's already been got round. :)

We know how much Peter loves pico SDK and tinyusb though. ;)
Unless you fancy having a go? hehe
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 1293
Posted: 02:31pm 04 Feb 2022
Copy link to clipboard 
Print this post

Robert,

The pico board has DP and DP (2 USB signals) available at the bottom side as TP2 and TP3.
I can imagine that you take a standard USB-A board connector, wire it up to TP2, TP3, GND and VSYS (5V). Use the micro USB for software update and developemnt. Remove the micro USB cable, and plug the keyboard into the USB-A connector.

Volhout
Edited 2022-02-05 02:00 by Volhout
If nothing goes right ... turn left
 
bigfix
Senior Member

Joined: 20/02/2014
Location: Austria
Posts: 109
Posted: 04:15pm 04 Feb 2022
Copy link to clipboard 
Print this post

New PS2 Keyboards are still easy to get:

I recently ordered 2 different PS2 Keyboards from Amazon.de with QUERTY layout
They have real PS2 Plugs and both work at an old laptop
Did not test them yet on any Mite


Mini KB


Fullsize KB
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 2185
Posted: 05:14pm 04 Feb 2022
Copy link to clipboard 
Print this post

TP2 and TP3 are for when you surface mount the Pico, they are in parallel with the on-board socket. Sometimes you can't get to the socket then, so you can run them out to an external socket. It's the same USB port, the RP2040 only has one.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs
 
dMajo

Newbie

Joined: 18/05/2020
Location: Italy
Posts: 21
Posted: 06:05pm 07 Feb 2022
Copy link to clipboard 
Print this post

Mick,
from RP2040 datasheet (P.407 - 4.1 USB) it seems that the RP2040 supports both the device (4.1.1.1.1. Device Mode) and host (4.1.1.1.2. Host Mode) modes.
So nothing strange that someone has made an native USB keyboard driver.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 2185
Posted: 06:38pm 07 Feb 2022
Copy link to clipboard 
Print this post

Nothing strange about it, no. I was just pointing out that there is only one USB port, despite two sets of connections. It can be either a device or a host.

I don't know anything about programming USB stuff. I do know that people have had (and until quite recently were still having) problems with tinyusb that don't get resolved (e.g. it going to sleep for no apparent reason). It's quite possible that someone has solved it all and I'm out of date.

It doesn't matter in this case anyway as current development on the PicoMite is complete so it won't get a USB keyboard facility unless someone other than Peter works from the source on Github.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2022