IKBD-to-USB?

Troubles with your machine? Just want to speak about the latest improvements? This is the place!

Moderators: Mug UK, Zorro 2, Greenious, spiny, Moderator Team

displaced
Atari freak
Atari freak
Posts: 61
Joined: Sat Aug 06, 2016 7:09 pm

Re: IKBD-to-USB?

Postby displaced » Tue Feb 19, 2019 9:16 am

Got the veroboard layout done, but didn’t have any solid-core wire. Tried with stranded, but it’s just not reliable on stripboard.

Will do a rebuild tonight.

Got the USB HID code working. Gonna implement some hotkeys for stuff like swapping Joystick 0 between mouse and gamepad so you can have a mouse and two gamepads connected and turn 2-player joysticks on/off.

Also playing with the idea of tapping the floppy activity LED line. Then I can toggle the numlock LED for disk activity. Oh and of course, we’ll also have a functioning capslock LED!

displaced
Atari freak
Atari freak
Posts: 61
Joined: Sat Aug 06, 2016 7:09 pm

Re: IKBD-to-USB?

Postby displaced » Wed Feb 20, 2019 7:58 am

Rebuilt with the proper wire and it worked first time.

Realised that if I mounted the level converter upside down, it had the 3.3V, GND, TX and RX pins in the right order for the headers to the UART, so that cut down on the number of wires needed.

I know we all love a photo...

7CBF11BB-D12B-4BBF-8968-D11E6E1F620C.jpeg


[edit] I’ll be putting all the schematics and code up on Github once it’s reached a useful level of functionality.
You do not have the required permissions to view the files attached to this post.

User avatar
Greenious
Hardware Guru
Hardware Guru
Posts: 1462
Joined: Sat Apr 24, 2004 5:39 pm
Location: Sweden

Re: IKBD-to-USB?

Postby Greenious » Wed Feb 20, 2019 1:57 pm

Well done!

Some other ideas if you want to further expand and maximize the use of the pi0.

LCD display showing time, temperature, personalized messages etc
if you got more uarts available, add some basic networking to the serial port like the ESP01 (for inspiration, look at viewtopic.php?f=15&t=31586 )
a trackdisplay for the floppy (pretty useless tbh, but damn cool to watch the floppy working it's way through the floppy)
a knightrider led bar... (useless, buut....)
floppy a/b swap using an unused key on the pc-keyboard for those with external goteks.
Updated my guides as of june 28th, 2016. Check'em out and feedback!
viewtopic.php?t=5040

displaced
Atari freak
Atari freak
Posts: 61
Joined: Sat Aug 06, 2016 7:09 pm

Re: IKBD-to-USB?

Postby displaced » Wed Feb 20, 2019 2:06 pm

Cool - thanks for the encouragement!

I might not go for too much ‘bling’, but I do have an unused UART on-board the Pi itself which would be interesting for adding SLIP-based networking to the ST.

Right now, I’m interested to see how much, if any, noticeable lag is introduced by the Python tap. Comms isn’t really an issue since the baud rate is so low, but there might be a msec or two introduced by the software stack. Hopefully not enough to break gameplay!

Next thing to do is code up the various status-request calls to the controller. Since the Pi will take a few seconds to boot after the ST’s powered-on, the first thing it needs to do is ask the keyboard what its current modes (joystick polling mode, mouse position reporting mode etc) are so that it can send appropriate info when HID events fire.

displaced
Atari freak
Atari freak
Posts: 61
Joined: Sat Aug 06, 2016 7:09 pm

Re: IKBD-to-USB?

Postby displaced » Wed Feb 20, 2019 4:42 pm

Oh and another thought...

I want to do a menu for they python app to allow the user to do some config stuff.

Imagine this:

You open a text editor on the ST (say, EvereST) - then hit an escape sequence on the keyboard (say, Esc-***). The python script then directs keyboard input to itself and uses the EvereST window as its terminal!

I’d like to have an interactive way to setup keymaps for non-UK users. So, it’ll prompt for each ST key and you’ll press the one you want on your keyboard.

Also, it could provide key sequences for adjusting mouse sensitivity.

Or how about a key sequence that toggles rapid fire for joystick 0/1? Oooh - rapid fire on *any* USB gamepad or joystick!

Damn day-job getting in the way!

User avatar
Greenious
Hardware Guru
Hardware Guru
Posts: 1462
Joined: Sat Apr 24, 2004 5:39 pm
Location: Sweden

Re: IKBD-to-USB?

Postby Greenious » Wed Feb 20, 2019 5:27 pm

Hmm, keymapping is done in TOS, the kbd hw/fw is same for all languages, and the only difference is some 20 keycaps that are different between languages.

So the basic keys different between languages should need no mapping, however...

There are some keys that differ a lot, I suspect that to get these right, you'd have to withhold shift/alt key presses until you see what actual key is being pressed, and then send shift/alt + keypress for the correspondig character.

I'm not sure I explain myself very well here, but look at these 2 kbd layouts, one swedish, one US.

atarikbdswe.jpg


atarikbdus.jpg
You do not have the required permissions to view the files attached to this post.
Updated my guides as of june 28th, 2016. Check'em out and feedback!
viewtopic.php?t=5040

displaced
Atari freak
Atari freak
Posts: 61
Joined: Sat Aug 06, 2016 7:09 pm

Re: IKBD-to-USB?

Postby displaced » Wed Feb 20, 2019 6:00 pm

Ah yes - I get you. I suppose it’s really actually scancode mapping - mapping HID events to Atari keyboard scancodes, which are the same no matter the locale.

In which case, that mapping will likely be the same from language to language. Still, worth having a method to alter that mapping.

(besides, I’m lazy and don’t want to type out lists of HID codes and IKBD bytes... so I’ll write something to do it for me!)

nobox
Atari User
Atari User
Posts: 34
Joined: Sat Mar 28, 2015 12:42 pm

Re: IKBD-to-USB?

Postby nobox » Thu Feb 21, 2019 5:10 pm

displaced wrote:Oh and another thought...

I want to do a menu for they python app to allow the user to do some config stuff.

Imagine this:

You open a text editor on the ST (say, EvereST) - then hit an escape sequence on the keyboard (say, Esc-***). The python script then directs keyboard input to itself and uses the EvereST window as its terminal!

I’d like to have an interactive way to setup keymaps for non-UK users. So, it’ll prompt for each ST key and you’ll press the one you want on your keyboard.

Also, it could provide key sequences for adjusting mouse sensitivity.

Or how about a key sequence that toggles rapid fire for joystick 0/1? Oooh - rapid fire on *any* USB gamepad or joystick!

Damn day-job getting in the way!



If you want to allow a custom keymapping, would be a nice idea to make this compatible to the eiffel protocol.

So one could use the eiffel software. i wanted to do this in the ikbdemu software, but never found the time ...

displaced
Atari freak
Atari freak
Posts: 61
Joined: Sat Aug 06, 2016 7:09 pm

Re: IKBD-to-USB?

Postby displaced » Wed Feb 27, 2019 8:42 am

nobox wrote:If you want to allow a custom keymapping, would be a nice idea to make this compatible to the eiffel protocol.

So one could use the eiffel software. i wanted to do this in the ikbdemu software, but never found the time ...


Will see what I can do!

Had a bit of a delay - was waiting for some DuPont connectors and crimp tool to arrive so I can make decent cables.

Wrapped the board in self-amalgamating tape to avoid shorts.

Started design of a V2 board with 2-row right-angle headers to reduce the profile and make installation easier. Also got to replace the headers on the UART board with right-angle ones for the same reason.

Software-wise, I’ve been restructuring the code and working on HID input. Got my Logitech wireless keyboard working with the ST last night! Glorious keypress beeps!

Planning eventually on using a python plugin library to make it easy to customise behaviour (toggling rapid-fire via a joypad button for example)

displaced
Atari freak
Atari freak
Posts: 61
Joined: Sat Aug 06, 2016 7:09 pm

Re: IKBD-to-USB?

Postby displaced » Fri Mar 01, 2019 1:21 pm

Moved to work on the mouse.

Sadly the threading and queue setup I have in the code is too slow to keep up with streamed mouse events, which I’m a little surprised about!

Seems that the mouse data is received promptly, but it’s slow sending that data back to the ST.

Need to do some investigation. Will start by going back to my simple data-in, data-out tap to make sure it’s not a hardware or intrinsic Python problem!

User avatar
Greenious
Hardware Guru
Hardware Guru
Posts: 1462
Joined: Sat Apr 24, 2004 5:39 pm
Location: Sweden

Re: IKBD-to-USB?

Postby Greenious » Fri Mar 01, 2019 1:33 pm

Usually the problem is the other way around, some usb mouse adapters caution that moving the mouse to fast will cause problems with the mouse movement... and those are made with a much slower pic ic.
Updated my guides as of june 28th, 2016. Check'em out and feedback!
viewtopic.php?t=5040

displaced
Atari freak
Atari freak
Posts: 61
Joined: Sat Aug 06, 2016 7:09 pm

Re: IKBD-to-USB?

Postby displaced » Mon Mar 18, 2019 10:38 am

It took me a while, but I’m back on track.

Instead of a complex multithreaded, queue-based set-up, I took the time to learn python’s asyncio async/await-based programming.

Works just fine now for joysticks and mice connected to the ST itself.

USB keyboards, gamepads and mice are working in basic form. However, I need to add support for all IKBD reporting and monitoring modes.

Incidentally, I think I remember reading about games or software that make use of the ability to send and execute code on the IKBD controller itself. Can anyone provide an example? At the moment, my code will honour the MEMORY READ, MEMORY LOAD and EXECUTE IKBD commands by transparently proxying them to/from the controller. But if the uploaded code does something with key/mouse/joy events, the USB events won’t be seen by it.

displaced
Atari freak
Atari freak
Posts: 61
Joined: Sat Aug 06, 2016 7:09 pm

Re: IKBD-to-USB?

Postby displaced » Mon Mar 18, 2019 10:44 am

Greenious wrote:Usually the problem is the other way around, some usb mouse adapters caution that moving the mouse to fast will cause problems with the mouse movement... and those are made with a much slower pic ic.


Yes, I’ve seen that in testing. With a regular ST mouse, I see relative mouse events whose X/Y values are quite small (+/-6 or 7) at high speed. But my USB mouse generates values in excess of 250. I’ll need to come up with an algorithm to make modern mice feel like an old ST mouse - some kind of scaling or limiting factor. It’ll need to be user-tweakable to deal with all the crazy high-res mice we have these days.

User avatar
Greenious
Hardware Guru
Hardware Guru
Posts: 1462
Joined: Sat Apr 24, 2004 5:39 pm
Location: Sweden

Re: IKBD-to-USB?

Postby Greenious » Mon Mar 18, 2019 12:47 pm

Yes, the IKBD is programmable, and there are a few games and demos using this.

I think this thread might be useful:
viewtopic.php?f=16&t=5297

Emulators basically deals with this in two ways, either complete emulation of IKBD, or, by analysing the uploaded code, reconfigures itself to respond the way the software expects.
Updated my guides as of june 28th, 2016. Check'em out and feedback!
viewtopic.php?t=5040

displaced
Atari freak
Atari freak
Posts: 61
Joined: Sat Aug 06, 2016 7:09 pm

Re: IKBD-to-USB?

Postby displaced » Mon Mar 18, 2019 3:15 pm

Thanks - that thread was really interesting. I think I’ll file that problem under ‘worry about it when it happens’. For the moment, I’ll be happy with getting the basic stuff working, and perhaps get games/apps working on a case-by-case basis as I find them.

displaced
Atari freak
Atari freak
Posts: 61
Joined: Sat Aug 06, 2016 7:09 pm

Re: IKBD-to-USB?

Postby displaced » Fri Mar 22, 2019 10:40 pm

Now it’s reached a usable state, I’m looking for little quality of life improvements :)

I’ve added the ability to map keystrokes to gamepad buttons. I’d forgotten just how many ST games needed the spacebar to be tapped to get past a start screen!

I toyed with the idea of hooking the ST’s reset button up to a GPIO pin on the Pi via a relay so I could reset the ST from another gamepad button. But there’s a few problems there. First, the Gotek HxC File Selector often crashes after playing a game without a cold reset. Plus, the HxC doesn’t automatically go back to the File Selector slot on reset, so it’d just start the same game again.

I’ll make the code and hardware available via github in the coming week, once I’ve wrotten up some documentation. It’s entirely possible that no one else will use this, but still, it’s all good fun.

User avatar
Greenious
Hardware Guru
Hardware Guru
Posts: 1462
Joined: Sat Apr 24, 2004 5:39 pm
Location: Sweden

Re: IKBD-to-USB?

Postby Greenious » Sat Mar 23, 2019 2:50 pm

Awesome, great work. Always interesting following along when ppl are developing, thank you for sharing!
Updated my guides as of june 28th, 2016. Check'em out and feedback!
viewtopic.php?t=5040

displaced
Atari freak
Atari freak
Posts: 61
Joined: Sat Aug 06, 2016 7:09 pm

Re: IKBD-to-USB?

Postby displaced » Sat Mar 23, 2019 3:20 pm

Thanks, Greenious!

I hope it's ok to keep posting the occasional update. I'm aware this thread is almost turning into a blog -- feel free to let me know if it's better off elsewhere!

I need to get the ST back together, so I'll work on the rev2 board today which should be more space-efficient. I've got some new bi-directional level converters to play with, so I'm going to breadboard it out first to see how they behave.

displaced
Atari freak
Atari freak
Posts: 61
Joined: Sat Aug 06, 2016 7:09 pm

Re: IKBD-to-USB?

Postby displaced » Wed Mar 27, 2019 8:36 am

Rev2 of the board’s complete - it’s got a larger footprint, but with 90-degree headers, it’s a lot shorter.

I decided I wanted to fit everything on the PSU frame, since I’ve got a Marpet SIMM upgrade sat on the shielding between the PSU and floppy, so I’ve also set up a PicoPSU.

Here’s what it currently looks like. Will mount everything to the PSU frame’s plastic cover with some Velcro pads for easy removal. Excuse the bit of blue electrical tape - it’s temporary :)


FAAFF42B-7401-4687-B472-7B3E4D47E796.jpeg
You do not have the required permissions to view the files attached to this post.

User avatar
Greenious
Hardware Guru
Hardware Guru
Posts: 1462
Joined: Sat Apr 24, 2004 5:39 pm
Location: Sweden

Re: IKBD-to-USB?

Postby Greenious » Wed Mar 27, 2019 11:34 pm

displaced wrote: I hope it's ok to keep posting the occasional update. I'm aware this thread is almost turning into a blog -- feel free to let me know if it's better off elsewhere!.


I can't think of a better place than this.

Keep your updates coming!

May I ask you what level shifters you are using?
Updated my guides as of june 28th, 2016. Check'em out and feedback!
viewtopic.php?t=5040

displaced
Atari freak
Atari freak
Posts: 61
Joined: Sat Aug 06, 2016 7:09 pm

Re: IKBD-to-USB?

Postby displaced » Thu Mar 28, 2019 12:11 am

Ah, excellent!

I’m using 2-channel unidirectional shifters. They’re the ones with pins marked with TXI/TXO, RXI/RXO. I’ve ordered a couple of different brands of these and they were fine.

I also tried some bidirectional ones - where the pins are marked simply LV1-4 and HV1-4. These didn’t work for me. I’m certainly no electrical engineer, but from what I’ve read, bi-di’s tend to be slower in reacting to rises/falls, and I’ve even seen some stuff about them inverting the signal. Shame, because the stripboard layout would probably be simpler with those.

(These are like the ones I’m using: Cylewet 2 Channel Logic Level Converter 3.3V to 5V TTL Module for Arduino (Pack of 10) CLW1070 https://www.amazon.co.uk/dp/B073XH9CNM/ ... NCbWQ2SZSG)

User avatar
Methanoid
Captain Atari
Captain Atari
Posts: 277
Joined: Mon Jan 26, 2004 2:41 pm
Location: England.. where else?

Re: IKBD-to-USB?

Postby Methanoid » Mon Jun 10, 2019 12:09 pm

Displaced... any news on this?

displaced
Atari freak
Atari freak
Posts: 61
Joined: Sat Aug 06, 2016 7:09 pm

Re: IKBD-to-USB?

Postby displaced » Wed Jul 03, 2019 1:28 pm

Methanoid wrote:Displaced... any news on this?


Hi Methanoid - I've been stupidly busy recently with non-computery things recently, but hope to get back to this soon!

I've got a new XEGS on the way, so that'll give me a chance to get back into tinkering! :)

tzok
Captain Atari
Captain Atari
Posts: 176
Joined: Fri Jun 30, 2017 7:22 pm
Location: Bielsko-Biala, PL
Contact:

Re: IKBD-to-USB?

Postby tzok » Wed Jul 03, 2019 6:35 pm

TOS 2.xx additionally initializes the ST real time clock from IKBD clock, so there is additional query after the reset. Same with TOS 1.06/1.62 and STE_FIX.PRG AutoLoaded and older TOSes and CONTROL.ACC loaded.

Having this board in your ST, you may easily add a real time clock functionality. Please see my project:
https://www.exxoshost.co.uk/forum/viewt ... f=10&t=544


Social Media

     

Return to “Hardware”

Who is online

Users browsing this forum: No registered users and 7 guests