#ble chiffre firmware help

1 messages · Page 1 of 1 (latest)

minor sundial
#

Hi all, I'm working on getting the firmware for a new board up and running. I've been running into this error le_jlwffre.keymap:42 (column 33): parse error: expected number or parenthesized expression but I'm honestly not sure why it is expecting that syntax there. I've checked this against ZMK documentation, and the keymap file was copied from one of my other boards that compiles fine...

The file in question is here: https://github.com/josh-l-wang/zmk-config-jlw/blob/main/boards/arm/le_jlwffre/le_jlwffre.keymap

Thanks in advance!

vagrant patrol
#

You're missing the include(s) to bring in the HID key definitions, e.g. #include <dt-bindings/zmk/keys.h> in the top of the keymap.

#

So ESC doesn't get replaced by the C preprocessor, so when the devicetree compiler is compiling, instead of a number there, it's some random text, so it's unhappy.

minor sundial
#

Oh oops

#

Thanks for the quick reply. I’ll be back to this thread as I work through the soft off feature and try to get it up and running

minor sundial
# minor sundial Thanks for the quick reply. I’ll be back to this thread as I work through the so...

to this end, I was confused by the documentation. I referenced ebastler's cornholius for my PCB design. It uses a matrix-integrated hardware combo. In my case, I have an AND gate attached to the pins of the matrix positions 5,0 through 5,2 (three alpha keys of the inner column of the right hand)

Thus far, I've added the wakeup-source to kscan0, and the soft off behavior instance to my .dts file.

#
  1. When I go to add the GPIO pin that the AND gate is attached to, do I add it to the column list since it is going down a column? or does it not matter?

  2. in the side_band_behavior_triggers section, would I denote column as 10 and row as 0? since I added it to the end of the column list?

  3. then for updating chosen, I already have zmk,kscan = &kscan0; in that section. Am I to keep this as well, or change kscan0 to &side_band_behavior_triggers?

minor sundial
#

I'm guessing because I haven't implemented the point in question 3 above, that is why I'm getting this build error: devicetree error: /side_band_behavior_triggers: undefined node label 'kscan'

#

Okay I’ve moved past this part… I found the blank slate config so I’m going to reference that a bit more

minor sundial
#

okay i got it to build apartyblob

#

unrelated/related question. in the blank slate config, there is leds { compatible = "gpio-leds"; blue_led: led_0 { gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>; }; };

how is this LED meant to be controlled?

vagrant patrol
minor sundial
#

Oh I see I see

#

I’ll just define both of my LEDs in the firmware and leave it there then

vagrant patrol
minor sundial
#

okay coming back to the soft off feature. I think I've defined it correctly in my .dts file... but I am not getting it to trigger after holding the keys for 5 seconds

#

I'm using a hardware AND gate, linking up the keys of the inner right hand column, in rows 0-2 (keys Y H N on a normal qwerty layout)... and I've added it in as a new row GPIO in my .dts file... not sure if that is correct or if it should be a column

#

here is how the relevant column is defined in the schematic (wk is the wake AND gate)

vagrant patrol
#

Does it sleep but not wake up?

#

You need to add the necessary extra output pin to the wakeup source.

#

To drive the correct column.

minor sundial
vagrant patrol
#

!logging

#

Stupid bot.

minor sundial
#

hahaha

#

I'm setting it up now

minor sundial
# vagrant patrol !logging

it seems like this line is triggered when I push the sleep/wake combo: [00:01:48.090,637] <wrn> zmk: Not found in transform: row: 4, col: 5, pressed: true

vagrant patrol
#

Since that's the column it's tied into.

minor sundial
#

oh I see

vagrant patrol
#

(Blank slate happens to use column 0, but yours doesn't)

minor sundial
#

right. I remember looking at that line and thinking about it, and then just blithely moving on

vagrant patrol
#

So that the column5 pin is set high when the device sleeps.

#

That way it'll drive the AND gate when it's pressed.

#

That'll help it then properly wake again.

minor sundial
#

uh

#

A bit stumped

vagrant patrol
minor sundial
#

is it more than what I've added so far?

#

oh let me look at your linked code

vagrant patrol
#

Normally, the matrix kscan setting the column active to detect interrupts.

minor sundial
#

I see I see

vagrant patrol
#

But for soft off, the matrix kscan has its PM callback run to suspend

#

Which makes it deinit all the pin setup

#

So our wakeup trigger needs to then set that column active again right before turning off.

minor sundial
#

so the extra-gpios just get tied to the column pin that the AND gate is connecting

#

column 5 in my case

vagrant patrol
#

Exactly right.

#

That'll make sure that gpio pin is high during soft off.

#

Otherwise pressing the three keys won't wake the keeb, none of the AND gate inputs would actually be high.

minor sundial
#

oh sweet it works now, I think

vagrant patrol
#

Wake should make the LED flash from the bootloader, if the bootloader is set up right.

minor sundial
#

I think I am a bit confused on the timing. So sleep, you have to hold it for the whole time defined. But wake, you do not

vagrant patrol
#

Correct

#

It's actually super hard to make hold to wake do that correctly

#

Funky edge cases.

minor sundial
#

and it takes a second to wake it seems

#

My LED is just the one tied to the charge circuit and so far 2 undefined GPIO pins... It should still flash? I would assume no

vagrant patrol
#

No user LED tied to a GPIO?

#

The charge LED won't flash, no

minor sundial
#

It's a dumb RGB LED

#

R is tied to charge, G and B are on GPIOs

vagrant patrol
#

Oh!

#

And did you set up the adafruit bootloader to drive G or B pin?

#

If not, worth adjusting/creating a custom bootloader

minor sundial
#

oh right. I don't think I did that. I think I can grab ebastlers if it is set up correctly

vagrant patrol
#

Not hard to craft a new board definition for the bootloader

#

Then you get to name the storage volume, USB info, etc.

minor sundial
#

oh that would be nice

vagrant patrol
#

My boards all get customized bootloaders.

#

So the drive name matches the product, etc.

#

And then INDEX.HTM can point to a custom URL too

minor sundial
#

yeah that makes sense

#

ooh. okay I will dig around and see if I can't figure something out

#

is it as simple as forking the adafruit bootloader repo, and adding a folder in src/boards?

#

Oh I did not read the readme.md

vagrant patrol
minor sundial
#

This file is listed in the build folder:

vagrant patrol
minor sundial
#

hm okay

vagrant patrol
#

Should be able to pip install it

#

e.g. pip install intelhex

minor sundial
#

oh this is just another adventure in "I didn't read the prerequisites"

vagrant patrol
#

And then it's a matter of if you were using a NoSD bootloader before or not.

minor sundial
#

make: adafruit-nrfutil: No such file or directory blobsadrain

minor sundial
#

this is just me rubber ducking, but I installed adafruit-nrfutil, then when i type in adafruit-nrfutil --help, i get: zsh: command not found: adafruit-nrfutil

vagrant patrol
#

How'd you install it?

#

Often that can be a python/pip local PATH issue.

#

e.g. mine from pip install to ~/.local/bin which I've got added to my PATH.

minor sundial
#

pip3 install --user adafruit-nrfutil

vagrant patrol
#

Yeah, check your PATH for sure.

minor sundial
#

okay fixed by uninstalling and not including the --user flag when installing

vagrant patrol
#

Nice.

minor sundial
vagrant patrol
#

SD isn't used at all by zmk

minor sundial
#

Does it matter whether I flash one with or without soft device?

vagrant patrol
#

So, since you are making your own bootloader, you could flash the no. SD variant, and then update your flash partitions to reclaim that space

#

If you take a look at the blank slate board DTS file, you can see that the flash partition offsets are different, because I'm not wasting space for soft device

#

For generic devices, like the nice nano or the xiao, it makes sense to include the soft device because that is used by things like circuit python

minor sundial
#

but it works!

#

and the green light is on in bootloader mode

vagrant patrol
#

(I personally like blue for bootloader/user, but you do you)

minor sundial
#

now to disassemble the built one and flash it again....

vagrant patrol
#

In theory you can use the uf2 update that got built to update the bootloader there....

minor sundial
#

oh hm

vagrant patrol
#

Never actually tried it, worst case you still have to open up the case.

minor sundial
#

I would just go to bootloader mode and drag over the .uf2 from the adafruit folder?

vagrant patrol
#

There's a special update uf2 that adafruit bootloader builds... In theory just copy that over to the mass storage device on the one you want to update

vagrant patrol
#

@minor sundial dying to know if it works.

minor sundial
#

Oh sorry. Running around doing errands

vagrant patrol
#

Heh, all good.

minor sundial
#

I will test later today

minor sundial
minor sundial
#

I've noticed that the PCB tends to randomly stop working over bluetooth. It reconnects and works fine once I open the Windows bluetooth settings window, or connect it via USB...

#

I don't have to reconnect it through the OS, it shows as connected, and then magically starts working again

#

Not sure what could be causing it

vagrant patrol
#

Does it happen with any other operating system /host?