Need help with TMK.

Maybeplanck

22 Feb 2016, 14:06

Hi
I need some help with understanding and installing TMK firmware on Teensy 3.0
My first goal is to install one of TMK keyboards on Teensy 3.0 and ultimately write my own firmware based on TMK.

1. What does change in Build Firmware and Program Controller for Teensy 3.0 (ARM processor MK20DX) ?
2. What changes do I need to make in tmk_keyboard/keyboard/ to make it work for Teensy 3.0 ?
3. What does converter do? Do I need to have it when making my own firmware?
4. Where can I learn more about making a keyboard firmware?

As you can see by the question I am noob here and my knowledge about keyboards is almost non-existing.

ReleaseCandidate

22 Feb 2016, 14:15

Maybeplanck wrote: Hi
I need some help with understanding and installing TMK firmware on Teensy 3.0
My first goal is to install one of TMK keyboards on Teensy 3.0 and ultimately write my own firmware based on TMK.

1. What does change in Build Firmware and Program Controller for Teensy 3.0 (ARM processor MK20DX) ?
You need an ARM crosscompiler and tools instead of the Atmel toolchain.
Maybeplanck wrote: 2. What changes do I need to make in tmk_keyboard/keyboard/ to make it work for Teensy 3.0 ?
Change the Atmel specific code to ARM code.
Maybeplanck wrote: 3. What does converter do? Do I need to have it when making my own firmware?
No, you don't need it if you're controlling the keyboard 'directly'.
Maybeplanck wrote: 4. Where can I learn more about making a keyboard firmware?
Depend's on what exactly you want to know.

Maybeplanck

24 Feb 2016, 19:21

You need an ARM crosscompiler and tools instead of the Atmel toolchain.
Will this work https://launchpad.net/gcc-arm-embedded/+download ?
Change the Atmel specific code to ARM code.
What that code would be for gh60? Is there any tutorial for doing that?
Depend's on what exactly you want to know.
I want to make firmware from ground up but i don't know where to start.

User avatar
jou

24 Feb 2016, 19:59

Maybeplanck wrote:
You need an ARM crosscompiler and tools instead of the Atmel toolchain.
Will this work https://launchpad.net/gcc-arm-embedded/+download ?
Yep, that's the toolchain you need for embedded ARM.
Maybeplanck wrote:
Change the Atmel specific code to ARM code.
What that code would be for gh60? Is there any tutorial for doing that?
GH60 already has a controller (an ATmega32U4) on it, so you don't need a teensy to drive the keyboard. You'd need the Teensy if you're going to build your keyboard from the ground up (e.g. by hand wiring it).
Maybeplanck wrote:
Depend's on what exactly you want to know.
I want to make firmware from ground up but i don't know where to start.
If you're just starting out, it's probably easier to start with an ATmega (e.g. a Teensy 2.0) since that what TMK supports best and it's more commonly used for DIY keyboards.

User avatar
flabbergast

24 Feb 2016, 21:40

Maybeplanck wrote: I want to make firmware from ground up but i don't know where to start.
That's a very tall order.

If you're just starting to learn, TMK is not the best way to start - by now it's quite complicated, the source code is not very transparent, because the goal wasn't transparency, but modularity. TMK has several layers, and in some layers there are several (mutually exclusive) possibilities of what code will actually be used (and all this is configurable in the Makefiles).

There are three "basic" layers: 1) communicating with the MCU's USB controller; 2) reading the matrix, etc; and 3) the keyboard/layout logic.

The first two are MCU-dependent, the last one is not. This separation by itself introduces quite a bit of complexity into the code.

Traditionally, 1) and 2) are done for ATMEL's AVR8 MCUs (e.g. atmega32u4) and this is by now extremely well tested code.
There are now two options for 1) and 2) for ARM MCUs (e.g. the ones that are in the Teensies 3.x or LC): one based on mbed, and one based on chibios. This code is not well tested yet, and has been integrated into TMK only recently.

---

It all pretty much depends on how much experience you have with programming microcontrollers (both AVR and ARM).

EDIT: I'm not aware of any good guides out there, I learned the stuff by studying existing code, but definitely not TMK. Good places to look are Teensyduino sources and some examples on PJRC website. However this already assumes that you have a very good background in how the MCUs work, can look up things in datasheets and things like that. There's a lot more relevant code for AVR8 than for ARM.

Maybeplanck

24 Feb 2016, 22:01

GH60 already has a controller (an ATmega32U4) on it, so you don't need a teensy to drive the keyboard. You'd need the Teensy if you're going to build your keyboard from the ground up (e.g. by hand wiring it).
I am trying to make keyboard from ground up, something similar to planck. I already have Teensy 3.0 so that's why I want to "convert" some of ATmega32U4 keyboards to MK20dx128.
If you're just starting out, it's probably easier to start with an ATmega (e.g. a Teensy 2.0) since that what TMK supports best and it's more commonly used for DIY keyboards.
Teensy 2.0 is a bit pricey, and I already have Teensy 3.0
There is Leonardo Pro Micro for $5 but only have 12 digital I/O and that's 36 keys.
I need at least 47 keys.

User avatar
flabbergast

24 Feb 2016, 22:40

Maybeplanck wrote:
If you're just starting out, it's probably easier to start with an ATmega (e.g. a Teensy 2.0) since that what TMK supports best and it's more commonly used for DIY keyboards.
Teensy 2.0 is a bit pricey, and I already have Teensy 3.0
There is Leonardo Pro Micro for $5 but only have 12 digital I/O and that's 36 keys.
I need at least 47 keys.
You'll save yourself a lot of headaches if you go with an atmega32u4-based board.
BTW on Arduino Pro Micro, pins A0 - A5 can be used as digital pins (it's just that they *also* have analog functionality), so that board has enough pins for a 47-key keyboard.

EDIT: There's a "onekey" example for Teensy 3.x in TMK mainline now, here (use Makefile.3.0).

Maybeplanck

26 Feb 2016, 18:50

BTW on Arduino Pro Micro, pins A0 - A5 can be used as digital pins (it's just that they *also* have analog functionality), so that board has enough pins for a 47-key keyboard.
Well nice I didn't know I could use analog pins as digital.
On Arduino Pro Micro I can only see A0-A3. A4 and A5 are PF0 and PF1 on ATmega32U4 but it seems they aren't connected anywhere. Can I solder directly on ATmega32U4 PF0 and PF1 and use them?

Edit: Looking at this Arduino Pro Micro pinout can I use pins TX and RX as I/O pins?
Last edited by Maybeplanck on 26 Feb 2016, 19:20, edited 1 time in total.

User avatar
Halvar

26 Feb 2016, 19:10

Can I solder directly on ATmega32U4 PF0 and PF1 and use them?
Sure, I don't see any reason why not (well except it's going to be hard mechanically).

Pro Micro Schematic: http://cdn.sparkfun.com/datasheets/Dev/ ... o_v13b.pdf
Last edited by Halvar on 26 Feb 2016, 20:56, edited 1 time in total.

Maybeplanck

26 Feb 2016, 19:26

Thank you so much for help.
I will order one Pro Micro

User avatar
jou

26 Feb 2016, 20:04

If you're desperate for additional IO pins, you can also solder to the resistor of the LEDs at the bottom (with the micro USB connector at the top). They're PB0 and PD5. They'd be a lot easier to solder onto than those QFN pads…

User avatar
Halvar

26 Feb 2016, 20:55

Maybeplanck wrote: Edit: Looking at this Arduino Pro Micro pinout can I use pins TX and RX as I/O pins?
Yes, no problem.

Post Reply

Return to “Keyboards”