Author Topic: TMK keyboard firmware  (Read 559922 times)

0 Members and 1 Guest are viewing this topic.

Offline swill

  • * Elevated Elder
  • Posts: 3365
  • Location: Canada eh
  • builder & enabler
    • swillkb.com
Re: TMK keyboard firmware
« Reply #600 on: Wed, 11 March 2015, 19:23:11 »


I'm not much interested in developing gaming functions, but in assisting people having difficultiy with normal keyboard.
That said, OS repeating config seems to do fairly good job in both Mac and Windows.

Repeating in firmware will be a bit of a work with referencing timer. It is difficult or impossible to implement in keymap file at this time.

Is it possible to add a repeating action as a function?
As an example: if key A is held, send the A key every 50ms.

If he does add this functionality, I would recommend actually implementing it like this.

If a key is held for more than 500ms, then start repeating the key every 50ms (or whatever configurable value).

This will reduce the illusion of debounce if people don't press and release quickly.  This is how most keyboards handle that...

Makes sense. So we should be able to get repeating support through our OS. Makes total sense not to add it then. :)

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #601 on: Wed, 11 March 2015, 19:36:58 »
admiralvorian,

build process seems to be OK. Did default keymap works for you?

You better do 'make clean' if you have trouble in built frimware.
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Build#do-make-clean-before-make

Also check this if you are on windows
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Build#edit-configuration-but-not-change


(And make sure your numlock status, note that '1' on pad may work as 'End'.)
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline p3lim

  • Posts: 106
  • Location: Norway
Re: TMK keyboard firmware
« Reply #602 on: Wed, 11 March 2015, 19:58:01 »
Is it possible to add a repeating action as a function?
As an example: if key A is held, send the A key every 50ms.

If he does add this functionality, I would recommend actually implementing it like this.

If a key is held for more than 500ms, then start repeating the key every 50ms (or whatever configurable value).

This will reduce the illusion of debounce if people don't press and release quickly.  This is how most keyboards handle that...

Windows (at least) does a fine job at executing repeating actions like you described, what I want is something that does not behave like that, but not for the whole keyboard, just one key.

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #603 on: Thu, 12 March 2015, 02:56:40 »
I'll implement those functions for cortex controller finally in some point of future, but I don't know when.
Ok, awesome. I'm going to try out the current firmware this week.

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #604 on: Thu, 12 March 2015, 03:20:51 »
I'll implement those functions for cortex controller finally in some point of future, but I don't know when.
Ok, awesome. I'm going to try out the current firmware this week.

Nice. let me know if you have trouble on compiling or something.
Also pre-compiled firmware is available here.
https://geekhack.org/index.php?topic=69231.msg1667956#msg1667956

TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline regack

  • Posts: 660
  • Location: Thessia
Re: TMK keyboard firmware
« Reply #605 on: Thu, 12 March 2015, 07:46:09 »
hasu,

This might be a kind of basic question, but when updating to the latest version, do I basically just  copy my /keyboard/[design] into the new firmware /keyboard directory and recompile? 

Offline admiralvorian

  • Posts: 324
  • Location: United States
  • DIY
Re: TMK keyboard firmware
« Reply #606 on: Thu, 12 March 2015, 10:46:31 »
admiralvorian,

build process seems to be OK. Did default keymap works for you?

You better do 'make clean' if you have trouble in built frimware.
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Build#do-make-clean-before-make

Also check this if you are on windows
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Build#edit-configuration-but-not-change


(And make sure your numlock status, note that '1' on pad may work as 'End'.)

Thank you hasu! I do 'make clean' between every compile, I'm doing this on ubuntu 14.04.1. I even removed the entire directory and re-cloned from github.

I will let you guys know if I find out what's happening.
Darude Status:
☐ Not Sandstorm
☑ Sandstorm                                               wts wtt wtb

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #607 on: Thu, 12 March 2015, 15:47:15 »
regack,
Yes, copying will work.
But many people including myself ues 'git' tool to update source codes, it is useful for tracking changes.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline BlueNalgene

  • Posts: 739
  • Location: Oklahoma, USA
Re: TMK keyboard firmware
« Reply #608 on: Thu, 12 March 2015, 16:13:05 »
Hasu,

I'm trying to adapt your code to the Vic-20.  I'd love to have your input on a few problems I'm having.

https://geekhack.org/index.php?topic=69470.0

Offline p3lim

  • Posts: 106
  • Location: Norway
Re: TMK keyboard firmware
« Reply #609 on: Thu, 12 March 2015, 17:41:38 »
Just in case people here don't follow the issue tracker on Github, it's entirely possible to embed tmk_keyboard instead of modifying it (e.g adding/changing stuff inside /keyboard or /converter).
I used git submodules, but you could just as well use git subtrees or hard-embed it.

https://github.com/p3lim/keyboard_firmware

Also, since I use Sublime Text as my preferred IDE, I've set up a project file that adds the compiling and flashing to a keybind inside the editor (among other things).
https://github.com/p3lim/keyboard_firmware/blob/master/.sublime-project

Offline admiralvorian

  • Posts: 324
  • Location: United States
  • DIY
Re: TMK keyboard firmware
« Reply #610 on: Fri, 13 March 2015, 13:28:48 »
admiralvorian,

build process seems to be OK. Did default keymap works for you?

You better do 'make clean' if you have trouble in built frimware.
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Build#do-make-clean-before-make

Also check this if you are on windows
https://github.com/tmk/tmk_keyboard/wiki/FAQ-Build#edit-configuration-but-not-change


(And make sure your numlock status, note that '1' on pad may work as 'End'.)

Thank you hasu! I do 'make clean' between every compile, I'm doing this on ubuntu 14.04.1. I even removed the entire directory and re-cloned from github.

I will let you guys know if I find out what's happening.

I commented the following line in the makefile and everything started working as expected:

Code: [Select]
#KEYMAP_IN_EEPROM_ENABLE = yes # Read keymap from eeprom
Darude Status:
☐ Not Sandstorm
☑ Sandstorm                                               wts wtt wtb

Offline phishy

  • Posts: 120
Re: TMK keyboard firmware
« Reply #611 on: Sat, 14 March 2015, 21:09:15 »
Just want to confirm that I'm not the only one here that doesn't understand at all how to use this....lol

Offline eprst

  • Posts: 2
Re: TMK keyboard firmware
« Reply #612 on: Sun, 15 March 2015, 23:40:11 »
Hi

I'm playing with TMK on my ergodox, and there seems to be a problem with system suspend: I see the keyboard boot up after resume (it blinks all leds), then it goes back to sleep with that slowly breathing led. The only way to fix it is to replug. Is it a known issue?
I'm running linux 3.19

Update: can't reproduce anymore.. sorry for the noise. Will show magic-v/s output if it happens again.
« Last Edit: Tue, 17 March 2015, 01:42:03 by eprst »

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #613 on: Mon, 16 March 2015, 01:48:24 »
What is your configuration actually? You can post output of magic 'v'.

And check issues on github.com, both tmk and cub-uniac.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #614 on: Tue, 17 March 2015, 17:23:44 »
hasu, I'm trying to compile the infinity tmk firmware but I get an error. I installed the mbed-sdk in tmk_keyboard/mbed-sdk. When running make in keyboard/infinity I get the following error:

Code: [Select]
In file included from matrix.c:3:0:
../../mbed-sdk/libraries/mbed/hal/gpio_api.h:19:20: fatal error: device.h: No such file or directory
 #include "device.h"
                    ^
compilation terminated.
mbed-infinity/cmsis_nvic.c:31:24: fatal error: cmsis_nvic.h: No such file or directory
 #include "cmsis_nvic.h"
                        ^
compilation terminated.
main.cpp:1:20: fatal error: MK20D5.h: No such file or directory
 #include "MK20D5.h"
                    ^
compilation terminated.
make: *** [build/matrix.o] Error 1
make: *** [build/mbed-infinity/cmsis_nvic.o] Error 1
make: *** [build/main.o] Error 1
mbed-infinity/system_MK20D5.c:43:20: fatal error: MK20D5.h: No such file or directory
 #include "MK20D5.h"
                    ^
compilation terminated.
make: *** [build/mbed-infinity/system_MK20D5.o] Error 1
In file included from ../../mbed-sdk/libraries/mbed/api/mbed.h:21:0,
                 from ../../mbed-sdk/libraries/USBDevice/USBDevice/USBHAL.h:22,
                 from mbed-infinity/USBHAL_KL25Z.cpp:21:
../../mbed-sdk/libraries/mbed/api/platform.h:21:20: fatal error: device.h: No such file or directory
 #include "device.h"
                    ^
compilation terminated.
make: *** [build/mbed-infinity/USBHAL_KL25Z.o] Error 1

Do you have any idea what could be wrong? Why is the mbed-sdk not included as a .gitmodule? Has that something to with licensing?

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #615 on: Tue, 17 March 2015, 17:42:44 »
Ok, I fixed it.

I checked the mbed-sdk out @2f63fa7d78a2 (as mentioned in mbed-infinity/README). Next was that the 'gcc-arm-none-eabi' package in Ubuntu 14.04 doesn't provice c++ headers (https://bugs.launchpad.net/ubuntu/+source/gcc-arm-none-eabi/+bug/1293024). After installing the ppa:terry.guo/gcc-arm-embedded ppa, reinstalling gcc-arm-none-eabi, doing a make clean the error was fixed!

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #616 on: Tue, 17 March 2015, 17:51:39 »
Great.

Yes, I use  this github repo and my local revision is 2f63fa7d78a264b (Dec 25, 2014).
https://github.com/mbedmicro/mbed.git
Again, yes I use that PPA compiler, I'll add notes on those in README.

You had the compile problem with the latest revision of SDK? I'll check mbed again if I have time.
And I'll add mbed SDK as a submodule or subtree later, I don't think it has problem with GPL.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline TheNoobySpartan

  • Posts: 1
Re: TMK keyboard firmware
« Reply #617 on: Wed, 18 March 2015, 09:46:26 »
Hey there Hasu! I am currently in the planning phase of making a 2 cherry MX key controller for the game osu. Is there a way for me to add reactive LED backlighting to the keys and a breath light that changes color based on the keypresses per minute? Keep in mind I am pretty much a noob at both the hardware and software side of things so I may be a bit dense...

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #618 on: Wed, 18 March 2015, 16:21:43 »
hasu, I fixed the (compile) errors with the updated mbed-sdk: https://github.com/LeonB/tmk_keyboard/commit/83a7ff9

When that was done I tried a `make program` which at first seemed like it worked but the orange light on the keyboard kept burning. Then I rolled back to your version (and the older mbed-sdk) and the same happened: flashing seemingly went ok but the orange light on the keyboard (dfu mode?) kept burning.

dfu-util didn't bring up anything weird:

Code: [Select]
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 1c11:b007
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device
Download [=========================] 100%        12684 bytes
Download done.
state(7) = dfuMANIFEST, status(0) = No error condition is present
dfu-util: unable to read DFU status after completion

Any idea on how to debug this? dfu-utild -D kiibohd.dfu.bin worked like a champ.
« Last Edit: Wed, 18 March 2015, 16:24:01 by l_b »

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #619 on: Wed, 18 March 2015, 21:23:04 »
 l_b,
Did you rollback to old one completely? And try 'make clean' and check if all build files is removed.
Maybe, firmware goes wrong with something like memory map or startup.

This is part of diff of keyboard/infinity/mbed-infinity.mk in your commit. You have to use my 'mbed-infinity' version for Infinity since Infinity is differently confgured from mbed Freescale board. Vector address and clock configuration should be changed in fact.

Code: [Select]
- $(OBJDIR)/mbed-infinity/cmsis_nvic.o \
- $(OBJDIR)/mbed-infinity/system_MK20D5.o \
- $(OBJDIR)/mbed-infinity/USBHAL_KL25Z.o \
+ $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20XX/TARGET_K20D50M/cmsis_nvic.o \
+ $(OBJDIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20XX/TARGET_K20D50M/system_MK20D5.o \
+ $(OBJDIR)/libraries/USBDevice/USBDevice/USBHAL_KL25Z.o \
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #620 on: Wed, 18 March 2015, 21:46:57 »
TheNoobySpartan,
You will need to learn about AVR programming, timer(for count strokes) and PWM(for LED), begin with Arduino or Teensy with breadboards. Google and forums like AVRFreaks can offer enormous useful resources.

Hey there Hasu! I am currently in the planning phase of making a 2 cherry MX key controller for the game osu. Is there a way for me to add reactive LED backlighting to the keys and a breath light that changes color based on the keypresses per minute? Keep in mind I am pretty much a noob at both the hardware and software side of things so I may be a bit dense...
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #621 on: Thu, 19 March 2015, 06:49:43 »
hasu, thanks for the explanation. I'll adjust the commit.

I'll also try to build your version starting from scratch tonight. Maybe I forgot to roll something back like you said.

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #622 on: Thu, 19 March 2015, 15:25:44 »
Just tried it again but same issue: the dfu mode doesn't get turned off after programming the chip.

These are the steps I took:

Code: [Select]
mkdir test
cd test
git clone https://github.com/tmk/tmk_keyboard.git
cd tmk_keyboard
git submodule init
git submodule update
git clone https://github.com/mbedmicro/mbed.git mbed-sdk
cd mbed-sdk
git checkout 2f63fa7d78a264b
cd ../keyboard/infinity
make
sudo make program

I've attached the build log but I couldn't see anything wrong.

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #623 on: Thu, 19 March 2015, 16:44:18 »
l_b,
Infinity goes into DFU mode if firmware is built incorrectly or work wrong.

I'd ask some,
0. your Infinity is 'prototype' or 'production' model?
      those two models have different matrix, define 'INFINITY_PROTOTYPE' in config.h for prototype
1. fimware you compiled with 2f63fa7d78a264b before worked for your Infinity?
      I confirmed it works for me with my prototype model just before this was written.
2. my prebuild binary works? https://geekhack.org/index.php?topic=41989.msg1677235#msg1677235
      This is built for production model.
3. Infinity official firmware works?
4. what version is your dfu-tool?
5. show me output of dfu-tool or make program
      This is likely your problem, the latest version of dfu-tool requires some integrity check or sth.




TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #624 on: Thu, 19 March 2015, 17:41:36 »
l_b,
Infinity goes into DFU mode if firmware is built incorrectly or work wrong.

I'd ask some,
0. your Infinity is 'prototype' or 'production' model?
      those two models have different matrix, define 'INFINITY_PROTOTYPE' in config.h for prototype
1. fimware you compiled with 2f63fa7d78a264b before worked for your Infinity?
      I confirmed it works for me with my prototype model just before this was written.
2. my prebuild binary works? https://geekhack.org/index.php?topic=41989.msg1677235#msg1677235
      This is built for production model.
3. Infinity official firmware works?
4. what version is your dfu-tool?
5. show me output of dfu-tool or make program
      This is likely your problem, the latest version of dfu-tool requires some integrity check or sth.

- my infinity is the production model
- no, none of the tmk firmwares worked on my infinity :(
- the prebuild binary doesn't work :( Same issue
- the normal infinity firmware works fine
- 0.5 (ubuntu provided) / 0.8 (linuxbrew)
- These are the outputs of the dfu-tool. In order: 0.5 prebuild tmk firmware, 0.8 prebuild tmk firmware, 0.8 official firmware

Code: [Select]
leon@lola:~$ sudo /usr/bin/dfu-util -D Downloads/infinity_spacefn.bin
dfu-util 0.5

(C) 2005-2008 by Weston Schmidt, Harald Welte and OpenMoko Inc.
(C) 2010-2011 Tormod Volden (DfuSe support)
This program is Free Software and has ABSOLUTELY NO WARRANTY

dfu-util does currently only support DFU version 1.0

Opening DFU USB device... ID 1c11:b007
Run-time device DFU version 0110
Found DFU: [1c11:b007] devnum=0, cfg=1, intf=0, alt=0, name="UNDEFINED"
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
No valid DFU suffix signature
Warning: File has no DFU suffix
bytes_per_hash=253
Copying data from PC to DFU device
Starting download: [##################################################] finished!
state(7) = dfuMANIFEST, status(0) = No error condition is present
unable to read DFU status

Code: [Select]
leon@lola:~$ sudo /home/leon/.linuxbrew/bin/dfu-util -D Downloads/infinity_spacefn.bin
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 1c11:b007
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device
Download [=========================] 100%        12676 bytes
Download done.
state(7) = dfuMANIFEST, status(0) = No error condition is present
dfu-util: unable to read DFU status after completion

Code: [Select]
leon@lola:~$ sudo /home/leon/.linuxbrew/bin/dfu-util -D src/tmk_keyboard/keyboard/infinity/kiibohd.dfu.bin
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 1c11:b007
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device
Download [=========================] 100%        23452 bytes
Download done.
state(7) = dfuMANIFEST, status(0) = No error condition is present
dfu-util: unable to read DFU status after completion
« Last Edit: Thu, 19 March 2015, 18:02:26 by l_b »

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #625 on: Thu, 19 March 2015, 18:43:16 »
It seems like your DFU output has no problem, hmm.
I thought difference between prototype and produciton is only matrix but I might be wrong. Also, bootloader may be changed between two model.

I'll check Infinity source code again.




My output of 'make program':
Code: [Select]
$ make program
dfu-util -D ./build/infinity.bin
dfu-util 0.5

(C) 2005-2008 by Weston Schmidt, Harald Welte and OpenMoko Inc.
(C) 2010-2011 Tormod Volden (DfuSe support)
This program is Free Software and has ABSOLUTELY NO WARRANTY

dfu-util does currently only support DFU version 1.0

Opening DFU USB device... ID 1c11:b007
Run-time device DFU version 0110
Found DFU: [1c11:b007] devnum=0, cfg=1, intf=0, alt=0, name="UNDEFINED"
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
No valid DFU suffix signature
Warning: File has no DFU suffix
bytes_per_hash=252
Copying data from PC to DFU device
Starting download: [##################################################] finished!
state(7) = dfuMANIFEST, status(0) = No error condition is present
unable to read DFU status
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #626 on: Thu, 19 March 2015, 18:47:50 »
Of you want I could setup a separate ssh account on a box for you to try out the production keyboard.

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #627 on: Thu, 19 March 2015, 21:43:17 »
What I can look into with remote access will be very limited and not so helpful, I think.

I skimmed source changes and commits of Infinity and I'm suspecting watchdog timer but not sure.
This commit changed timing of watchdog configuration and I guess bootloader revision is diffrent on mine and yours.
https://github.com/kiibohd/controller/commit/2c7542e2e7f0b8a99edf563dc53164fe1a439483

I'll reflash my bootloader and see if your problem occurs later.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline Smasher816

  • HHKB Master
  • Posts: 538
  • Location: return STATE_MISSOURI;
Re: TMK keyboard firmware
« Reply #628 on: Thu, 19 March 2015, 22:55:51 »
I helped beta test the infinity and found an issue where flashing a bad binary would brick the device. Not even pressing the reset to bootloader button would fix it. To solve this issue Haata added some extra security code that would take the device to the bootlodaer if an arm lockup happened or the whatchdog timer was not disabled. Because of this any infinity firmware (with the production bootloader) requires the watchdog to be disabled at the start. It is what lets the board know that you meant to put the specific firmware on the keyboard.

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #629 on: Fri, 20 March 2015, 16:03:24 »
Thanks Smasher816! I tried fixing it but I don't know enough of this stuff / C :(

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #630 on: Fri, 20 March 2015, 20:33:55 »
Smasher816, thanks for the info.

l_b, I updated my Infinity with the latest bootloader and confirmed the problem you suffer! My old bootloader was build at Dec 31 before the commit. Probably your Infinity was shipped with installed with new bootloader.

Now I have to change my firmware to adapt to new bootloader, I'll enjoy looking into mbed startup code again :D
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline BlueNalgene

  • Posts: 739
  • Location: Oklahoma, USA
Re: TMK keyboard firmware
« Reply #631 on: Sat, 21 March 2015, 01:14:01 »
Anybody have any thoughts on taking a crack at using this with the Teensy LC?  I've got one coming, and I'm just wondering if I will end up being the guinea pig.

Offline Smasher816

  • HHKB Master
  • Posts: 538
  • Location: return STATE_MISSOURI;
Re: TMK keyboard firmware
« Reply #632 on: Sat, 21 March 2015, 05:58:42 »
@Hasu

I guess you just need lines 483-486, https://github.com/kiibohd/controller/commit/2c7542e2e7f0b8a99edf563dc53164fe1a439483#diff-2ad15298158822a548aea372d4abe75bR483.

That should disable the watchdog, I think? The rest are if statements to help it jump into the bootloader. I believe everything was in that commit, but I suppose their could be more. I am not sure.

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #633 on: Sat, 21 March 2015, 20:54:30 »
I'm sure now that TMK Infinity firmware failed to disable watchdog in its startup sequence. Watchdog is timed out before disabling it and the controller is reset, then bootloader keeps in DFU mode.

It seems like mbed's startup sequence takes a bit long time before disabling watchdog, we have to do it in very early stage, instead.
I made workaround for this by changing mbed startup file.

https://github.com/tmk/tmk_keyboard/commit/0d222db31f599e90e5e281f80d21ce3c6af0fef8
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline VinnyCordeiro

  • Posts: 432
Re: TMK keyboard firmware
« Reply #634 on: Sat, 21 March 2015, 23:06:29 »
Hello, there! Long post here.

I'm developing a prototype 20% keyboard for games, it's basically the WASD keys + some keys of the WASD neighborhood. Doing that to learn how to program the ATmega32U4 for another project. As I said, I'm using a ATmega32U4 directly (no Teensy here) and trying to program it using AVRDUDE & Adafruit's USBtinyISP. I already used this programmer in other projects using ATmega8, I know it works. But I'm not being able to program the 32U4.

I have compiled a custom firmware for this prototype using Matt3o's tutorial on Deskthority and it seems to be all right, no compilation errors. Now I'm trying to upload the firmware to the 32U4, with no success.

The command line I'm using is (I'm using avrdude 6.1):

Code: [Select]
avrdude -p m32u4 -c usbtiny -v -v -v -U flash:w:e:\gamer_lufa.hex:i
And I have this output:

Code: [Select]
avrdude: Version 6.1, compiled on Mar 13 2014 at 00:09:49
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "E:\EletrÂnica, Arduino e afins\avrdude-6.1-mingw32\avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 00 00 00]
CMD: [ac 53 00 00] [00 00 00 00]
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

As you can see, initialization failed. After adding -F to override, I get:

Code: [Select]
avrdude: Version 6.1, compiled on Mar 13 2014 at 00:09:49
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "E:\EletrÂnica, Arduino e afins\avrdude-6.1-mingw32\avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 00 00 00]
CMD: [ac 53 00 00] [00 00 00 00]
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e0000
avrdude: Expected signature for ATmega32U4 is 1E 95 87
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.

avrdude done.  Thank you.

And now I have a mismatch on the device signature. Can anyone give a hand here? Thank you in advance.

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #635 on: Sun, 22 March 2015, 01:06:02 »
VinnyCordeiro,
I think you have to check your connection related to ISP pins and power. You can post your circuit diagram so that we can double check for you.
And post pics of you keyboard! People really love to see custom keyboard works and you'll get more attentions and helps in the end.

Last but not least, why are you using ISP&avrdude instead of USB bootloader?
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline VinnyCordeiro

  • Posts: 432
Re: TMK keyboard firmware
« Reply #636 on: Sun, 22 March 2015, 10:46:11 »
VinnyCordeiro,
I think you have to check your connection related to ISP pins and power. You can post your circuit diagram so that we can double check for you.
And post pics of you keyboard! People really love to see custom keyboard works and you'll get more attentions and helps in the end.

Last but not least, why are you using ISP&avrdude instead of USB bootloader?

Another mistake on the prototype, and the first big one: the ICSP connections are inverted!  :mad: Well, that's what prototypes are for, making mistakes. Thank you for the advice anyway.

Bootloaders occupy flash space. I know, it's minimum in this case, but in others it isn't. And I prefer to direct flash mcu's. :D

Photos:

The PCB's made by Gold Phoenix:
97636-0

The prototype almost finished (Cherry MX clears for alphas and linear Cherry MX gray on thumb spacebar):
97634-1
« Last Edit: Fri, 17 April 2015, 16:11:53 by VinnyCordeiro »

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #637 on: Sun, 22 March 2015, 14:35:37 »
Nice work.

So your ICSP problem was resolved and you can flash firmware now, right?
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline VinnyCordeiro

  • Posts: 432
Re: TMK keyboard firmware
« Reply #638 on: Sun, 22 March 2015, 14:44:07 »
Nice work.

So your ICSP problem was resolved and you can flash firmware now, right?

Not yet, I'll have to fix it. But not today, I have other things to do. :(

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #639 on: Tue, 24 March 2015, 15:01:17 »
hasu, I didn't get a mail from geekhack there was an update so I didn't realize you already fixed the problem! I tried it out: the flashing went fine. The light that indicated dfu mode goes out.

However the keyboard after that won't work. I get these in my dmesg:

Code: [Select]
Mar 24 20:54:25 lola kernel: [279889.727369] usb 3-7: new full-speed USB device number 36 using xhci_hcd
Mar 24 20:54:25 lola kernel: [279889.855929] usb 3-7: unable to read config index 0 descriptor/start: -71
Mar 24 20:54:25 lola kernel: [279889.855931] usb 3-7: can't read configurations, error -71
Mar 24 20:54:25 lola kernel: [279889.967283] usb 3-7: new full-speed USB device number 37 using xhci_hcd
Mar 24 20:54:25 lola kernel: [279890.095861] usb 3-7: unable to read config index 0 descriptor/start: -71
Mar 24 20:54:25 lola kernel: [279890.095863] usb 3-7: can't read configurations, error -71
Mar 24 20:54:26 lola kernel: [279890.207183] usb 3-7: new full-speed USB device number 38 using xhci_hcd
Mar 24 20:54:26 lola kernel: [279890.223558] usb 3-7: device descriptor read/all, error -71
Mar 24 20:54:26 lola kernel: [279890.335175] usb 3-7: new full-speed USB device number 39 using xhci_hcd
Mar 24 20:54:26 lola kernel: [279890.351509] usb 3-7: device descriptor read/all, error -71
Mar 24 20:54:26 lola kernel: [279890.351545] usb usb3-port7: unable to enumerate USB device

Offline Baxter

  • Posts: 65
  • Location: Edinburgh, UK
  • They do not know it, but they are doing it.
    • http://www.darklightweb.co.uk
Re: TMK keyboard firmware
« Reply #640 on: Mon, 30 March 2015, 16:49:16 »
I have a spare teensy++ 2.0 I've just tried programming with the tml/tmk_keyboard gh60 layout, I set the MCU to at90usb1287 and when connected it goes wild outputting "=]" and random mouse commands, is this because of some incompatibility with the ++ 2.0 or just because I've got nothing connected and the input pins are floating?
« Last Edit: Mon, 30 March 2015, 16:51:08 by Baxter »

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #641 on: Mon, 30 March 2015, 17:16:30 »
l_b,  it seems like USB initialization or enumeration fail. I'll look into again later. I guess xhchi indicates USB3.0 and it is more fussy for timing and spec.

Baxter,
I don't think floting pin is problem they are internally pull-uped but not sure. Teensy++ has 1286 not 1287,  but again not sure this causes the madness. BTW, what is tml?
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline Baxter

  • Posts: 65
  • Location: Edinburgh, UK
  • They do not know it, but they are doing it.
    • http://www.darklightweb.co.uk
Re: TMK keyboard firmware
« Reply #642 on: Mon, 30 March 2015, 17:50:01 »
I don't think floting pin is problem they are internally pull-uped but not sure. Teensy++ has 1286 not 1287,  but again not sure this causes the madness. BTW, what is tml?

sorry I meant https://github.com/tmk/tmk_keyboard.

Strangely I do get correct keystrokes if I short a row to a column and commenting out bootmagic seems to stop it in any case.

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #643 on: Mon, 30 March 2015, 18:16:06 »
Ah, I see :D I just thought someone folked and made new repository.

I found Teensy has LED on PD6 which is used for key matrix sense in GH60. That column has = and ] key. This makes sense.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline Baxter

  • Posts: 65
  • Location: Edinburgh, UK
  • They do not know it, but they are doing it.
    • http://www.darklightweb.co.uk
Re: TMK keyboard firmware
« Reply #644 on: Mon, 30 March 2015, 18:39:05 »
Ah, damn, I saw that was lit and didn't think twice, always the obvious stuff, I'll poke the pin mappings a bit, thanks :)

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #645 on: Wed, 01 April 2015, 16:49:50 »
hasu, should I check on a usb2 machine to see if there's a difference?

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #646 on: Wed, 01 April 2015, 16:54:20 »
Yes, plz. It would be appreciated unless it bothers you much.
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #647 on: Thu, 02 April 2015, 14:19:30 »
hasu, on usb2 they work fine! Would it be hard to fix that?

Offline hasu

  • Thread Starter
  • Posts: 3125
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #648 on: Thu, 02 April 2015, 17:41:05 »
Thanks for the testing.
I don't have any USB3 port and don't know about it at all.
That said,  I can compare with official firmware at least. HaaTa's firmware uses PJRC USB stack while mine uses mbed.org.

Official firmware works well with USB 3, right?
TMK products:HHKB Alt  ⌨ConvertersAlps64FC660C AltFC980C Alt

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #649 on: Thu, 02 April 2015, 18:10:25 »
Yeah, official firmware works fine with usb3. (But isn't as nice as tmk :))

If you're open for it I would be willing to donate a little sum for the project because I enjoy it very much.
Would something like implementing the media keys be doable for me (little c / embedded experience, but familiar with programming) for the infinity / mbed stack?