Jump to content
IGNORED

USB Keyboard Adapter w/Arduino style components


jedimatt42

Recommended Posts

Ok, I tested the ctrl-shift feature in the new TIMXT with the TI 99 USB Keys adapter, and it gets stuck... one more step to perfection... I just know it :)

 

By any chance, when ctrl-shift is detected, are the keyboard columns just left unchanged until the release? If so, that would be cool, as that exploits a weekness of my TI column scanning routine being fully interrupt driven. As I don't get any interrupts, and consequently don't update the output pins on the

-M@

I believe so and can verify tomorrow. The routine sets the column then tests the shift and control bits separately. I'd one is depressed, the second is tested. If it too is depressed, the scan loops on those same two bits until one is released.
Link to comment
Share on other sites

Ew, do you use the mouse or something?? ;)

You know, until just now I had never read what the windows key shortcuts are for. Oddly enough, many of those operations (window placement) I perform on my Linux and OS X systems with the caps-Lock key mapped as a "super-gui" key which is left-windows + right-windows, and then combined with other keys for specific functions.

 

But for most things, yes, I just use the mouse. I even just double clicked letters on the screen in classic99 before reading that it was a feature. It was a nice surprise that it worked. ;)

Link to comment
Share on other sites

I believe so and can verify tomorrow. The routine sets the column then tests the shift and control bits separately. I'd one is depressed, the second is tested. If it too is depressed, the scan loops on those same two bits until one is released.

Nice! That shouldn't be to hard to fix then. And should help me clean up some special cased code around f4 and f=.

 

-M@

Link to comment
Share on other sites

Nice! That shouldn't be to hard to fix then. And should help me clean up some special cased code around f4 and f=.

 

-M@

Here is what I'm using at the moment:

* Test keyboard directly for CTRL and SHIFT combination. Stay within 'loop' if both are depressed.
* Text CTRL key first as it is likely to be pressed first in the combination.
*
NOPS1 LIMI 0
      LI   R12,>0024
      CLR  R0      set
      LDCR R0,3    column
      TB   6   Ctrl Key?
      JEQ  NOPSE
      TB   5   Shift?
      JEQ  NOPSE
      LIMI 2   allow rs232 interrupt asap
      JMP  NOPS1

NOPSE LIMI 2
      RT
Link to comment
Share on other sites

Here is what I'm using at the moment:

* Test keyboard directly for CTRL and SHIFT combination. Stay within 'loop' if both are depressed.
* Text CTRL key first as it is likely to be pressed first in the combination.
*
NOPS1 LIMI 0
      LI   R12,>0024
      CLR  R0      set
      LDCR R0,3    column
      TB   6   Ctrl Key?
      JEQ  NOPSE
      TB   5   Shift?
      JEQ  NOPSE
      LIMI 2   allow rs232 interrupt asap
      JMP  NOPS1

NOPSE LIMI 2
      RT

 

Cool, yep, once you enter NOPS1, you stay on column 3. So an interrupt isn't triggered in my microcontroller. I have written my interrupt handler, such that I could just call it from my main loop and poll. ( Tursi said earlier his PS/2 adapter is polling instead of interrupt driven, so he should have lucked out of this problem ) Learning to use the interrupt driven code has been fun. But I'll have to retire it. I'll take some time Saturday and get that fixed. This will be a small code change on my end, but will require a good deal of testing.

 

-M@

Link to comment
Share on other sites

( Tursi said earlier his PS/2 adapter is polling instead of interrupt driven, so he should have lucked out of this problem )

I want to say "it wasn't luck", but it was. I didn't have enough interrupt pins. ;)

 

You could work around it without any serious impact if you inserted a timer interrupt... you'll still have the fast response of the pin-change interrupt with the resilience of polling without having to change a lot of code?

Link to comment
Share on other sites

Cool, yep, once you enter NOPS1, you stay on column 3. So an interrupt isn't triggered in my microcontroller. I have written my interrupt handler, such that I could just call it from my main loop and poll. ( Tursi said earlier his PS/2 adapter is polling instead of interrupt driven, so he should have lucked out of this problem ) Learning to use the interrupt driven code has been fun.

Yea. I probably don't even need to set the row and column each time through the loop. However, I have been playing with some re-entrant interrupt-driven keyboard routines, and am trying to retain my sanity while testing. ;)

Link to comment
Share on other sites

Yea. I probably don't even need to set the row and column each time through the loop. However, I have been playing with some re-entrant interrupt-driven keyboard routines, and am trying to retain my sanity while testing. ;)

 

I have been able to make my keyboard adapter work with it, but then I noticed another unrelated issue I want to fix today. It wasn't as straight forward to fix the ctrl-shift release feature as I had hoped. It turns out the USB input communication dominates the processing power in the Teensy, unless I use interrupts to handle the TI scans. But I was able to add a little logic so that if no interrupt has been handled in a very brief amount of time, then update the output rows anyway. This did allow me to stop special casing F4 to break out of the TI BASIC program : 10 GOTO 10 and F=, releasing during RESET. They work and release naturally now. I'm not sure how F4 can be read without scanning multiple columns. I don't actually think that is possible, but this same change solved that. I'll take the cleaner code. :)

 

The new bug I found is an issue with contractions that causes things like didn'] if you type fast. I had fixed this in one of my early iterations, but have thoroughly revamped since then, and need to re-fix it. Tursi warned me of this early on :) It can cause you trouble when backspacing and arrowing around as well. These issues are all mechanically possible on the stock 4a keyboard, but unnatural and awkward, so they didn't happen.

 

( I am glad the Geneve has all of this challenging stuff built into it, and just takes serial XT scan codes... that adapter was a piece of cake by comparison. )

 

-M@

Link to comment
Share on other sites

Firmware with updates for the CTRL-SHIFT issue and the other issue are up on the website:

 

http://ti994a.cwfk.net/Downloads.html

 

Once upon a time, my adapter worked quite well with Micro Pinball II, using the 1, 0, and = keys. But that broke a while back. I'm not sure when, but I suspect it broke when I made some other things more correct. Given that the Rave adapter I had as a kid didn't work with Micro Pinball II either ( I had to use the 1 for left flipper, and N for both flippers back then as well. ) I'm going to let that rest for a while.

 

-M@

Link to comment
Share on other sites

I just unraveled the mystery as to why my Geneve sometimes hangs during bootup, and turns out it disapproves of there being no keyboard connected when kicking off MDOS.

 

So be warned if using the Geneve firmware and a KVM or USB switch.

 

-M@

When specifically does this occur and is it consistent? I only ask because I've booted MDOS without a keyboard in the past, most often when I am repairing a Geneve and forget to plug in the keyboard ;)

Link to comment
Share on other sites

Interesting, well, I haven't tested with absolutely no keyboard attached, but when no keyboard is attached to my USB adapter. After loading the last track of System/Sys, the floppy drive access ends, and the screen just stays there on the Loading MDOS... image. It is very consistent.

 

Maybe the Geneve thinks a keyboard is present since a device is attached to the XT keyboard, and attempts the keyboard reset, but my adapter won't ack the reset. I'll experiment with leaving the XT data lines disconnected until after the USB keyboard is detected. Maybe that'll fix'er.

 

-M@

Link to comment
Share on other sites

Interesting, well, I haven't tested with absolutely no keyboard attached, but when no keyboard is attached to my USB adapter. After loading the last track of System/Sys, the floppy drive access ends, and the screen just stays there on the Loading MDOS... image. It is very consistent.

 

Maybe the Geneve thinks a keyboard is present since a device is attached to the XT keyboard, and attempts the keyboard reset, but my adapter won't ack the reset. I'll experiment with leaving the XT data lines disconnected until after the USB keyboard is detected. Maybe that'll fix'er.

 

-M@

Yep, that fixed it. New source pushed to github, and new binary firmware up on my downloads page.

 

Thanks Tim, for chiming in, that I shouldn't expect this behavior. I sort of assumed it was like old PCs in the past that would halt in BIOS startup if the keyboard test failed.

 

Now I can switch the keyboard all I want, even when booting the Geneve... :) worry free. I love it!

 

-M@

Link to comment
Share on other sites

  • 1 month later...

 

once you get it installed you will love it.

 

That part is proving troublesome as my keyboard is one of the older ones and the diode hack was done to it in the middle of the ribbon cable. working on a solution maybe another keyboard.. thinking maybe an adapter is better than soldering everything to the keyboard directly.

Link to comment
Share on other sites

 

That part is proving troublesome as my keyboard is one of the older ones and the diode hack was done to it in the middle of the ribbon cable. working on a solution maybe another keyboard.. thinking maybe an adapter is better than soldering everything to the keyboard directly.

 

i thought about making my own adapter on a board so you could just plug and go, but it still required more soldering with the adapter and so I just soldered direct to the contacts.

Link to comment
Share on other sites

For some reason I thought the motherboard keyboard connector was for a different spacing, but once I got home, it is the standard 0.1 inch / 2.54mm spacing. The difference is that the header on the TI motherboard has longer pins than standard headers.

 

The TI keyboard connector will connect to the shorter headers. And the shorter http://smile.amazon.com/Hilitchi-2-54mm-Dupont-Connector-Housing/dp/B01512L8TS/ref=sr_1_10?s=electronics&ie=UTF8&qid=1461729883&sr=1-10&keywords=2.54mm+dupontconnectors will connect to the motherboard's long header, just doesn't need to go all the way on. You could get a pre-fab set like: http://smile.amazon.com/uxcell-Female-Jumper-Cable-Wires/dp/B00D7SDDLU/ref=sr_1_1?s=electronics&ie=UTF8&qid=1461730590&sr=1-1&keywords=2.54mm+connector+female+long

 

I don't know if there are things like the dupont connectors that fit the longer headers better, but that might not be necessary.

 

-M@

Link to comment
Share on other sites

Well I got everything working by

 

- grabbing a spare keyboard without the diode mod on it

- soldering the ribbon cable as described in the instructions

- resoldering the ones that fell off as soon as i moved it :)

- adding some mounting tape to reenforce the cable to the bottom of the keyboard

 

plugged in and it works! BUT without the diode things act weird if caps-lock is on on the USB keyboard and alpha-lock is on on the TI keyboard.. Everything acts like you have the FCTN key down.. I don't have the diode listed in the mod.. Perhaps I'll swipe the one out of my other hacked keyboard.

 

Greg

Link to comment
Share on other sites

You can most likely use a pretty broad range of diodes fro the alpha-lock fix on the TI keyboard... It doesn't change quickly, so it is ok if it is slow. I believe the requirement is just that it is able to block anything below 6V to be safe. The switches on the TI keyboard engage pull down resisters on the motherboard.

 

But this is great confirmation that yes, my adapter chokes without this mod ( unless the alpha-lock is kept off ) -- I'll have to update my project page to declare it a pre-requisite for optimal behavior.

 

Somewhere here... http://atariage.com/forums/topic/242504-joystick-up-alpha-lock-fix-for-stackpole-keyboard/?hl=%2Balpha+%2Block&do=findComment&comment=3316887 <- the mainbyte link, and pictures of how to cover the stackpole-keyboard that wasn't covered by the mainbyte link.

 

Oh, something else interesting here, is how Greg had the alpha-lock fix in cable from the keyboard to the motherboard. Which I didn't see documented anywhere, but that looks like a vendor independent approach ( unless you are trying to use my keyboard adapter :) as well )

 

-M@

  • Like 1
Link to comment
Share on other sites

If an adapter is made to go between the ti keyboard and the mobo, you could just include the diode there before the usb adapter in the circuit no?

 

Greg

 

Yep! definitely. I didn't know that until you sent me the photo of how you had your diode wired up, but it is obvious now. Maybe I can prototype an adapter by Saturday...

 

-M@

  • Like 1
Link to comment
Share on other sites

Well I got everything working by

 

- grabbing a spare keyboard without the diode mod on it

- soldering the ribbon cable as described in the instructions

- resoldering the ones that fell off as soon as i moved it :)

- adding some mounting tape to reenforce the cable to the bottom of the keyboard

 

plugged in and it works! BUT without the diode things act weird if caps-lock is on on the USB keyboard and alpha-lock is on on the TI keyboard.. Everything acts like you have the FCTN key down.. I don't have the diode listed in the mod.. Perhaps I'll swipe the one out of my other hacked keyboard.

 

Greg

 

Ok I just grabbed a diode out of my stock and stuck it on and it works good :) so I'm 100% working and reassembled at this point..

 

Greg

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...