Author Topic: [TMK] Alternative Controller for HHKB  (Read 389884 times)

0 Members and 1 Guest are viewing this topic.

Offline hasu

  • Thread Starter
  • Posts: 3131
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Alternative Controller for HHKB
« Reply #600 on: Wed, 22 November 2017, 12:17:56 »
Apologies if this has already been asked but is there a "reset"  key on the tmk gui editor? Would love to be able to soft reset my HHKB without having to hard reset with the red button everytime I want to flash a new hex. Would be great to just be able to hit a key on the board to go into a flashable state.



unfortunately soft reset isn't  supported in keymap editor yet. I'll add that soon later.
You can use 'magic command' with LSHIFT+RSHIFT+Puase if your keymap has those keys.
https://github.com/tmk/tmk_keyboard#magic-commands
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline rabbitl

  • Posts: 1
Re: Alternative Controller for HHKB
« Reply #601 on: Fri, 29 December 2017, 00:25:41 »
I've received hasu's Controller(with BT), works perfectly for me

Offline vegs

  • Posts: 605
Re: Alternative Controller for HHKB
« Reply #602 on: Wed, 24 January 2018, 03:49:39 »
I got the controller for my Pro 1 yesterday. Works like a charm. Easy to install and program :thumb:
stop buying so much stuff

Offline hasu

  • Thread Starter
  • Posts: 3131
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Alternative Controller for HHKB
« Reply #603 on: Fri, 16 March 2018, 05:08:01 »
Firmware is updated a little for Bluetooth controller. Check this post.

https://geekhack.org/index.php?topic=71517.msg2578237#msg2578237
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline ttezz

  • Posts: 2
Re: Alternative Controller for HHKB
« Reply #604 on: Sun, 15 April 2018, 00:35:36 »
hasu, thanks always, you won't be able to image how your works changed my life..
I just can't work with any other keyboards any more. you have full control of my life .....
I'm planning to buy one more controller, before that, I want to ask you something.

how many pairing info can the board save? & is there a way to switch between device without turning off the host bluetooth?
and how the bluetooth connection priority works?

I can switch device when I turn off the host bluetooth.

But I just want to know how many connection does the board can save.

and is there a way to switch device, without turning off the computer bluetooth?

In windows, to turn off the keyboard bluetooth, I have to delete the pairing or turn off entire bluetooth..

and ,,,

I don't care how much it cost, I would pay 1000 dollar, seriously

If you could upgrade the board just the bluetooth battery life and, this device switching function. and usb mini -> usb c....
« Last Edit: Sun, 15 April 2018, 00:42:22 by ttezz »

Offline hasu

  • Thread Starter
  • Posts: 3131
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Alternative Controller for HHKB
« Reply #605 on: Sun, 15 April 2018, 18:29:21 »
The bluetooth module can store last eight pairing infos. Unfortunately I could not find how to switch between devices without disconnecting current device explicitly as you described. The module always tries to connect device connected last time automatically if it is not available second last one and so on.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline tex_live_utility

  • Posts: 924
  • MX brown apologist
    • twitch.tv/salt_rock_lamp
Re: Alternative Controller for HHKB
« Reply #606 on: Tue, 24 April 2018, 18:16:59 »
.
« Last Edit: Tue, 24 April 2018, 18:22:47 by tex_live_utility »
Discord: salt rock lamp#0679 | Reddit: /u/nerdponx | Deskthority: autoload -Uz | Keebtalk: salt_rock_lamp
Twitch: salt_rock_lamp | YouTube: https://www.youtube.com/channel/UCd7YXZjilUutJ6ShZWrvQtg | Instagram: @salt_rock_keyboards


Offline hasu

  • Thread Starter
  • Posts: 3131
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Alternative Controller for HHKB
« Reply #607 on: Tue, 24 April 2018, 18:50:12 »
.

Deleting post are not helpful at all :(

How did you resolve your problem? Share your problem and solution. It is what makes this community helpful and  great.


Quote from notification mail.
Quote
Are there any specific instructions for using Atmel FLIP I should know about? I have Atmega32u4 selected, I generated a HEX from the online tool, I pressed the reset button on the back, but I'm getting an error that I could not read from or write to the USB device. I believe I have the correct driver installed because it shows up in the Device Manager as a libusb-win32 device.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline devoi

  • Posts: 38
  • Location: MA
Re: Alternative Controller for HHKB
« Reply #608 on: Wed, 23 May 2018, 13:51:48 »
has there been a working example of changing the actuation distance with the four calibration points? I'm very interested in doing this but I'm a bit frightened of messing up whatever value is stored in the BU9831's EEPROM. Even though the FC660C uses a very similar method (if not the same method) for its actuation distance, I'm sure that the particular addresses and instructions vary a bit.

Offline hasu

  • Thread Starter
  • Posts: 3131
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Alternative Controller for HHKB
« Reply #609 on: Wed, 23 May 2018, 14:11:47 »
No. Actuation point in HHKB cannot be changed from controller and you have to access the digipot from test points on switch PCB as you say. I didn't try to work with it and don't have any info about it except for ones on the first post. Read datasheet and write program to control the digipot.
« Last Edit: Wed, 23 May 2018, 14:14:02 by hasu »
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline joric

  • Posts: 133
Re: Alternative Controller for HHKB
« Reply #610 on: Mon, 05 November 2018, 23:56:31 »
An interesting nrf51-based hhkb pro 2 controller has arrived on taobao, claims several weeks on a single charge. @hasu what do you think https://geekhack.org/index.php?topic=71517.msg2676544#msg2676544

Offline hasu

  • Thread Starter
  • Posts: 3131
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Alternative Controller for HHKB
« Reply #611 on: Tue, 06 November 2018, 00:17:00 »
An interesting nrf51-based hhkb pro 2 controller has arrived on taobao, claims several weeks on a single charge. @hasu what do you think https://geekhack.org/index.php?topic=71517.msg2676544#msg2676544

Seems promising. It would be great if they can publish firmware source code and hardware design. Did you contact them?

Buy some and send me one!
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline joric

  • Posts: 133
Re: Alternative Controller for HHKB
« Reply #612 on: Tue, 06 November 2018, 08:07:32 »
Nope, I'm not in China and I haven't ever used Taobao also they want 20 people to start manufacturing. Maybe ask someone from China.

Offline joric

  • Posts: 133
Re: Alternative Controller for HHKB
« Reply #613 on: Thu, 29 August 2019, 03:50:21 »
Please help with the HHKB matrix code on nrf52. I'm getting ghosting or something, each keystroke is followed by a sequence of symbols from the other part of the matrix.

From what I see I don't really need a precision timer because there's no V-USB interrupts, I'm debugging on hardware USB, it's way less CPU-consuming.
I could do everything just busywaiting with delays without measuring time intervals.
The whole matrix is just 60*20us = 1200us ? 1.2ms ? Maybe double that but still, 2 ms is nothing. I can just do a critical section or something.

The "ghosting" is very specific. Each keystroke is followed by few '2's, the length of the sequence depends of how long I hold the key, it also autorepeats.
E.g. if I type qwerty I get something like q222w222e22r2222t222y222222. If I type '2' I get 2qqqq or something.

Maybe somebody knows what causes that?

See this problem in details with the code https://github.com/joric/nrfmicro/wiki/HHKB-BLE

Also video


« Last Edit: Fri, 30 August 2019, 04:58:15 by joric »

Offline hasu

  • Thread Starter
  • Posts: 3131
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Alternative Controller for HHKB
« Reply #614 on: Thu, 29 August 2019, 17:28:33 »
I can't remember exactly all of what I tweeked the code for timing of matrix scan, but that code section is time critical and you have to guard that section with some method or other.

I don't know why you refer to V-USB but I don't think V-USB is not related here. ATMega32u4 on my controller uses also hardware USB too. Note that even with hardware USB it interrupts user code occasionally at least with ATMega32u4 and I almost belive your are interrupted by NRF. You have to check it with debugger or oscilloscope.

Yes, just guard that code as critical section.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline hasu

  • Thread Starter
  • Posts: 3131
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Alternative Controller for HHKB
« Reply #615 on: Thu, 29 August 2019, 17:47:22 »
This is what you are working? If so code section below is the critical section. It can't be interrupted and you have to read KEY_STATE within 20us after KEY_ENABLE.

https://github.com/joric/qmk_firmware/tree/nrf52-hhkb

https://github.com/joric/qmk_firmware/blob/194439057dff81d71c16c73b5998d7de047c8823/keyboards/hhkb_ble/rev1/matrix.c#L138-L169
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline yangdigi

  • Posts: 79
  • Location: China
Re: Alternative Controller for HHKB
« Reply #616 on: Tue, 03 September 2019, 03:35:49 »
Please help with the HHKB matrix code on nrf52. I'm getting ghosting or something, each keystroke is followed by a sequence of symbols from the other part of the matrix.

From what I see I don't really need a precision timer because there's no V-USB interrupts, I'm debugging on hardware USB, it's way less CPU-consuming.
I could do everything just busywaiting with delays without measuring time intervals.
The whole matrix is just 60*20us = 1200us ? 1.2ms ? Maybe double that but still, 2 ms is nothing. I can just do a critical section or something.

The "ghosting" is very specific. Each keystroke is followed by few '2's, the length of the sequence depends of how long I hold the key, it also autorepeats.
E.g. if I type qwerty I get something like q222w222e22r2222t222y222222. If I type '2' I get 2qqqq or something.

Maybe somebody knows what causes that?

See this problem in details with the code https://github.com/joric/nrfmicro/wiki/HHKB-BLE

Also video

The magic 2. NOT any other keys, only KEY 2.
I've come across a few times with it.
When reading key state is not stable, the magic 2 comes.
But not like your video shows that several 2 come together, I just get one extra KEY 2 a time.

Offline joric

  • Posts: 133
Re: Alternative Controller for HHKB
« Reply #617 on: Tue, 03 September 2019, 05:57:42 »
The magic 2. NOT any other keys, only KEY 2.
I've come across a few times with it.
When reading key state is not stable, the magic 2 comes.
But not like your video shows that several 2 come together, I just get one extra KEY 2 a time.
Ohh yangdigi! Well, thanks, at least I know somebody stumbled upon it, what you did, different timings? I didn't have any problems on pro micro (32u4) personally but I've used 5v one and nrfmicro is 3.3v maybe it needs different timings, gotta look at your firmware.

BTW got your controller today, very cool, I've just recently discovered Mass Storage bootloader on Atmegas (https://github.com/joric/lufa/tree/promicro/Bootloaders/MassStorage) and it still looks like magic to me. Also the layout editing site, I don't want to edit and compile firmwares anymore.

Also that god damned miniusb. Tried to replace it with microusb, no luck, this one uses incompatible (thru-hole) footprint =( hope it needs less charging than before, I don't want to keep microusb cable on the table. What about type-c or microusb revisions? Microusb fits just fine (see https://imgur.com/a/aZIS1).

Anyway you've gone way further than me. I've had plans on nRFMicro and PCBA assembly (possibly Elecrow) but I don't think there's a demand in comparison with the HHKB controller.
« Last Edit: Tue, 03 September 2019, 10:32:00 by joric »

Offline yangdigi

  • Posts: 79
  • Location: China
Re: Alternative Controller for HHKB
« Reply #618 on: Tue, 03 September 2019, 09:04:04 »
The magic 2. NOT any other keys, only KEY 2.
I've come across a few times with it.
When reading key state is not stable, the magic 2 comes.
But not like your video shows that several 2 come together, I just get one extra KEY 2 a time.
Ohh yangdigi! Well, thanks, at least I know somebody stumbled upon it, what you did, different timings? I didn't have any problems on pro micro (32u4) personally but I've used 5v one and nrfmicro is 3.3v maybe it needs different timings, gotta look at your firmware. Got your controller today, very cool, I've just recently discovered Mass Storage bootloader on Atmegas (https://github.com/joric/lufa/tree/promicro/Bootloaders/MassStorage) and it still looks like magic to me. Also the layout editing site, I don't want to edit and compile firmwares anymore. But what's the reason for the flipped battery connector, was it, like, random?

Show Image


Also that god damned miniusb. Tried to replace it with microusb, no luck, this one uses incompatible (thru-hole) footprint =( hope it needs less charging than before, I don't want to keep microusb cable on the table. What about type-c or microusb revisions? Microusb fits just fine (see https://imgur.com/a/aZIS1).

Anyway you've gone way further than me. I've had plans on nRFMicro and PCBA assembly (possibly Elecrow) but I don't think there's a demand in comparison with the HHKB controller.

My first battery that I got from a keyboard is as what I use. So I just keep it with all my boards and batteries I bought.
Here is USB Type-C for HHKB. I don't want to destroy my case, so I make a daughter board to hole type-c.
225600-0
225602-1

About magic 2.
One time was that my battery might touch the hhkb board. And when I woke up the keybaord by pressing a key, it gave me an extra KEY 2.
Another time was that if I used 3.3v for MCU but VBAT for HHKB board,  it did not work correctly and sometimes gave me a 2.
But, with 3.3V for both MCU and HHKB, it already works without any problems for months.

Offline joric

  • Posts: 133
Re: Alternative Controller for HHKB
« Reply #619 on: Wed, 04 September 2019, 07:59:07 »
Any chance to get that USB-C raiser board? Kicad project or something? Why it's so crowded, I assumed it needs a couple of 5.1k resistors on CC pins just to get recognized as an USB device and that's about it?
« Last Edit: Wed, 04 September 2019, 08:03:16 by joric »

Offline yangdigi

  • Posts: 79
  • Location: China
Re: Alternative Controller for HHKB
« Reply #620 on: Sat, 14 September 2019, 07:26:14 »
Please help with the HHKB matrix code on nrf52. I'm getting ghosting or something, each keystroke is followed by a sequence of symbols from the other part of the matrix.

From what I see I don't really need a precision timer because there's no V-USB interrupts, I'm debugging on hardware USB, it's way less CPU-consuming.
I could do everything just busywaiting with delays without measuring time intervals.
The whole matrix is just 60*20us = 1200us ? 1.2ms ? Maybe double that but still, 2 ms is nothing. I can just do a critical section or something.

The "ghosting" is very specific. Each keystroke is followed by few '2's, the length of the sequence depends of how long I hold the key, it also autorepeats.
E.g. if I type qwerty I get something like q222w222e22r2222t222y222222. If I type '2' I get 2qqqq or something.

Maybe somebody knows what causes that?

See this problem in details with the code https://github.com/joric/nrfmicro/wiki/HHKB-BLE

Also video

I've got a board and took a quick test with your code.
matrix.c 129 to 131.
Code: [Select]
            //if (matrix_prev[row] & (1<<col)) {
                KEY_PREV_ON();
            //}
The keys should work without "222"  problem now.
Hope this helps.

Offline hasu

  • Thread Starter
  • Posts: 3131
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Alternative Controller for HHKB
« Reply #621 on: Sat, 14 September 2019, 19:12:13 »
I'm almost sure that code is needed for reliabble key sensing from my research and understandings, it is needed to realize key hysteresis.

I've got a board and took a quick test with your code.
matrix.c 129 to 131.
Code: [Select]
            //if (matrix_prev[row] & (1<<col)) {
                KEY_PREV_ON();
            //}
The keys should work without "222"  problem now.
Hope this helps.

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline nathanchere

  • Posts: 493
Re: Alternative Controller for HHKB
« Reply #622 on: Wed, 30 October 2019, 12:00:10 »
My first battery that I got from a keyboard is as what I use. So I just keep it with all my boards and batteries I bought.
Here is USB Type-C for HHKB. I don't want to destroy my case, so I make a daughter board to hole type-c.
(Attachment Link)
(Attachment Link)

Is there any plan to either sell through something like kbdfans or at least run a group buy? I would be all over this

Offline joric

  • Posts: 133
Re: Alternative Controller for HHKB
« Reply #623 on: Wed, 11 December 2019, 03:26:54 »
I'm almost sure that code is needed for reliabble key sensing from my research and understandings, it is needed to realize key hysteresis.
I haven't really tried the new code yet, still waiting for the new nRFMicro revision with an extra mosfet on board.
Just wondering can we expect a teardown of the new HHKB 2019 models? Have you got your hands on one of those? )

Here is USB Type-C for HHKB. I don't want to destroy my case, so I make a daughter board to hole type-c.
Huh I just realized the USB-C riser board is not that large, it's about the size of USB-C plus a couple of 5.1K CC pulldowns.
Considering we got a bunch of all new all USB-C HHKB models yesterday, any chance of getting this board opensourced on github?
The footrpring must be tricky, considering MiniUSB has through-hole design (not sure what's underneath, don't want to desolder it).

Upd. I've also made an YDKB USB-C riser board today: https://github.com/joric/usb-c

Not tested yet, so no warranty whatsoever.
« Last Edit: Tue, 14 January 2020, 11:45:21 by joric »

Offline myaccount

  • Posts: 1
Re: Alternative Controller for HHKB
« Reply #624 on: Mon, 30 December 2019, 02:30:23 »
So, I searched the thread and the forums...

Can this be used with a HHKB Lite 2; PD-KB200W/U ?
HHKB Lite 2 PD-KB200W/U for 15+(?) years.

Offline hasu

  • Thread Starter
  • Posts: 3131
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Alternative Controller for HHKB
« Reply #625 on: Mon, 30 December 2019, 21:05:37 »
No, this controller doesn't support the keyboard.

So, I searched the thread and the forums...

Can this be used with a HHKB Lite 2; PD-KB200W/U ?

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline joric

  • Posts: 133
Re: Alternative Controller for HHKB
« Reply #626 on: Tue, 14 January 2020, 11:44:59 »
The keys should work without "222"  problem now.
Hope this helps.

Nope, looks like it's something else. Probably timing is a bit off, need more testing.
On an unrelated note, could you please share your schematics and PCB design for the USB-C riser board for the YDKB HHKB BLE? It seems pretty complicated, couldn't figure out what is that 3.0V pin (3V looks like logic level but what does it do?) Why there's a 4 pin header but only 3 pins is used? See https://github.com/joric/usb-c/wiki

Offline yangdigi

  • Posts: 79
  • Location: China
Re: Alternative Controller for HHKB
« Reply #627 on: Wed, 15 January 2020, 06:49:58 »
The keys should work without "222"  problem now.
Hope this helps.

Nope, looks like it's something else. Probably timing is a bit off, need more testing.
On an unrelated note, could you please share your schematics and PCB design for the USB-C riser board for the YDKB HHKB BLE? It seems pretty complicated, couldn't figure out what is that 3.0V pin (3V looks like logic level but what does it do?) Why there's a 4 pin header but only 3 pins is used? See https://github.com/joric/usb-c/wiki

share url: https://pan.baidu.com/s/1GRVWRTVLLEIGZ9QZkFz1gg 
pswd: mnyy

Offline joric

  • Posts: 133

Offline joric

  • Posts: 133
Re: Alternative Controller for HHKB
« Reply #629 on: Mon, 09 March 2020, 10:21:21 »
share url

What bootloader are you using for the YDKB controller, btw? I have this
but it needs erasing the files before updating them, not very handy:

https://redd.it/c886jv

https://github.com/joric/lufa/tree/promicro/Bootloaders/MassStorage

https://github.com/abcminiuser/lufa/issues/148

« Last Edit: Mon, 09 March 2020, 10:24:20 by joric »

Offline yangdigi

  • Posts: 79
  • Location: China
Re: Alternative Controller for HHKB
« Reply #630 on: Tue, 17 March 2020, 22:50:57 »
share url

What bootloader are you using for the YDKB controller, btw? I have this
but it needs erasing the files before updating them, not very handy:

https://redd.it/c886jv

https://github.com/joric/lufa/tree/promicro/Bootloaders/MassStorage

https://github.com/abcminiuser/lufa/issues/148


The virtual drive should have as more free space as the bin file.
Windows needs this to determine whether you can replace the file.

Offline Kyuroko

  • Posts: 4
Re: [TMK] Alternative Controller for HHKB
« Reply #631 on: Tue, 30 June 2020, 10:12:51 »
Hi hhkb users,
I swapped out my controller, but i ran into this issue where the keyboard would register random key inputs. I heard that it is commonly caused by the ribbon cable connection. After several days of trial, i got frustrated and jumped the cables between the pcb and controller rather dealing with the weird connection. However the random key input problem still occurred. Could there be another cause of this problem?
Here is the picture of my wire jump: https://imgur.com/a/xa2XQhy

Offline hasu

  • Thread Starter
  • Posts: 3131
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] Alternative Controller for HHKB
« Reply #632 on: Tue, 30 June 2020, 10:21:29 »
That alt controller worked well before?
Topre stock controller had smilar issue with the cable?

In my case ribbon cable failed on another side(switch board) and I had to take apart switch board completely to replace original component with compatible one.

https://imgur.com/a/ZlibW7v
HHKB in the pics is my testbed with long cable, btw.

Random key input is almost random or has specific pattern?
Paste the random keys here, I may find clue to determine which wire is faulty.
« Last Edit: Tue, 30 June 2020, 10:23:21 by hasu »
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline Kyuroko

  • Posts: 4
Re: [TMK] Alternative Controller for HHKB
« Reply #633 on: Tue, 30 June 2020, 12:15:31 »
That alt controller worked well before?
Topre stock controller had smilar issue with the cable?

In my case ribbon cable failed on another side(switch board) and I had to take apart switch board completely to replace original component with compatible one.

https://imgur.com/a/ZlibW7v
HHKB in the pics is my testbed with long cable, btw.

Random key input is almost random or has specific pattern?
Paste the random keys here, I may find clue to determine which wire is faulty.

I got a spare stock controller along with the usb only custom controller. This occurs on all three controllers. Here is a small piece of the random presses, its kind of hard to get much because the keyboard would also register random short cuts like volume, spotlight search, login out... Here is a small piece: ˙˙˙Ω˙ΩΩ˙∆˙

Offline hasu

  • Thread Starter
  • Posts: 3131
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] Alternative Controller for HHKB
« Reply #634 on: Tue, 30 June 2020, 18:30:41 »
Whas is your OS, keyboard layout and application that displays the random string?
I don't even know how to input those charactors. It seems many keys go wrong severely and many wires.
This problem happens on other computers?

I guess this comes from bad connection somewhere between controller and switch board or faulty on switch board itself.

From your pic it looks you didn't remove metal pieces(contact) from wires yet, in my experience connection fails in where crimping wire and contacts. Cut off the contacts and solder wires directly if you don't have plan to reuse those contacts. Or you may need to replace all wires and connector completely as I did.

If you need new connector contacts and housing check this.
http://www.jst-mfg.com/product/pdf/eng/eZH.pdf


Also, if you took apart switch board for mod, cleaning or something recently before this problem, try reassembly it from scratch. I know some people had problem after improper lubrication, silencing mod and reassmbly.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline Kyuroko

  • Posts: 4
Re: [TMK] Alternative Controller for HHKB
« Reply #635 on: Tue, 30 June 2020, 19:54:33 »
The problem occurs on both mac and windows. I'll try disassembling/re-assemble from scratch and clean the pcb this coming weekend. Could you explain more about the removing the contacts? Im not following

Offline hasu

  • Thread Starter
  • Posts: 3131
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] Alternative Controller for HHKB
« Reply #636 on: Tue, 30 June 2020, 20:36:28 »
The problem occurs on both mac and windows. I'll try disassembling/re-assemble from scratch and clean the pcb this coming weekend. Could you explain more about the removing the contacts? Im not following

I meant these by the 'contacts' in previous post.
The pic is not clear so I though these are contacts, but they are solder blob perhaps?


The contact looks like this, just to be clear.
https://www.digikey.jp/product-detail/en/jst-sales-america-inc/SZH-002T-P0.5/455-1130-1-ND/527362

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline Kyuroko

  • Posts: 4
Re: [TMK] Alternative Controller for HHKB
« Reply #637 on: Wed, 01 July 2020, 23:28:38 »
Yea they are solder blobs, it was really a sloppy job. I tested the connectivity with my voltmeter and all of the wires are connected.

Offline devoi

  • Posts: 38
  • Location: MA
Re: [TMK] Alternative Controller for HHKB
« Reply #638 on: Fri, 31 July 2020, 15:26:11 »
re-posting from the other thread, I wrote some simple C routines to adjust the actuation height via the on-board digipot;
Just to confirm, does either controller (USB / BT) have 3 available GPIO ports? It appears that they do, looking at the images in the OP post, but I'd just like to confirm first.
It turned out to be a lot simpler than I had originally thought (my naive approach before looking at the datasheet was that it would require using the I2C driver, but it's just simple serial), and I can share the code (or potentially fork the tmk/qmk repo if I can successfully get it working), but I'd have to purchase a controller first. 3 wires would be required between the controller and main-board, either via solder or perhaps some clever approach that involves pressure-connecting to 3 of the 4 "calibration point" pads using spring-type connections, fastened to the case. Right now it uses a simple atmel development board (328 xmini) external to the keyboard that I just have wires connecting through.

To summarize how each of the features work:
R/W mode must be enabled with two different "commands" - the digipot is by default in read mode, but must be changed to write mode to write memory or wiper, and changed back to read.
Commands are sent via 16-bit words, started with the chip select signal low, as well as a low-starting high-ending rising-edge clock which data is synced to via the DIO pin.
To put the controller in write-mode, I send 0xA300 (MSB-first) to the controller, and I've confirmed it working with a clock period of 4us. For read mode, I use 0xA000. The rightmost byte in this scenario really doesn't matter, as I believe the controller would normally check it for an address.

To read the wiper, the digipot must be in read-mode, meaning either it's been sent read-mode as a command or it has been just powered (defaults to read mode). Afterward, the command 0xAB00 is used. The DIO line is then changed to a read-input, then the next 8 bits are read. These 8 bits are sent in order of D0-D7, with the final bit D7 being irrelevant. This value is the current step value. This gives a total of 128 different steps, of which a sub-section can be used for adjusting the height, as some resistance values are too low and some are too high. In my case, the default value is 0x27, which is stored in memory and recalled whenever the board turns on.
If this is added as a feature, I would suggest writing to the wiper with the controller on-boot and storing this in the controller's EEPROM, rather than overwriting the digipot's EEPROM, to reduce risk. I'm curious if the default value is different for some users, and that 0x27 (measured ~29.97k ohms on board) is calibrated just for my board. I would need someone to check resistance between the two small test points to the side of the digipot chip to confirm, after the board is powered.

To write to the wiper, two 16-bit words are required. I first send the command 0xA600 (sent via MSB first order) which constitutes the command (0xA6) and an irrelevant memory address (so I use 0x00, could be anything). To save on complexity, I reverse the "step" number binary that I want to send, so that its LSB is now MSB (in other words, D0 is required before D1..D7), as the serial write sends MSB first. I then shift 8 bits left as an empty byte is required after. For example, if I wanted to write step 1/127 to the board, I would send 0xA600 to indicate wiper write, then 0x8000 (I think). Step 2/127 would be 0xA600 then 0x4000 if I'm doing the math right. This should immediately write the wiper position to step*100k/127 ohms, I think. For posterity I do two more clock cycles (the chip ignores these, I believe). Then pull ~CS high, and disable writing to the chip, same as with the other commands.

I haven't tried writing to the EEPROM yet, just in case. I don't think there's much danger in doing so, as I can just re-write the original calibrated value, but I'd much prefer leaving the default value there just in case anything goes wrong. As mentioned previously, I don't think there would be much danger in simply writing the wiper position every time the board turns on using the controller, since there's a default value in the chip. I haven't checked to see if the chip recommends a low number of writes, but I doubt it.
Ideally adjusting the distance dynamically would have to be done in a way that doesn't lock the user out (after setting it one step too low), so that the user has the ability to fix it. Perhaps there would need to be a way to confirm that the current setting is possible to type on.

If anyone has questions, please let me know! :D

Offline hasu

  • Thread Starter
  • Posts: 3131
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] Alternative Controller for HHKB
« Reply #639 on: Fri, 31 July 2020, 22:06:17 »
devoi,
Thanks for sharing the great write up. It would be helpful for people to implement the feature.

As for my TMK controller two GPIOs are freely available on pinouts but three. Unused pins can be found easily and usable with some soldering jobs except for 'BT controller for HHKB JP'. TMK controller board can't support this feature without some tikering job. You won't have to get TMK controller to test this feature.

Reference code for your current setup would be good enough for us tinkerers.

In my Pro2 resistance between VW(=VH) and VL is 24.41KOhm when powered and around 65KOhm without power. I'm not sure how to measure it correctly but touched VW pin with red probe.

For other people interested datasheet of the digipot BU9831 is available here.
https://datasheetspdf.com/pdf/365041/Rohm/BU9831/1
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline devoi

  • Posts: 38
  • Location: MA
Re: [TMK] Alternative Controller for HHKB
« Reply #640 on: Sat, 01 August 2020, 14:47:44 »
In my Pro2 resistance between VW(=VH) and VL is 24.41KOhm when powered and around 65KOhm without power. I'm not sure how to measure it correctly but touched VW pin with red probe.

It's possible that PFU lowered the key a known distance and then adjusted the digipot value until it would just barely actuate, which gives credence to the aptly named "calibration points". I can assume that the internal value within the digipot is also different given the different resistance.

I've made the code available via (https://pastebin.com/RQYiGK5W), as I feel it's not big enough for its own repo (yet). I'll make a fork of the tmk/qmk repo if I get my hands on a controller in the near future. At a glance, it appears ports D0-D3 and F0-F1 are available either as test points or for GPIO use. Could you confirm if that's the case?

Offline hasu

  • Thread Starter
  • Posts: 3131
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: [TMK] Alternative Controller for HHKB
« Reply #641 on: Sat, 01 August 2020, 20:30:12 »
In my Pro2 resistance between VW(=VH) and VL is 24.41KOhm when powered and around 65KOhm without power. I'm not sure how to measure it correctly but touched VW pin with red probe.

It's possible that PFU lowered the key a known distance and then adjusted the digipot value until it would just barely actuate, which gives credence to the aptly named "calibration points". I can assume that the internal value within the digipot is also different given the different resistance.

I've made the code available via (https://pastebin.com/RQYiGK5W), as I feel it's not big enough for its own repo (yet). I'll make a fork of the tmk/qmk repo if I get my hands on a controller in the near future. At a glance, it appears ports D0-D3 and F0-F1 are available either as test points or for GPIO use. Could you confirm if that's the case?

Thanks for sharing the code.
D0 and D1 is not used by default firmware. D2, D3, F0 and F1 is used for Bluetooth controller.
All pins can be used to support Bluetooth or JP model, except for D0 and D1.

I'd go with D6 if I add this with feature TMK controller. The pin is currently used for Caps LED which has no critical function. I believe no one have trouble without the LED.  But you may go with any pin below.

Not-used pins available for user:
- Bluetooth controller for HHKB JP has D0, D1
- Bluetooth controller for HHKB Pro2 has D0, D1, C6, C7.
- USB controller for HHKB JP has D0, D1, D2, D3, D4, D5, F0, F1, F4, F5, F6, F7, E6
- USB controller for HHKB Pro2 has D0, D1, D2, D3, D4, D5, F0, F1, F4, F5, F6, F7, E6, C6, C7

Schematics is available here.
https://github.com/tmk/HHKB_controller/blob/master/schematic/HHKB_controller_revG.pdf
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline devoi

  • Posts: 38
  • Location: MA
Re: [TMK] Alternative Controller for HHKB
« Reply #642 on: Sat, 01 August 2020, 22:05:19 »
Not-used pins available for user:
- Bluetooth controller for HHKB JP has D0, D1
- Bluetooth controller for HHKB Pro2 has D0, D1, C6, C7.
- USB controller for HHKB JP has D0, D1, D2, D3, D4, D5, F0, F1, F4, F5, F6, F7, E6
- USB controller for HHKB Pro2 has D0, D1, D2, D3, D4, D5, F0, F1, F4, F5, F6, F7, E6, C6, C7

Thanks for the information - I'll keep everyone updated if I can get a demo working using just the controller. It's unfortunate that it doesn't seem easily doable with the BT JP model, though.

Offline joric

  • Posts: 133
Re: Alternative Controller for HHKB
« Reply #643 on: Fri, 09 October 2020, 01:34:41 »
But not like your video shows that several 2 come together, I just get one extra KEY 2 a time.
Bluetooth stopped working on YDKB HHKB Pro 2 controller. Green LED flashes only in bootloader mode. Battery indicator shows 12. BLE hardware reset doesn't help. Any ideas? Charger/regulator/Anything else to check/replace? Can't find what's wrong with it. Battery apparently works, green LED flashes if the keyboard is in bootloader mode even with the cable unplugged.
Upd. Enabled BT, made green LED flash with LShift+RShift+W or F+J but it won't advertise and doesn't show up, so I can't pair it anymore. Battery indicator now always shows 45.
Upd 2. Finally made it working. Got it in BT devices after reset as Adafruit BLE and it worked. Hardware reset as here (pin to shield) http://help.ydkb.io/doku.php?id=en:ble-series:reset-ble
Upd 3. Anyone managed to pul 18650 there? Is there enough space for 18650? I don't have one to try beforehand.
« Last Edit: Fri, 09 October 2020, 02:27:43 by joric »