6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 7:31 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Keyboard / Mouse
PostPosted: Fri Jul 01, 2022 10:24 pm 
Offline
User avatar

Joined: Sun Dec 29, 2002 8:56 pm
Posts: 460
Location: Canada
Extending from this
http://forum.6502.org/viewtopic.php?f=4&t=7213#p93529

Quote:
And something that i think would be good for another thread: dealing with a PS/2 Mouse.

To deal with a keyboard / mouse I got a USB to serial module. It could be interfaced to a serial port. It may be possible to get by with only a single serial port for both mouse and keyboard. I have done some experimenting with the module's software and modified it to send a 'K<scan code>' or 'M<mouse value>' at 19,200 baud which can be parsed when received.

_________________
http://www.finitron.ca


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard / Mouse
PostPosted: Sat Jul 02, 2022 4:43 am 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
USB is definitely the way to go. PS/2 HIDs are getting hard to find and unreliable. What module did you get

_________________
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard / Mouse
PostPosted: Sat Jul 02, 2022 5:19 am 
Offline
User avatar

Joined: Sun Dec 29, 2002 8:56 pm
Posts: 460
Location: Canada
A module called V2DIP2-48 based around an FTDI chip (VNC2-48Q). It is a 48-pin DIP footprint module (has 40 pins) with 2 USB HOST connectors. Has UART, SPI, and parallel interfaces.

Just checked the supplier website and see that the modules are no longer manufactured. There's probably an updated one though.

_________________
http://www.finitron.ca


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard / Mouse
PostPosted: Sat Jul 02, 2022 2:21 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
Looks ideal. Digi-Key is showing stock on them.

_________________
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard / Mouse
PostPosted: Sat Jul 02, 2022 3:45 pm 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 746
Location: Germany
That is a very interesting chip!

I found them on mouser as well for around 4-5 USD a piece and they come in DIY solder friendly packages!
I'm currently looking at the datasheet for the VNC2-32L1C
And it basically is a Microcontroller with USB Support.
So it has it's own CPU, RAM, ROM, and a bunch of IO. so you use that to handle the actual USB Data and then communicate with the main system via the IO (UART, SPI, FIFO, etc).
so in a 65xx System you could use a 65SPI Core or direct 8-bit Interface to connect to the IC, you just need to use some of the existing firmware or design your own (something more optimized for a 65xx Interface) to handle the commands and data transfer.

one downside of the chip is that (like most/all Microcontrollers) it's not programmed out of the factory... so you need to program it yourself using FTDI's proprietary programmer (~20 USD on their site, Mouser, and DigiKey) and their software (though it doesn't appear to require any kind of licence).

plus it requires 3.3V on it's Vcc pins to run and that's also the maximum voltage of the IO, but the datasheet does mention that it has 5V tolerant inputs on the GPIO pins...
so in theory you could have a 5V Unidirectional Interface (like SPI or a UART) hooked up to it without level shifters as long as the voltage it outputs is high enough for 5V logic to recognize as a stable "1".

but i'm kinda wondering how this would compare to something more mainstream, like an STM32 with built in USB support. the STM32 definitely has a more established user base, and the chips are similarly priced for much more CPU power and IO.
though i guess the main goal of the VNC2 is kind of the opposite of a regular Microcontroller, instead of a high speed/capacity CPU/RAM/ROM Combo surrounded by IO, it's more of a main IO Controller + a few smaller ones duct taped to a tiny and custom CPU/RAM/ROM Combo.


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard / Mouse
PostPosted: Sat Jul 02, 2022 7:14 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
I went through the whole USB Keyboard (and optional mouse) a few months back - here

viewtopic.php?f=4&t=7065

I also found this:

https://www.digchip.com/datasheets/part ... F1-pdf.php

This was possibly the "best" solution I found:

https://www.hobbytronics.co.uk/usb-host-keyboard

But when I did more thinking I decided to give up on the idea for that particular project and I moved to a "bare-metal" Raspberry Pi solution. Which for many reasons I hate, but it solves an issue.

However

Proxy wrote:
but i'm kinda wondering how this would compare to something more mainstream, like an STM32 with built in USB support. the STM32 definitely has a more established user base, and the chips are similarly priced for much more CPU power and IO.


Hopefully these STM (etc.) devices have ready-to-go USB drivers (free, open source, binary blob, do you care?). The Pi ... well, it's stupid huge, overwhelmingly huge. Takes a second to initialise on a Pi Zero running at 1Ghz and needs back-end voodoo to keep it going. I didn't write my own, but rather bludgeoned someone elses to work in my project. Copy & Paste coding. I don't like it, but little choice for this.

Part of why I was looking was the new USB keyboards are real USB keyboards and not really PS/2 keyboards under the lid. The days of the PS/2 keyboard are more or less over now.

Mice were serial back on the old days too - but can you buy a serial mouse today? Or even a PS/2 mouse?

It's a race to the bottom of the barrel ...

And I've just had a stupid idea - I could easily write a 6502 or 65816 emulator inside my bare-metal Pi (heck, there's one already - in the form of the PiTubeDirect project - a 300Mhz 65C02, anyone?) memory-map a virtual serial port that's funnelled to the USB port and the 6502 side won't know any different... Same for video, mouse, SPI, I2C and so on.

but one reason I built my Ruby systems was because I wanted a real 65C02 (& '816)

Ah well.

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard / Mouse
PostPosted: Sat Jul 02, 2022 8:04 pm 
Offline
User avatar

Joined: Fri Dec 12, 2008 10:40 pm
Posts: 1007
Location: Canada
PS/2 mice are still available new for a few bucks. They are technically serial and should not be that hard to code a driver for.

_________________
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: Keyboard / Mouse
PostPosted: Sat Jul 02, 2022 8:49 pm 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 1043
Location: near Heidelberg, Germany
I've used an SPI base USB controller to connect keyboard or mouse to a 6502 via SPI.
https://youtu.be/Oof1uryV-bo
See the video description for further links

_________________
Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content: http://6502.org/users/andre/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 48 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: