Jump to content

Photo

USB Keyboard Adapter w/Arduino style components


106 replies to this topic

#51 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • Topic Starter
  • 1,260 posts
  • Location:Beaverton, OR

Posted Mon Feb 8, 2016 1:16 AM

Just to share, Shift838 and I are seeing an issue with the ALPHA-LOCK scanning on the adapter. 

 

He's not getting uppercase in Super Mass Transfer / TIMXT. And I'm getting intermittent lowercase letters in fbForth editor and turboforth editor.

 

So, I'll be working on a firmware fix for that. A temporary work-around is to set the ALPHA-LOCK on your TI keyboard. 

 

It could be worse:

 

Attached File  Benq_broken_keyboard.JPG   62.28KB   2 downloads

 

-M@



#52 Shift838 OFFLINE  

Shift838

    Stargunner

  • 1,951 posts
  • SHIFT838
  • Location:Texas

Posted Mon Feb 8, 2016 9:11 AM

It's still leaps and bounds above the TI keyboard.  I learned to love the TI keyboard but the USB keyboard on the TI make for a hell of a lot better experience!



#53 InsaneMultitasker OFFLINE  

InsaneMultitasker

    Stargunner

  • 1,731 posts

Posted Mon Feb 8, 2016 10:39 AM

Just to share, Shift838 and I are seeing an issue with the ALPHA-LOCK scanning on the adapter. 

 

He's not getting uppercase in Super Mass Transfer / TIMXT. And I'm getting intermittent lowercase letters in fbForth editor and turboforth editor.

 

-M@

If you need to look at the direct keyboard scan routine from TIMXT, just let me know and I'll locate the source for you to inspect.



#54 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • Topic Starter
  • 1,260 posts
  • Location:Beaverton, OR

Posted Mon Feb 8, 2016 1:48 PM

Thanks, I'll keep that in mind if I get stuck. :)   I did something weird in this area, and I'll have to check my source history to see what problem I was trying to solve. Since I have re-written the other half of the system, I will try going back to what I think is the straight forward model for responding to the TI keyboard columns. 

 

One thing I don't do, is handle multiple columns (output pins from the 9901) active at once. That seemed outside the bounds of how the TI keyboard was meant to work. 

 

-M@



#55 InsaneMultitasker OFFLINE  

InsaneMultitasker

    Stargunner

  • 1,731 posts

Posted Mon Feb 8, 2016 2:26 PM

Sounds good.  I can think of a handful of programs that scan CRU bits to detect multiple special keys, such as holding SHIFT and FCTN together (i.e. Fast Term).  Maybe some games look for two keys to handle diagonal moves?

 

The outliers are often games, terminal emulators, and programs with unique routines used to improve speed and/or functionality.



#56 Tursi OFFLINE  

Tursi

    River Patroller

  • 4,828 posts
  • HarmlessLion
  • Location:BUR

Posted Mon Feb 8, 2016 7:04 PM

One thing I don't do, is handle multiple columns (output pins from the 9901) active at once. That seemed outside the bounds of how the TI keyboard was meant to work.


It's actually not possible to get multiple columns at once (except for Alpha Lock which is direct). The column select is done via a 1-of-8 decoder so only one line can ever be active at a time. (I looked at using that connection to transfer data once, and was disappointed to see that ;) ).

#57 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • Topic Starter
  • 1,260 posts
  • Location:Beaverton, OR

Posted Mon Feb 8, 2016 8:26 PM

It's actually not possible to get multiple columns at once (except for Alpha Lock which is direct). The column select is done via a 1-of-8 decoder so only one line can ever be active at a time. (I looked at using that connection to transfer data once, and was disappointed to see that ;) ).

 

Thanks! That's why my Teensy code looks like it does... All of the columns are in an if-else chain except the alpha-lock. I have studied the schematic on TI TECH PAGES, and come to that conclusion before, but I need to go add some notes/comments to my code so I don't keep doubting it. 

 

-M@



#58 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • Topic Starter
  • 1,260 posts
  • Location:Beaverton, OR

Posted Mon Feb 8, 2016 8:58 PM

Thinking out loud... so if you are writing a scan routine, you only have to turn of P5 on the 9901 if you want to look for FCTN, some numbers, and UP on the joysticks. The rest of the time it can be left on, and if row 4 is LOW, the alpha-lock must be on. 

 

My Teensy code is responding to change. And so if a routine is leaving the P5 high, while stepping through the decoded columns, and I'm momentarily turning off the alpha-lock row when FCTN, 2, 3, 4, 5 or 1 are not pressed, just before I then look to see if P5 is on, and set it back on.   ( LOW == on thanks to the pull-up-resisters )    (There is no way that sentence passes a grammar checker.)

 

Fast reading routines can actually see this, and I get TtHhIiSs BbEeHhavior

 

That's my working theory at the moment.  



#59 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • Topic Starter
  • 1,260 posts
  • Location:Beaverton, OR

Posted Thu Feb 18, 2016 4:58 PM

I implemented a solution for the theory above, and didn't see any difference in behavior, but at least now I believe that part of the code is more correct. Then I stewed over things for a week. And remembered some really stupid code around FCTN_EQUALS, I deleted that and 'TtHhIiSs' behavior went away. Using TIMXT for a while, that seemed to work just fine as well. ( Althought that wasn't failing for me previously either. )   The firmware changes are on my website, and up in the git repository...  

 

Along the way, the 'programming' port on the Teensy is a little surface mount USB micro connector. Chris was able to break this right off the board. There is no through-hole anchor on this connector. So be gentle.  Hopefully the need for post-installation use of the programming port will become obsolete before too much longer. 

 

-M@



#60 arcadeshopper OFFLINE  

arcadeshopper

    River Patroller

  • 2,563 posts
  • Location:Portland, Oregon USA

Posted Wed Feb 24, 2016 11:11 PM

Attached File  20160224_210031.jpg   69.43KB   2 downloads

 parts starting to arrive  :D



#61 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • Topic Starter
  • 1,260 posts
  • Location:Beaverton, OR

Posted Thu Feb 25, 2016 12:30 AM

My favorite part of this, is sticking a 64k 96Mhz processor inside the TI-99/4a just to translate keyboard state :)  

 

I have some extra boards printed, that I could make available. Also I have shared the design on OSHpark, https://oshpark.com/...ojects/tlkbFvs3

 

-M@



#62 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • Topic Starter
  • 1,260 posts
  • Location:Beaverton, OR

Posted Fri Feb 26, 2016 9:04 PM

To set expectations, I ordered 3 UHS mini shields from Duinopeak on 2016-01-31, and they just arrived today, 26 days later. 

 

My previous experience was only 15 days from them. So... it is more variable than I imagined.

 

-M@



#63 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • Topic Starter
  • 1,260 posts
  • Location:Beaverton, OR

Posted Sun Mar 6, 2016 3:40 PM

Attached File  IMG_20160306_123422.jpg   115.75KB   1 downloads

 

I've succeeded today in getting basic issue laden functionality of my same TI 99 USB Keys adapter board reprogrammed to output XT scan codes for the Geneve. It should be generic enough to work for any XT application, but I'll probably not ever get around to testing that. 

 

My goal here, is to get my PC, Mac, 4a, and Geneve 9640 all sharing the same keyboard ( I only have one desk, and need to share it ) 

 

There are plenty of issues still. But if anyone is interested, the github project page is: https://github.com/j...2/teensyUSBtoXT

 

-M@



#64 Ksarul OFFLINE  

Ksarul

    River Patroller

  • 4,217 posts

Posted Sun Mar 6, 2016 5:53 PM

I definitely like this idea. . .XT keyboards are still out there, but they are getting a lot harder to find now.



#65 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • Topic Starter
  • 1,260 posts
  • Location:Beaverton, OR

Posted Sun Mar 13, 2016 7:39 PM

I've managed to get the USB to XT / Geneve firmware working to a very smoothly. XT keyboard protocol is soo much easier than the TI-99/4a's matrix keyboard model. 

I doubt that I have Print Screen, Scroll Lock, and Break correctly mapped, but I believe all the rest are properly mapped. 

 

The pre-compiled firmware and project page are here: http://ti994a.cwfk.net/UsbGeneve.html

Source is up on github: https://github.com/j...2/teensyUSBtoXT

 

----  

 

Now, back to the TI 99 USB Keys variety...  Chris pointed out that the '?' isn't working in the newest TIMXT when my adapter is used.  It turns out none of the keys that require transitioning a 'shift'-'something' to a 'fctn'-'something-else' work (tilde, pipe, question, squirrelly-brackets, and double-quotes).  Manually pressing 'alt'-'i' will still product a '?'.  I suspect there isn't enough time between my release of the 'shift' and the next scan, such that TIMXT is seeing 'shift'-'fctn'-'i'.  Luckily on the TI keyboard, that yields nothing, instead of a '?' or capital 'i'  

 

Hopefully I can fix that without much restructuring.

 

-M@



#66 InsaneMultitasker OFFLINE  

InsaneMultitasker

    Stargunner

  • 1,731 posts

Posted Mon Mar 14, 2016 3:28 PM

I've managed to get the USB to XT / Geneve firmware working to a very smoothly. XT keyboard protocol is soo much easier than the TI-99/4a's matrix keyboard model. 

I doubt that I have Print Screen, Scroll Lock, and Break correctly mapped, but I believe all the rest are properly mapped. 

 

The pre-compiled firmware and project page are here: http://ti994a.cwfk.net/UsbGeneve.html

Source is up on github: https://github.com/j...2/teensyUSBtoXT

 

----  

 

Now, back to the TI 99 USB Keys variety...  Chris pointed out that the '?' isn't working in the newest TIMXT when my adapter is used.  It turns out none of the keys that require transitioning a 'shift'-'something' to a 'fctn'-'something-else' work (tilde, pipe, question, squirrelly-brackets, and double-quotes).  Manually pressing 'alt'-'i' will still product a '?'.  I suspect there isn't enough time between my release of the 'shift' and the next scan, such that TIMXT is seeing 'shift'-'fctn'-'i'.  Luckily on the TI keyboard, that yields nothing, instead of a '?' or capital 'i'  

 

Hopefully I can fix that without much restructuring.

 

-M@

Recently I added a "ctrl-shift" combo to TIMXT. It's purpose is to immediately stop the display interpreter, effectively pausing the screen.  It first tests whether the ctrl key is depressed then tests the SHIFT key.  If both are depressed, it waits until one or the other is released.   Will something like this function with your adapter? 

 

I love the idea of using a similar adapter with the Geneve.



#67 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • Topic Starter
  • 1,260 posts
  • Location:Beaverton, OR

Posted Mon Mar 14, 2016 10:39 PM

Recently I added a "ctrl-shift" combo to TIMXT. It's purpose is to immediately stop the display interpreter, effectively pausing the screen.  It first tests whether the ctrl key is depressed then tests the SHIFT key.  If both are depressed, it waits until one or the other is released.   Will something like this function with your adapter? 

 

I love the idea of using a similar adapter with the Geneve.

 

I have been surprised that I couldn't google up one on amazon or something. People love their XT keyboards though, and use them on newer computers, instead of the other way around. I just need to find the right sized project box to stick the adapter in, so I can mount it to the side of my PEB. 

 

Both TI and Geneve adapter firmware should handle key combo like ctrl-shift without any issue.  Pressing and releasing them individually should be fine. 

 

-M@



#68 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • Topic Starter
  • 1,260 posts
  • Location:Beaverton, OR

Posted Mon Mar 14, 2016 10:42 PM

PSA: ArcadeShopper noticed I had an incorrect link to the 2x8 16pin right angle 2.54mm header in the project page parts list.  It was a link to a 2.00mm part, which just wouldn't work. 

 

I have corrected the link. 

 

-M@



#69 Tursi OFFLINE  

Tursi

    River Patroller

  • 4,828 posts
  • HarmlessLion
  • Location:BUR

Posted Tue Mar 15, 2016 2:04 AM

I suspect there isn't enough time between my release of the 'shift' and the next scan, such that TIMXT is seeing 'shift'-'fctn'-'i'.  Luckily on the TI keyboard, that yields nothing, instead of a '?' or capital 'i'


I worked around this on my keyboard adapter by making shift do nothing by itself, it did not get relayed to the TI. (For the very few cases where I needed a real shift key, such as RAMdisk boot bypass, I mapped the Windows key instead). That made life a lot easier, I just handled the shift key as a meta key myself and had separate lookup tables for shifted versus not shifted.

#70 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • Topic Starter
  • 1,260 posts
  • Location:Beaverton, OR

Posted Tue Mar 15, 2016 6:42 PM

I worked around this on my keyboard adapter by making shift do nothing by itself, it did not get relayed to the TI. (For the very few cases where I needed a real shift key, such as RAMdisk boot bypass, I mapped the Windows key instead). That made life a lot easier, I just handled the shift key as a meta key myself and had separate lookup tables for shifted versus not shifted.


Ah, so that is what you meant earlier by the 'Windows' key being a 'real shift'. That is a very practical approach. Thanks for the tip.

I already special case this handful of keystrokes. I'll see if I can do something more localized (I am required to be stubborn first for at least a little while.) But if I fail, that sounds like a good fallback. Although, part of me would hate to ask someone to use the windows key on a TI. I don't even use them on a windows machine.

#71 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • Topic Starter
  • 1,260 posts
  • Location:Beaverton, OR

Posted Tue Mar 15, 2016 10:46 PM

Ok, in my head the code for '?': was releasing shift, pressing fctn, and then pressing I, but it was never releasing shift.   Once I fixed that TIMXT and the '?' work. 

 

I think I need to proof-read my code. I'm actually surprised it worked in so many other programs. 

 

-M@



#72 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • Topic Starter
  • 1,260 posts
  • Location:Beaverton, OR

Posted Wed Mar 16, 2016 12:02 AM

I have posted new firmware for the TI 99 USB Keys adapter here: http://ti994a.cwfk.net/Downloads.html

 

Fixes the issue for ~, {, }, |, ?, and ".  I had already done the right thing for _

 

I've tested this with TIMXT, and XB2.7, and fbForth, and TurboForth... 

 

-M@



#73 jedimatt42 OFFLINE  

jedimatt42

    Stargunner

  • Topic Starter
  • 1,260 posts
  • Location:Beaverton, OR

Posted Wed Mar 16, 2016 11:15 PM

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 Teensy. 

 

This shouldn't be a problem on the Geneve adapter, since the hardware inside the Geneve does all of that. But I haven't tested that exactly, as I don't have a serial card in the Geneve system.  

-M@



#74 --- Ω --- OFFLINE  

--- Ω ---

    TI-Runner

  • 10,618 posts

Posted Wed Mar 16, 2016 11:27 PM

Have you looked at Tursi's code?  I'm using a PS/2 adapter designed by him.  When using the WINDOWS & CONTROL buttons it stops the display dead in it's tracks until released and works flawlessly.



#75 Tursi OFFLINE  

Tursi

    River Patroller

  • 4,828 posts
  • HarmlessLion
  • Location:BUR

Posted Thu Mar 17, 2016 12:38 AM

Although, part of me would hate to ask someone to use the windows key on a TI. I don't even use them on a windows machine.


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




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users