NerD60 - TMK Conversion / It works !!!

netcelli

26 Feb 2017, 11:43

Hi,

I just converted my Nerd 60 2.0 PCB and it worked fine :D
I have a problem that may be firmware related. The keyword is detected correctly on Mac OS but doesn't work for at least a minute! It takes 2-3 seconds on Windows.
I just flashed the standard keymap from the Git repo.
I can confirm that the bootloader was properly flashed and the hfuse properly set.

Any idea what the problem may be?

Thanks

User avatar
Stabilized

10 Mar 2017, 11:23

DanielT wrote: Yes, QMK works too, MrRooks did a fork of QMK for NerD60 and had success with installing this firmware.
This is the link to his GitHub repo : https://github.com/MrRooks/qmk_firmware
You you are able to add new features please share them ! It would be nice to have fancy lights controls for NerD60 like pulsating lights, control of the underglow etc ... 8-)

I'm glad that people are finding this guide useful ;)
Not been on here a while and stopped using my Nerd60 back light as it was just too damn bright!
This looks really promising for a solution to implement brightness levels and possibly even breathing :o
I gotta dust off my USBasp and give this a shot.

User avatar
Stabilized

10 Apr 2017, 15:23

So it took me about a month to actually get around to doing this, but QMK backlight level definitely does work. The only problem is that the caps lock and PCB backlighting is not defined.
They are defined and work well in the TMK firmware, would there be someway to transpose them from that into the QMK firmware to get all three backlights working?

User avatar
kekstee

29 May 2017, 00:24

Alright, I felt like looking at the tmk code to figure out a way to do brightness control on the backlight.
For now I sacrificed the separation of switch and pcb backlight I had previously, but with some changes to the core code it can be done. It would just need another set of backlight functions or incompatible changes to the existing one and its eeprom storage. For now this just touches the keyboard specific backlight configuration.

The PB6 and PB7 pins can be PWM controlled with a timer, and luckily there is a small example of static brightness setting in orphaned phantom code:
orphan/phantom/matrix.c.

So I basically just take that, kill the PWM at brightness zero and scale the brightness levels. The tmk core can set and save 128 brightness levels, but I end up scaling just 8 steps to useful values in the 8 bit range.
You could probably get a brightness hook into the main loop and do some fancy backlight cycling in a similar way.
backlilght.c

Code: Select all

void backlight_init_ports()
{
/*
 *    The backlight LED pins PB6 and PB7 can be
 *    controlled through the output compare values in
 *    OCR1C and OCR1B.
 *    Counter1 is set to Fast PWM 8-bit mode with
 *    a prescaler divisor of 256. (WGM10, WGM12, and CS12 bits
 *    set in the control registers A/B)
 *
 *          f_clk      16000000
 *    f = --------- = ----------- =~ 244Hz
 *        N*(1+TOP)   256*(1+255)
 *
 *    The comparision port is set to low once the counter matches
 *    our compare value (COM1x1 bit set in control register).
 *    Setting the compare register (OCR1x) to BOTTOM (=0)
 *    results in a narrow spike for each TOP+1 cycle.
 *    So the comparison output is deactivated to reach
 *    zero output.
 */

    // Timer/Counter1 Control Registers
    TCCR1A |= (1<<WGM10);
    TCCR1B |= (1<<WGM12) | (1<<CS12);

    // Enable output pins
    DDRB |= 0b11100000; // PB7 (switch), PB6 (pcb), PB5 (caps)

    // PB6 and 7 are only used by output compare
    PORTB &= ~0b11000000;
}

void backlight_set(uint8_t level)
{
    if (level == 0) {
        // Disable comparison
        TCCR1A &= ~((1<<COM1C1) | (1<<COM1B1));
    } else {
        // Enable comparison
        TCCR1A |= (1<<COM1B1) | (1<<COM1C1);
        uint8_t scaled = level * level * BACKLIGHT_SCALE - 1;
        OCR1B = scaled; // Output compare register 1B (PB7 - switch)
        OCR1C = scaled; // Output compare register 1C (PB6 - pcb)
    }
}
(commits:
https://github.com/kekstee/tmk_keyboard ... 8b849b20e7
https://github.com/kekstee/tmk_keyboard ... 7782d56c46)


// edit
Just duplicated the tmk backlight stuff and named it backlightb, so now I can control switch and PCB backlight independently on my NerD60. It's on a different branch for now - there are probably more elegant ways to extend backlight scaling to different sets of LEDs.

User avatar
Khers

28 Jul 2017, 13:47

With the help of DanielT's wiki guide, kekstee's TMK repo and some geeks in the Telegram channel (thanks DanielT, kekstee and scottc, you're awesome!), I recently got my NerD converted and everything as nice as it could be, except for one nagging little issue.

Every time the computer has been rebooted or gone to sleep, or if the keyboard is plugged in, it takes a full minute until it starts sending scan codes. This behaviour makes for an unnecessarily lengthy log on process, unless I want to have multiple keyboards plugged in.

Now, it would seem that this is a mac-specific issue as the keyboard exhibits the same kind of behaviour on both the macs I've tried it on, while it works as expected on my RPi running raspbian.

Has anyone experienced anything like this, or has any leads as to what could be at fault?

User avatar
kekstee

09 Sep 2017, 14:23

One of the issues with TMK on the NerD60 2.10 is resetting the board without ISP or having a magic key combination in firmware.
Given the current fuse settings efuse=0xC3 the HWBE bit is already enabled.

So shorting the HWB and GND pins directly at the chip during reset does the trick and the board loads the bootloader as it should. Unfortunately that's pretty impractical.

I mean, it does kind of solve the problem of flashing without an ISP nearby or having no keys installed to press some combination at least.

Now if someone could figure out if that pin is actually routed somewhere more easily accessible with a ground nearby that would be perfect. Couldn't find a solution to the problem, but then again my tools were a pair of tweezers.

User avatar
MrMen

05 Sep 2019, 00:41

Hi guys,
After being away from Keyboard I decided to give my Gon PCB a new life with TMK.

Everything is fine except on my last make, I missed LSFT... at the moment I’m absolutely unable to go into DFU.

Shorting GND and RST meens put a wire between these two holes ? Because when I’m doing that nothing happen.
Is there any way to go into DFU in my case ?

Thanks for any help guys.

Post Reply

Return to “Workshop”