Author Topic: TMK keyboard firmware  (Read 819838 times)

0 Members and 1 Guest are viewing this topic.

Offline Smasher816

  • HHKB Master
  • Posts: 538
  • Location: return STATE_MISSOURI;
Re: TMK keyboard firmware
« Reply #650 on: Thu, 02 April 2015, 19:07:18 »
Would something like implementing the media keys be doable for me (little c / embedded experience, but familiar with programming) for the infinity / mbed stack?

I'm pretty sure media key support already exists, you just have to put the buttons in your layout. I know I can change the volume with my HHKB using tmk.

These are the keys I believe you should use: https://github.com/tmk/tmk_keyboard/blob/6a97efcea94b2d1882ba2d58c4c016a45507fb3d/common/keycode.h#L137

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #651 on: Fri, 03 April 2015, 15:18:33 »
I don't think so:

I added initial support for Masdrop Infinity which based on mbed(cortex-M) and is not full fucinton yet; mouse keys, media keys, NKRO and etc.
https://github.com/tmk/tmk_keyboard/tree/master/keyboard/infinity

I don't think many users are around here yet, but if you have it try this.

Also I tried it: https://github.com/LeonB/tmk_keyboard/blob/infinity_leonb/keyboard/infinity/keymap_leonb.c#L71 and it doesn't seem to work just yet.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #652 on: Sat, 04 April 2015, 17:49:38 »
OK. I'll look into HaaTa's USB code later when I get time. I think he changed PJRC USB code to remove bug and improve for full-fledged keyboard.

Thanks for the encouragement. I'm always open for that :D Buy me a beer, it is powerful driver for my project :p

I'm sure you can do that, though you'll need time quite a little to refer to USB spec and MCU datasheet. In the end, you need to implement functions of 'mbed driver' for media keys like send_consumer() and send_system().
https://github.com/tmk/tmk_keyboard/blob/master/protocol/mbed/mbed_driver.cpp

When I have spare time I will also tackle this but I don't know when. My Infinity is disassembled completely at this time.


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?

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #653 on: Sun, 05 April 2015, 03:34:48 »
Thanks for the encouragement. I'm always open for that :D Buy me a beer, it is powerful driver for my project :p
Yeah, sure. Send me your PayPal address (or something) and I'll buy you a couple of round  :thumb:

Offline sypl

  • Posts: 116
Re: TMK keyboard firmware
« Reply #654 on: Thu, 09 April 2015, 11:56:51 »
Not sure if anyone has asked this before (22 pages is a lot to trawl through), but if anyone has and got an answer then just reply 'yes', and I will go back through the whole thread.

My question is, is it possible to get the oneshot functionality on a layer? I've become very fond of it for my shift layer, using it like so:

Code: [Select]
[28] = ACTION_MODS_ONESHOT(MOD_LSFT),
I have a lot of characters and numbers on another two layers, but I can only access them by holding down the function layer key. If these could be accessed via a oneshot that would be ideal.

Thanks in advance.


Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #655 on: Thu, 09 April 2015, 20:11:49 »
ACTION_LAYER_ONESHOT is not existent at this time but it looks interesting idea.
I think it is possible but quite a bit coding in library is needed.

Offline ctm

  • Posts: 424
  • Location: Seattle, WA
  • Hello, world!
Re: TMK keyboard firmware
« Reply #656 on: Mon, 13 April 2015, 20:14:14 »
Is there a way to have a dedicated ~ key?
TMK Alps64 w/ Matias Quiet Switches in KBP V60 case.
Infinity60 with SKCM Orange Switches w/ TMK.
CM Storm QRF w/ Frosty Flake controller, Cherry MX Blue Switches and TMK firmware.


Coming:
Ellipse Model F F62.

Offline Rose

  • Posts: 62
  • Location: Raleigh, NC
Re: TMK keyboard firmware
« Reply #657 on: Mon, 13 April 2015, 21:52:06 »
What do these keycodes do?

KC_APP
KC_PCMM
KC_MAIL, KC_CALC, KC_MYCM for application launch
KC_WSCH, KC_WHOM, KC_WBAK, KC_WFWD, KC_WSTP, KC_WREF, KC_WFAV for web browser operation

Offline sypl

  • Posts: 116
Re: TMK keyboard firmware
« Reply #658 on: Tue, 14 April 2015, 00:20:07 »
Is there a way to have a dedicated ~ key?

Wouldn't this do it?

Code: [Select]
const uint16_t PROGMEM fn_actions[] = {   
   [0] = ACTION_MODS_KEY( MOD_LSFT, KC_GRV ),  // ~
}

Offline p3lim

  • Posts: 106
  • Location: Norway
Re: TMK keyboard firmware
« Reply #659 on: Tue, 14 April 2015, 07:53:51 »
What do these keycodes do?

KC_APP
KC_PCMM
KC_MAIL, KC_CALC, KC_MYCM for application launch
KC_WSCH, KC_WHOM, KC_WBAK, KC_WFWD, KC_WSTP, KC_WREF, KC_WFAV for web browser operation

https://github.com/tmk/tmk_keyboard/blob/master/doc/keycode.txt

KC_APP = Right menu key (the key to the right of RWin on most keyboards)
KC_PCMM = Numpad comma key
KC_MAIL, KC_CALC, KC_MYCM = Starts mail, calc, explorer app
KC_WSCH, KC_WHOM, KC_WBAK, KC_WFWD, KC_WSTP, KC_WREF, KC_WFAV = Web navigation shortcuts: search, home, back, forward, stop, refresh and favorites (bookmarks)

All of these keys were designed for Windows (except for KC_PCMM), and might not work on other OSes.
« Last Edit: Tue, 14 April 2015, 07:57:10 by p3lim »

Offline ctm

  • Posts: 424
  • Location: Seattle, WA
  • Hello, world!
Re: TMK keyboard firmware
« Reply #660 on: Tue, 14 April 2015, 09:19:52 »
Is there a way to have a dedicated ~ key?

Wouldn't this do it?

Code: [Select]
const uint16_t PROGMEM fn_actions[] = {   
   [0] = ACTION_MODS_KEY( MOD_LSFT, KC_GRV ),  // ~
}
Thank you!
TMK Alps64 w/ Matias Quiet Switches in KBP V60 case.
Infinity60 with SKCM Orange Switches w/ TMK.
CM Storm QRF w/ Frosty Flake controller, Cherry MX Blue Switches and TMK firmware.


Coming:
Ellipse Model F F62.

Offline Rose

  • Posts: 62
  • Location: Raleigh, NC

Offline Rose

  • Posts: 62
  • Location: Raleigh, NC
Re: TMK keyboard firmware
« Reply #662 on: Wed, 15 April 2015, 17:12:01 »
KC_APP = Right menu key (the key to the right of RWin on most keyboards)
KC_PCMM = Numpad comma key
KC_MAIL, KC_CALC, KC_MYCM = Starts mail, calc, explorer app
KC_WSCH, KC_WHOM, KC_WBAK, KC_WFWD, KC_WSTP, KC_WREF, KC_WFAV = Web navigation shortcuts: search, home, back, forward, stop, refresh and favorites (bookmarks)

If KC_APP is that lower right menu key then what is KC_MENU?  Also, what is the difference between KC_F1 and KC_FN1?  Thank you!

Offline spiceBar

  • Posts: 998
    • ChessTiger.com
Re: TMK keyboard firmware
« Reply #663 on: Wed, 15 April 2015, 17:40:54 »
KC_APP = Right menu key (the key to the right of RWin on most keyboards)
KC_PCMM = Numpad comma key
KC_MAIL, KC_CALC, KC_MYCM = Starts mail, calc, explorer app
KC_WSCH, KC_WHOM, KC_WBAK, KC_WFWD, KC_WSTP, KC_WREF, KC_WFAV = Web navigation shortcuts: search, home, back, forward, stop, refresh and favorites (bookmarks)

If KC_APP is that lower right menu key then what is KC_MENU?  Also, what is the difference between KC_F1 and KC_FN1?  Thank you!

KC_F1 is the standard F1 key on the keyboard.

KC_FN1 (and KC_FN2...) is an "Fn" key: a key you define to access another layer of functions. When you define such a key, you also have to give the full layer associated with it, and a little bit of glue code (a declaration) that links the key to its associated layer.

The TMK firmware allows you to define several Fn keys, to access several additional layers if necessary.

Look at the provided keymaps example to find out how.

I'm not sure about KC_MENU...

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #664 on: Wed, 15 April 2015, 18:53:11 »
It is used in UNIX keyboard, though I don't know how it works.

Rose, check this.
10. Keyboard/Keypad Page(0x07) p.53
http://www.usb.org/developers/hidpage/Hut1_12v2.pdf

Offline skullydazed

  • * Vendor
  • Posts: 307
  • Location: Bay Area, CA
  • Had to turn PM's off. Email info@clueboard.co!
    • Clueboard
Re: TMK keyboard firmware
« Reply #665 on: Wed, 15 April 2015, 21:07:59 »
I just wired up my own keyboard and I'm afraid I'm not sure how to modify tmk for what I did. Here's my matrix:





(For this version I have simply connected each half with wires from each row/column. I will figure out how to multiplex over TRRS for V2.)

Since I have a vertical stagger my diodes were not long enough to reach horizontally, so I wired it up vertically. However, I don't understand how to modify tmk for this situation. I've modified the gh60 keyboard and put this in matrix.c:

https://gist.github.com/anonymous/c241385cfbe34e8ac454

However, when I plug the keyboard in this is what I get:



Can anyone point me in the right direction here? Could software cause this, or do I definitely have a fault in my wiring?

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #666 on: Wed, 15 April 2015, 21:25:37 »
It seems to me like that code works well, check your hardware again.

Offline skullydazed

  • * Vendor
  • Posts: 307
  • Location: Bay Area, CA
  • Had to turn PM's off. Email info@clueboard.co!
    • Clueboard
Re: TMK keyboard firmware
« Reply #667 on: Wed, 15 April 2015, 21:46:49 »
Thanks hasu, I'll look over the wiring again, see if I can isolate what's shorted.

Offline VinnyCordeiro

  • Posts: 432
Re: TMK keyboard firmware
« Reply #668 on: Fri, 17 April 2015, 15:20:00 »
Status update:

I was getting tired of waiting for the arrival of some components to make changes in my proof-of-concept keyboard and tried the firmware upload method described at the GH60 GB thread. This keyboard is based on the GH60, so I thought it might work.

And it did! :D

The ATmega32U4 was recognized by Windows 7, which proved 2 things: even being my first time soldering an SMD component, my 20+ years of experience in electronics proved useful :cool:; and that the microcontrollers I bought at AliExpress weren't fake.

Firmware upload using ATMEL Flip was painless. Now I have to debug it, because of course I couldn't make everything right at the first try. Rows 1 and 2 are ok, but at rows 3 and 4 the keys at the same column are being registered as being pressed at the same time. Also Left Shift isn't working.

Probably tomorrow I'll have time to take a look at the board and see if I made a design mistake. If everything is ok, it'll be time to take a look at the code. I'll probably post it here tomorrow, for some advice on it.

And I would like to thank hasu for a nice job. Without tmk, this keyboard wouldn't be alive so fast. :D

EDIT:
Status update 2:

Multimeter confirmed a short circuit connecting rows 3, 4 and 5 (used just for the thumb spacebar). Repeated measurements on a spare, unpopulated board, no shorts. My only guess is a short circuit at the ATmega32U4, connecting pins 20, 21 and 22 (used on said rows). That's going to be a pain in the butt to correct this. Even considering to solder a new board, reusing almost all components. That will be postponed to another day.  :(

Status update 3:

Bored to death at home, tried to fix the board. Soldering iron + solder wick solved the short circuit, now the keyboard is working as designed.  :thumb: Now comes the use test in games.  :))
« Last Edit: Thu, 23 April 2015, 20:24:47 by VinnyCordeiro »

Offline neverused

  • Posts: 572
Re: TMK keyboard firmware
« Reply #669 on: Mon, 20 April 2015, 12:36:36 »
Hello,

While executing

Code: [Select]
make -f Makefile
I get the error

May I ask what may cause this and how to fix it?

I have both the Winavr and Teensyloader installed.

Thanks!


Here is a zip of my code in case anyone can help out:
https://drive.google.com/file/d/0ByOSi5aaJltDNkpfTlZ0TDFKRms/view?usp=sharing

Offline sypl

  • Posts: 116
Re: TMK keyboard firmware
« Reply #670 on: Mon, 20 April 2015, 15:08:01 »
Hello,

While executing

Code: [Select]
make -f Makefile
I get the error
Show Image


May I ask what may cause this and how to fix it?

I have both the Winavr and Teensyloader installed.

Thanks!


Here is a zip of my code in case anyone can help out:
https://drive.google.com/file/d/0ByOSi5aaJltDNkpfTlZ0TDFKRms/view?usp=sharing

You need to have make installed. What platform are you on? If windows you can download the package here: http://gnuwin32.sourceforge.net/packages/make.htm. Installation instructions are further down the page. Try it and come back if you have trouble.

Offline neverused

  • Posts: 572
Re: TMK keyboard firmware
« Reply #671 on: Mon, 20 April 2015, 16:50:17 »
Hello,

While executing

Code: [Select]
make -f Makefile
I get the error
Show Image


May I ask what may cause this and how to fix it?

I have both the Winavr and Teensyloader installed.

Thanks!


Here is a zip of my code in case anyone can help out:
https://drive.google.com/file/d/0ByOSi5aaJltDNkpfTlZ0TDFKRms/view?usp=sharing

You need to have make installed. What platform are you on? If windows you can download the package here: http://gnuwin32.sourceforge.net/packages/make.htm. Installation instructions are further down the page. Try it and come back if you have trouble.

Thank you, I downloaded the application and when I run the same command, I have the same issue.

What else should I try?

Thanks!

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #672 on: Mon, 20 April 2015, 16:55:45 »
I believe WinAVR includes make command already.

neverused, read WinAVR document for installation and follow it. I think you don't set Path yet.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #673 on: Mon, 20 April 2015, 18:19:04 »
The ATmega32U4 was recognized by Windows 7, which proved 2 things: even being my first time soldering an SMD component, my 20+ years of experience in electronics proved useful :cool:; and that the microcontrollers I bought at AliExpress weren't fake.

Nice to hear. I've procrastinated to place a order on small vendor in China, but it it time now.
To get the MCU from trusty sources at proper price is getting more and more difficult recently :(

Which seller did you use?

Offline neverused

  • Posts: 572
Re: TMK keyboard firmware
« Reply #674 on: Mon, 20 April 2015, 18:22:46 »
I believe WinAVR includes make command already.

neverused, read WinAVR document for installation and follow it. I think you don't set Path yet.

In reading the documentation, I didn't see a path that needs to be set for WinAVR... I did see the need to navigate to the path in CMD, i.e. 'C:\Users\Chris\Desktop\tmk_keyboard-master\keyboard\gh60' but when I do that and execute a 'make' command I still get the same error.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #675 on: Mon, 20 April 2015, 18:51:59 »
I guess PATH env was not set during WINAVR installation process for some reason, so you need to set PATH env. If you are not familiar with this kind of things, reinstall it.

EDIT: This may help you? http://winavr.sourceforge.net/WinAVR-user-manual.html


Or try this route.
https://github.com/tmk/tmk_keyboard/blob/master/doc/build.md#download-and-install
« Last Edit: Mon, 20 April 2015, 18:53:47 by hasu »

Offline VinnyCordeiro

  • Posts: 432
Re: TMK keyboard firmware
« Reply #676 on: Mon, 20 April 2015, 19:46:26 »
The ATmega32U4 was recognized by Windows 7, which proved 2 things: even being my first time soldering an SMD component, my 20+ years of experience in electronics proved useful :cool:; and that the microcontrollers I bought at AliExpress weren't fake.

Nice to hear. I've procrastinated to place a order on small vendor in China, but it it time now.
To get the MCU from trusty sources at proper price is getting more and more difficult recently :(

Which seller did you use?
This one: http://www.aliexpress.com/item/5pcs-lot-ATMEGA32U4-AU-ATMEGA32U4-ATMEL-TQFP-44-IC-8-bit-Microcontroller-with-16-32K-Bytes/1877422430.html and now it's $5 cheaper than when I bought.

Offline U47

  • Posts: 99
  • Location: YEG
Re: TMK keyboard firmware
« Reply #677 on: Thu, 23 April 2015, 23:20:23 »
Just throwing this out there, has anyone tried/had any luck compiling the TMK firmware for a Teensy 3.1? I've got a box of them doing nothing, so I figured I'd see if I can put them to use.

Offline BlueNalgene

  • Posts: 739
  • Location: Oklahoma, USA
Re: TMK keyboard firmware
« Reply #678 on: Fri, 24 April 2015, 01:50:06 »
Just throwing this out there, has anyone tried/had any luck compiling the TMK firmware for a Teensy 3.1? I've got a box of them doing nothing, so I figured I'd see if I can put them to use.

It won't work.  The 3.1 uses ARM architecture which isn't compatible with the AVR programming in the TMK.  If you would like to make an ARM variant, I would love to see it.  I am trying to make one now for the Teensy LC.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #679 on: Fri, 24 April 2015, 02:04:16 »
TMK works on ARM Cortex-M now, actually it runs on Infinity and NXP LPC board at least.
See keyboard/inifinity/ and tmk_core/tool/mbed/ directory. Not mature and clean enough  but it works.

TMK uses mbed.org SDK to support Cortex-M, so it will be easy to port MCU mbed.org supports theoretically. Teensy3.1 uses same family controller as Infinity and recently mbed.org added support of Teensy3.1. I think porting to Teensy is not so hard if you are familiar with mbed SDK.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #680 on: Fri, 24 April 2015, 09:30:43 »
l_b,
TMK includes the latest mbed SDK code now, so you don't need to download SDK separately. I didn't change my code actually but found current mbed SDK has a fix for Kinesis USB problem. It may cure the USB3 problem of TMK infinity.

I think it is worth trying again when you have a time.

FYI, the mbed SDK fix:
https://github.com/mbedmicro/mbed/commit/43113cf13ab02e1781755dd29140f93773dc6147

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

« Last Edit: Fri, 24 April 2015, 09:40:45 by hasu »

Offline BlueNalgene

  • Posts: 739
  • Location: Oklahoma, USA
Re: TMK keyboard firmware
« Reply #681 on: Fri, 24 April 2015, 11:32:38 »
TMK works on ARM Cortex-M now, actually it runs on Infinity and NXP LPC board at least.
See keyboard/inifinity/ and tmk_core/tool/mbed/ directory. Not mature and clean enough  but it works.

TMK uses mbed.org SDK to support Cortex-M, so it will be easy to port MCU mbed.org supports theoretically. Teensy3.1 uses same family controller as Infinity and recently mbed.org added support of Teensy3.1. I think porting to Teensy is not so hard if you are familiar with mbed SDK.

I know what my plans are this weekend!

Offline l_b

  • Posts: 26
    • vanutsteen.nl => nerds only
Re: TMK keyboard firmware
« Reply #682 on: Fri, 24 April 2015, 15:37:11 »
Wow, big update hasu! I really like the changes to the README.

With a usb3 port it throws the same error:

Code: [Select]
Apr 24 22:34:03 lola kernel: [  130.501061] usb 3-7: new full-speed USB device number 8 using xhci_hcd
Apr 24 22:34:03 lola kernel: [  130.629611] usb 3-7: unable to read config index 0 descriptor/start: -71
Apr 24 22:34:03 lola kernel: [  130.629613] usb 3-7: can't read configurations, error -71
Apr 24 22:34:03 lola kernel: [  130.741050] usb 3-7: new full-speed USB device number 9 using xhci_hcd
Apr 24 22:34:03 lola kernel: [  130.869761] usb 3-7: unable to read config index 0 descriptor/start: -71
Apr 24 22:34:03 lola kernel: [  130.869764] usb 3-7: can't read configurations, error -71
Apr 24 22:34:03 lola kernel: [  130.981113] usb 3-7: new full-speed USB device number 10 using xhci_hcd
Apr 24 22:34:03 lola kernel: [  130.997964] usb 3-7: unable to read config index 0 descriptor/all
Apr 24 22:34:03 lola kernel: [  130.997967] usb 3-7: can't read configurations, error -71
Apr 24 22:34:04 lola kernel: [  131.165138] usb 3-7: new full-speed USB device number 11 using xhci_hcd
Apr 24 22:34:04 lola kernel: [  131.181429] usb 3-7: device descriptor read/all, error -71
Apr 24 22:34:04 lola kernel: [  131.181460] usb usb3-port7: unable to enumerate USB device

Offline worldspawn

  • Posts: 329
  • Location: Austin, TX
Re: TMK keyboard firmware
« Reply #683 on: Mon, 27 April 2015, 09:16:12 »
I can't figure out what I'm doing here...  I've tried to adapt this firmware to my project, and I had a C programmer try to assist me, and we've gotten nowhere, this is really damn confusing, I have the primary and 1 function layer. It just does nothing after it's flashed.  I'm using an Atmega32U4 (just the chip, not a teensy).  Can someone put this into something that would actually work since I clearly have no idea what I'm doing, and I've spent weeks on this.

 matrix pins:
 Column pin configuration
 col: 0   1   2   3   4   5   6   7   8   9   10  11 
 pin: B4  B5  D6  D7  C7  B6  D3  B3  B7  D0  D1  D2 

 Row pin configuration
 row: 0   1   2   3   4
 pin: D5  C6  E2  B0  E6


#define KEYMAP( \
               K03, K04,          K07, K08,              \
    K10, K11, K12, K13, K14, K15,      K17, K18, K19, K1A, K1B,  \
    K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B,  \
    K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B,  \
    K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B,  \
) { \
    { KC_NO,    KC_NO,    KC_NO,    KC_##K03, KC_##K04, KC_NO,    KC_NO,    KC_##K07, KC_##K08, KC_NO,    KC_NO,    KC_NO    }, \
    { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_NO,    KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \
    { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \
    { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B }, \
    { KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47, KC_##K48, KC_##K49, KC_##K4A, KC_##K4B }  \
}


/* Keymap 0: Default Layer
     * ,---------------------------------------------------.
     * |             ESC|  \|             ;|  DEL          |
     * |---------------------------------------------------|
     * |   Q|  W|  E|  R|  T| ALT|        Y|  U|  I|  O|  P|
     * |---------------------------------------------------|
     * |   A|  S|  D|  F|  G| FN1| ENT|   H|  J|  K|  L|  '|
     * |---------------------------------------------------|
     * |  Z |  X|  C|  V|  B|LCTL|BSPC|   N|  M|  ,|  .|  /|
     * |---------------------------------------------------|
     * |   1|   2|  3|  4| 5| SPC|LSFT|   6|  7|  8|  9|  0|
     * `---------------------------------------------------'
     */
    KEYMAP(
                ESC,BSLS,          SCLN, DEL,                     \
        Q,   W,   E,   R,   T, ALT,        Y,   U,   I,   O,   P, \
        A,   S,   D,   F,   G, FN1, ENT,   H,   J,   K,   L,QUOT, \
        Z,   X,   C,   V,   B,LCTL,BSPC,   N,   M,COMM, DOT,SLSH, \
        1,   2,   3,   4,   5, SPC,LSFT,   6,   7,   8,   9,   0),
   
    /* Overlay 1
     * ,----------------------------------------------------------.
     * |             `|   -|                 =|  DEL              |
     * |----------------------------------------------------------|
     * |   Q|   W|   E|   R|  T| ALT|     PGUP|HOME|  UP| END|PSCR|
     * |----------------------------------------------------------|
     * |   A|   S|   D|   F|  G|    | ENT|PGDN|LEFT|DOWN|RGHT|   '|
     * |----------------------------------------------------------|
     * |  Z |   X|   C|   V|  B|LCTL| F12|   N|   M|   [|   ]|   /|
     * |----------------------------------------------------------|
     * |  F1|  F2|  F3|  F4| F5| F11|CAPS|  F6|  F7|  F8|  F9| F10|
     * `----------------------------------------------------------'
     */
    KEYMAP(
                     GRV,MINS,             EQL,BSPC,              \
        Q,   W,   E,   R,   T, ALT,     PGUP,HOME,  UP, END,PSCR, \
        A,   S,   D,   F,   G,TRNS, ENT,PGDN,LEFT,DOWN,RGHT,QUOT, \
        Z,   X,   C,   V,   B,LCTL, F12,   N,   M,LBRC,RBRC,SLSH, \
        F1,  F2,  F3,  F4,  F5, F11,CAPS,  F6,  F7,  F8,  F9, F10),


LEDs are on B1 and B2 for caps and Fn layer.
Command combo needs to be L Shift and alt(L Alt)
« Last Edit: Mon, 27 April 2015, 14:27:08 by worldspawn »
I can make acrylic laser cut cases/plates PM for info

Offline skullydazed

  • * Vendor
  • Posts: 307
  • Location: Bay Area, CA
  • Had to turn PM's off. Email info@clueboard.co!
    • Clueboard
Re: TMK keyboard firmware
« Reply #684 on: Mon, 27 April 2015, 12:07:41 »
I can't figure out what I'm doing here...  I've tried to adapt this firmware to my project, and I had a C programmer try to assist me, and we've gotten nowhere, this is really damn confusing, I have the primary and 1 function layer. It just does nothing after it's flashed.  I'm using an Atmega32U4.  Can someone put this into something that would actually work since I clearly have no idea what I'm doing, and I've spent weeks on this.

What does your matrix.c look like? It took a bit for me to grok what was going on there, but once I did I was able to get my keyboard working, and when I had it wrong a plain teensy with nothing connected would show keys held down. You have to modify all 4 functions correctly or it won't scan and reset the pins properly.

Offline worldspawn

  • Posts: 329
  • Location: Austin, TX
Re: TMK keyboard firmware
« Reply #685 on: Mon, 27 April 2015, 14:18:30 »
I can't figure out what I'm doing here...  I've tried to adapt this firmware to my project, and I had a C programmer try to assist me, and we've gotten nowhere, this is really damn confusing, I have the primary and 1 function layer. It just does nothing after it's flashed.  I'm using an Atmega32U4.  Can someone put this into something that would actually work since I clearly have no idea what I'm doing, and I've spent weeks on this.

What does your matrix.c look like? It took a bit for me to grok what was going on there, but once I did I was able to get my keyboard working, and when I had it wrong a plain teensy with nothing connected would show keys held down. You have to modify all 4 functions correctly or it won't scan and reset the pins properly.

At this point, I have no idea since I handed it off to my programmer buddy who is equally stumped by it after trying all last weekend.

My last post included all the pins and necessary info (AFAIK, which is the problem), could someone who knows how this mess actually works put together the matrix, keyboard layout, and make files based on those?
« Last Edit: Mon, 27 April 2015, 14:29:05 by worldspawn »
I can make acrylic laser cut cases/plates PM for info

Offline abjr

  • Posts: 171
  • Location: Connecticut
    • abjr.org
Re: TMK keyboard firmware
« Reply #686 on: Mon, 27 April 2015, 14:52:54 »
Try this in your matrix.c. Hopefully I didn't make any mistakes.
Code: [Select]
/*
 matrix pins:
 col: 7  0  1  5  8    4    9   10  11  6  2  3
 pin: B3 B4 B5 B6 B7   C7   D0  D1  D2  D3 D6 D7
*/
static void  init_cols(void)
{
    // Input with pull-up(DDR:0, PORT:1)
    DDRB  &= ~(1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7);
    PORTB |=  (1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7);

    DDRC  &= ~(1<<7);
    PORTC |=  (1<<7);

    DDRD  &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<6 | 1<<7);
    PORTD |=  (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<6 | 1<<7);
}

static matrix_row_t read_cols(void)
{
    return (PINB&(1<<3) ? 0 : (1<< 7)) |
           (PINB&(1<<4) ? 0 : (1<< 0)) |
           (PINB&(1<<5) ? 0 : (1<< 1)) |
           (PINB&(1<<6) ? 0 : (1<< 5)) |
           (PINB&(1<<7) ? 0 : (1<< 8)) |

           (PINC&(1<<7) ? 0 : (1<< 4)) |

           (PIND&(1<<0) ? 0 : (1<< 9)) |
           (PIND&(1<<1) ? 0 : (1<<10)) |
           (PIND&(1<<2) ? 0 : (1<<11)) |
           (PIND&(1<<3) ? 0 : (1<< 6)) |
           (PIND&(1<<6) ? 0 : (1<< 2)) |
           (PIND&(1<<7) ? 0 : (1<< 3));
}

/*
 Row pin configuration
 row: 0   1   2   3   4
 pin: D5  C6  E2  B0  E6
*/
static void unselect_rows(void)
{
    // Hi-Z(DDR:0, PORT:0) to unselect
    DDRB  &= ~0b00000001;
    PORTB &= ~0b00000001;

    DDRC  &= ~0b01000000;
    PORTC &= ~0b01000000;

    DDRD  &= ~0b00100000;
    PORTD &= ~0b00100000;

    DDRE  &= ~0b01000100;
    PORTE &= ~0b01000100;
}

static void select_row(uint8_t row)
{
    // Output low(DDR:1, PORT:0) to select
    switch (row) {
        case 0:
            DDRD  |= (1<<5);
            PORTD &= ~(1<<5);
            break;
        case 1:
            DDRC  |= (1<<6);
            PORTC &= ~(1<<6);
            break;
        case 2:
            DDRE  |= (1<<2);
            PORTE &= ~(1<<2);
            break;
        case 3:
            DDRB  |= (1<<0);
            PORTB &= ~(1<<0);
            break;
        case 4:
            DDRE  |= (1<<6);
            PORTE &= ~(1<<6);
            break;
    }
}
CM QFR | magicforce 68 (Gateron) | magicforce 68 (Outemu) | Acros 6311-K

Offline neverused

  • Posts: 572
Re: TMK keyboard firmware
« Reply #687 on: Tue, 28 April 2015, 14:16:50 »
Has any one built their firmware from a Raspberry Pi?  I am unfamiliar with Linux, so I do not know how to differentiate amongst distros or how that
would affect the ability to build the Makefile. 

Can anyone assist with this?

Thank you.

Offline metalliqaz

  • * Maker
  • Posts: 4951
  • Location: the Making Stuff subforum
  • Leopold fanboy
Re: TMK keyboard firmware
« Reply #688 on: Tue, 28 April 2015, 14:27:49 »
Has any one built their firmware from a Raspberry Pi?  I am unfamiliar with Linux, so I do not know how to differentiate amongst distros or how that
would affect the ability to build the Makefile. 

Can anyone assist with this?

Thank you.

If you have the regular Raspbian install, that is more or less a regular Linux desktop, so you should be able to follow any instructions for compiling on Debian-based systems.

Offline SecretV

  • Posts: 6
Re: TMK keyboard firmware
« Reply #689 on: Fri, 08 May 2015, 12:57:26 »
I just wanted to thank you guys for this great firmware you've created. I was able to use this to get my de-pcb'd manually rewired AEKII working using the gh60 portion of this firmware.  :thumb:

Offline MontyElephant

  • Posts: 5
Re: TMK keyboard firmware
« Reply #690 on: Sat, 09 May 2015, 05:40:00 »
Can someone help me out or point me in the right direction?

I'm building a gamepad that has 8 columns and 5 rows. I've double checked all the hardware and everything seems to be fine.

However, when I plug the keyboard into the computer it will start printing random keystrokes. Here is a sample:

Code: [Select]
5tgb 5tgb 5tgb 5tgb 5tgb 5tgb 5ptlgm5tg5tgggggggggg5tg5tgplm5tgplm5tg5tg5tgplm5tg5tgplm5tg5tg5tg5tg5tg5tgplmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tgplmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmplmplmplm5tg5tggggg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tg5tgg5tgv 5tgv 5tgv         5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv 5tgv
What is curious about this is that all those characters are in the last two columns. These keys get printed sometimes randomly or sometimes if I press a key (at least it seems to be a keypress response). If I press a key sometimes it will just keep typing out random stuff. Also, the groups such as 5tgb get printed all at once. To me, the fact that they are all in the same column seems to imply that it might(?) be a hardware issue but I want to rule out software before I rewire everything (took me like 3 hours)...

Just to clarify rows have diodes (all connected end-to-end and then to a the teensy) and columns just have wires going up the column correct?

If someone could look over the code in my repository (there isn't very much) that'd really help! Thanks!
https://github.com/joshtsen/tmk_keyboard/tree/master/keyboard/gh60

EDIT:

Okay so I've made some changes and now the last two columns work correctly but none of the other keys register output. All the keys in cols 6 and 7 (0-based) which are on PINB (whereas the rest are on PINF) work. However, there is one key on PINF7 row 3 that works. This caused me to think there might be something wrong with my init_cols or read_cols with PINF since PINB seems to work fine. I also tried changing the style of init_cols to the style of unselect_rows using binary:
Code: [Select]
static void  init_cols(void)
{
    // Input with pull-up(DDR:0, PORT:1)
    DDRF  &= ~0b11110011;
    PORTF |= ~0b11110011;
    DDRB  &= ~(1<<6 | 1<<5);
    PORTB |=  (1<<6 | 1<<5);
}

This makes it so that the last two columns still work fine but a keypress in any other column will print the entire column. So I'm pretty sure then the wiring is correct and it is software bug somewhere? helP?


EDIT2:

SO I think I've located part of the problem. I created a jumper wire to manually connect pins to each other and was able to recreate the entire matrix. Ok great. So then I started looking at the wiring again and it seems that only keys that pass through no more than 2 diodes work. I'm not sure if this has to do with my wiring the diodes wrong, or the pull-up on the controller?

EDIT3:

Well I'm an idiot. I guess I wired all the diodes wrong... good thing I have extras.... FML
« Last Edit: Sat, 09 May 2015, 16:24:54 by MontyElephant »

Offline Rose

  • Posts: 62
  • Location: Raleigh, NC
Re: TMK keyboard firmware
« Reply #691 on: Sun, 10 May 2015, 11:28:22 »
I'm so close to finishing my project! Thank you so much for this wonderful open source firmware.

I have been following matt3o's guide.  I just ran "make -f Makefile" and got the following error:
usr/bin/sh: dfu-programmer: command not found

Then it found an error at just about every step.
[ Specified attachment is not available ]

What may have caused this?
Thanks for your help!
« Last Edit: Sun, 10 May 2015, 11:30:15 by Rose »

Offline metalliqaz

  • * Maker
  • Posts: 4951
  • Location: the Making Stuff subforum
  • Leopold fanboy
Re: TMK keyboard firmware
« Reply #692 on: Sun, 10 May 2015, 11:54:11 »
Always fix the first error first.  Sounds like your keymap_common.h has an error around the definition of K2E.  The failure to complete parsing that file is probably leading to all the other errors.

Check to see if K2E is defined twice.  I'm not really familiar with TMK code, so I can't really pinpoint it for you.  Good luck!

Offline Rose

  • Posts: 62
  • Location: Raleigh, NC
Re: TMK keyboard firmware
« Reply #693 on: Sun, 10 May 2015, 12:06:13 »
Wow thanks.  K2E was defined twice.   How could you see that?
I fixed that but still get a similar result. 

Offline Rose

  • Posts: 62
  • Location: Raleigh, NC
Re: TMK keyboard firmware
« Reply #694 on: Sun, 10 May 2015, 12:07:35 »
Always fix the first error first. 
is the "usr/bin/sh: dfu-programmer: command not found" not the first error?

Offline metalliqaz

  • * Maker
  • Posts: 4951
  • Location: the Making Stuff subforum
  • Leopold fanboy
Re: TMK keyboard firmware
« Reply #695 on: Sun, 10 May 2015, 12:09:15 »
Always fix the first error first. 
is the "usr/bin/sh: dfu-programmer: command not found" not the first error?

That's not a compiler error, so it doesn't really matter yet.

Offline metalliqaz

  • * Maker
  • Posts: 4951
  • Location: the Making Stuff subforum
  • Leopold fanboy
Re: TMK keyboard firmware
« Reply #696 on: Sun, 10 May 2015, 12:10:25 »
Wow thanks.  K2E was defined twice.   How could you see that?
I fixed that but still get a similar result.

Make sure your keymap_poker.c has the appropriate #include statements that it needs.  It can't find the definition of KEYMAP

Offline Rose

  • Posts: 62
  • Location: Raleigh, NC
Re: TMK keyboard firmware
« Reply #697 on: Sun, 10 May 2015, 12:22:05 »
Thank you so much for your help.  I was able to generate a .hex file.
On to the next step!

Offline Rose

  • Posts: 62
  • Location: Raleigh, NC
Re: TMK keyboard firmware
« Reply #698 on: Sun, 10 May 2015, 21:00:52 »
Yes!  Thank you hasu and everyone else.  My keyboard is working.  I pretty much followed matt3o's tutorial and had your firmware working in a day. Not bad for someone with zero C programming experience.

The only thing that I haven't figured out are my LEDs.  It was my intention to have one for capslock and one or two others for layer indicators.  After reading this entire thread it sounds like there is no simple way to setup the layer lights.  I thought I was setting up a capslock LED with matt3o's guide but that isn't lighting up either.  I am not 100% sure that I have things wired correctly.  Here is how they are wired:

Pin C7 goes to a resistor, then to the longer anode.
I have LEDs connected on D7 and F7 in the same way. 
Then I have a wire that goes from one of the ground pins on the teensy to each LED's cathode.
Is this the correct way to ground them?

I modified the led.c file to this:
Code: [Select]
#include <avr/io.h>
#include "stdint.h"
#include "led.h"

void led_set(uint8_t usb_led)
{
    if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
        // output low
        DDRC |= (1<<7);
        PORTC &= ~(1<<7);
    } else {
        // Hi-Z
        DDRC &= ~(1<<7);
        PORTC &= ~(1<<7);
    }
}

I tested each LED so I know they are working.  What do you think?  Is my problem hardware or software?

Thank you so much everyone.  A few months ago I new nothing about keyboards and had never touched a mechanical one.  Now I've designed and built my own.  I'll share same pics after I'm done with a few finishing touches.

Offline hasu

  • Thread Starter
  • Posts: 3471
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: TMK keyboard firmware
« Reply #699 on: Tue, 12 May 2015, 01:01:20 »
It looks like your LEDs are wired correctly but code is reversed. C7 should be high instead of low when LED turns on if the pin is connected to anode.

Not sure, I may miss something.

You can post pics, schematic and code to give us better understanding, some of us are not native to English and the language may not be the easiest nor fastest to understand, in particular between non-natives. Even if you are native and your English is decent posting photos will be useful sometime.