Keyboard Solution, UzePS2, or what have you

Topics regarding the Uzebox hardware/AVCore/BaseBoard (i.e: PCB, resistors, connectors, part list, schematics, hardware issues, etc.) should go here.
User avatar
D3thAdd3r
Posts: 2424
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Keyboard Solution, UzePS2, or what have you

Post by D3thAdd3r » Tue Jan 27, 2015 4:05 am

Ok didn't get much time to look at this but it seems to be working still on the test keyboard(and PS2 mouse supports a rarely used polling mode and should be possible without interrupts, but I didn't get that functioning correctly). I made a connector out of a nice ~$2 China/ebay PS2 solder on plug/boot thing connected to a chopped off SNES controller end. Forgive the "schematics".... and the code could be really cut up right now and I don't recall what I was experimenting with months ago. I also found PS2KeyPolled but it didn't experiment much or get that to work if I recall. You will see each keystroke doubled because it is drawing the "make" and "break" messages for each keystroke right now. Let me know what you think about it, but I think it's a dead end because it's too slow as you'll see.
uzeps2plug1.jpg
uzeps2plug1.jpg (16.13 KiB) Viewed 3816 times
uzeps2plug2.jpg
uzeps2plug2.jpg (22.61 KiB) Viewed 3697 times
Now I had an interesting thought last night that I believe is correct. If we want to have keyboard games, then we have to support users that don't have a keyboard(the vast majority) otherwise the programs with keyboard support will just be a novelty enjoyed by a few hardcore fans. So I had the idea that whatever the hardware keyboard interface is like we need a light weight virtual on screen keyboard that does the same thing(put some bytes in a buffer). This is what I worked up last night and I plan to implement a chat client experiment using it. Check it out and let me know what you think. BTW Alec I noticed you in the chatroom too late I think, I quickly recompliled a couple messages(it's the only way I have to send a custom message right now) but with this real time communication should be feasible right now.

Alec, I think your original idea with the ATtiny is the best but I do think real PCBs would need to be made. I wonder if we could somehow use a really small one like an 8 pin that might fit in a smaller profile/cleaner plug.
virtualkeyboard.zip
(3.02 KiB) Downloaded 136 times
Attachments
ps2.zip
(197.09 KiB) Downloaded 124 times

User avatar
D3thAdd3r
Posts: 2424
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Keyboard Solution, UzePS2, or what have you

Post by D3thAdd3r » Tue Jan 27, 2015 5:20 am

Here's the hex for the virtual keyboard to play with. It works pretty well and can enter any character we should need. Some of those tiles aren't right in the tile set I'll fix that
Attachments
virtualkeyboard.hex
(131.23 KiB) Downloaded 130 times

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Keyboard Solution, UzePS2, or what have you

Post by uze6666 » Tue Jan 27, 2015 6:14 am

The virtual keyboard is a great idea Lee! We should tweak the use of all buttons to speed up typing, I.e using L or R for CAPS as you did and perhaps A for backspace, START for send, etc. An "auto-repeat" when moving would be a nice addition too.

User avatar
D3thAdd3r
Posts: 2424
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Keyboard Solution, UzePS2, or what have you

Post by D3thAdd3r » Tue Jan 27, 2015 6:19 am

Good point there. Like you say with enough shortcuts an experienced user might be able to get type entered reasonably quick. I thought too about aligning the characters vertically instead of angled like a real keyboard. Playing with it more I often guess wrong where the cursor will go when I press up or down. I like how it looks but I wonder if a keyboard more like that of a cellphone would be more efficient in the end where all the less often used characters are on a different page. I am kind of leaning that way since then the keyboard is easily narrow enough to use it in mode 3 too, and no reason it couldn't still have compatible output with the hardware keyboard. I'll chip away at it sporadically like I do.

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Keyboard Solution, UzePS2, or what have you

Post by uze6666 » Tue Jan 27, 2015 6:37 am

Thinking about it, this whole keyboard thing is distracting us from the more important network stuff. The virtual keyboard should do the job for now, when I have more time I'll finish up the hardware one.

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Keyboard Solution, UzePS2, or what have you

Post by uze6666 » Sun Mar 01, 2015 7:13 am

For some reason I felt compelled to finish that keyboard thing once and for all. I've been working on it in the past week and I can now report it's done and working well. The design is pretty simple and only uses an Attiny26 (which seems to be obsolete by now) on the P2 port. The protocol I designed plays nice along with the polls on P1 port so it could be used for other devices in the future. Like perhaps an input for a rotary encoder (T2K, Arkanoid, etc).
keyb.jpg
keyb.jpg (37.66 KiB) Viewed 3635 times
I'll be making a pcb design as soon as I order some AtTiny25.

As for the firmware I was thinking of these functions:
-Initialize
-Reset
-Get device ID
-Get firmware revision
-Get scancode (for the keyboard)
-More?

So that should open quite a few possibilities like Uzechat, the telnet games, a Basic interpreted etc. :mrgreen:

User avatar
D3thAdd3r
Posts: 2424
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Keyboard Solution, UzePS2, or what have you

Post by D3thAdd3r » Sun Mar 01, 2015 3:51 pm

Very cool, I would like to build one soon. Do you see any reason a tiny85 wouldn't work? They happen to be a recommended chip for a v-usb project which I want to try out and I have a bunch of them doing nothing.

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Keyboard Solution, UzePS2, or what have you

Post by uze6666 » Sun Mar 01, 2015 7:16 pm

D3thAdd3r wrote:Very cool, I would like to build one soon. Do you see any reason a tiny85 wouldn't work? They happen to be a recommended chip for a v-usb project which I want to try out and I have a bunch of them doing nothing.
I really wanted to use 8 pins attiny25/45/85 but alas their pinout made it harder. Right now, I need the INT0 pin to respond quickly (and simply) to the keyboard clock. But, on the tiny25, this pin is shared with a SPI bus pin I also need to interface with the SNES port.

But you know me, I like a challenge, so now that it works fine as-is, I will try to use a pin change interrupt on another free pin. It's a bit more work but at 16mhz, there's plenty of cycles for that. Another motivation for using attiny25, is the internal PLL to run at 16Mhz with no external parts.

Finally, another thing I'd like would be to be able to update the firmware via the host. There's no bootloader concept per se on the tiny so I don't know if it's possible with the above design.

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Keyboard Solution, UzePS2, or what have you

Post by uze6666 » Mon Mar 02, 2015 4:57 am

Luckily, I had 2 AtTiny85 lying around so I ported the code and used a pin change interrupt instead of INT0. I ran in all sort of weird bugs but I managed to make it work in the end. I really like the minimal parts count, can't be less than that really, all pins are used and there's no other external parts. Here's the final design. Note that it work equally with a AtTiny25/45/85 as the firmware takes less than 25% of the 128 bytes of RAM of an AtTiny25. :P
kb2.gif
kb2.gif (7.52 KiB) Viewed 3593 times
I've put the Eagle schematic in the download section.

I've commited the firmware along with a small keyboard demo: https://code.google.com/p/uzebox/source ... rdFirmware

I'll try to make a small PCB this week. Still have to add all the commands (like returning the device id) and wrap-up the kernel code. And update Uzem too... :cry:

Let me know how it works out for you!

shockdesign
Posts: 26
Joined: Mon Jan 06, 2014 12:20 pm

Re: Keyboard Solution, UzePS2, or what have you

Post by shockdesign » Mon Mar 02, 2015 5:44 am

This is quite cool, and makes me wonder if we can have an Uze in a keyboard case with a joystick port on the side, etc.. :)

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests