Hello ! I’m currently developing an rp2040-based mechanical keyboard that makes use of dip-switches to enable features in the keymap on the fly. They are defined as standard switches, as far as ZMK is concerned, and trigger &mo behaviors. The problem is that under the right conditions (see below), if one of those switches (or any other key for that matter) is held on when the keyboard plugged into the computer, the keyboard crashes / isn’t able to boot with no logs available.
To replicate this bug:
- have a keyboard using an rp2040
- run ZMK on the main branch with ZMK studio
- hold any key (can even be a
&none behavior) that isn’t controlled by an io-expander
- plug the keyboard into a
Windows or MacOS computer (Linux does not have this issue)
- keyboard doesn’t respond
[EDIT]: The next two paragraphs are wildly off, you can safely ignore them.
I’m not really sure what could even trigger this issue, but since it only happens when ZMK Studio is enabled and is OS-specific (since it works fine on Linux), I’m guessing that the issue is related to the USB communication between the keyboard and the computer, that this communication interrupts something important during the startup of the rp2040 (or maybe accesses uninitialized ressources ?), and that Linux doesn’t do this at the same time as the other OS, so it doesn’t trigger the issue.
If this assumption is true, that would mean the bug probably resides somewhere in the studio_rpc_listener_cb function in app/src/studio/rpc.c, as this seems to be the only non-BLE event listener specific to zmk-studio.
Right now, I could only test this on a couple of custom boards. Here are the links to their .dts files, in case the issue is on my end:
Hello ! I’m currently developing an rp2040-based mechanical keyboard that makes use of dip-switches to enable features in the keymap on the fly. They are defined as standard switches, as far as ZMK is concerned, and trigger
&mobehaviors. The problem is that under the right conditions (see below), if one of those switches (or any other key for that matter) is held on when the keyboard plugged into the computer, the keyboard crashes / isn’t able to boot with no logs available.To replicate this bug:
&nonebehavior) that isn’t controlled by an io-expanderWindows or MacOScomputer(Linux does not have this issue)[EDIT]: The next two paragraphs are wildly off, you can safely ignore them.
I’m not really sure what could even trigger this issue, but since it only happens when ZMK Studio is enabled and is OS-specific (since it works fine on Linux), I’m guessing that the issue is related to the USB communication between the keyboard and the computer, that this communication interrupts something important during the startup of the rp2040 (or maybe accesses uninitialized ressources ?), and that Linux doesn’t do this at the same time as the other OS, so it doesn’t trigger the issue.
If this assumption is true, that would mean the bug probably resides somewhere in the
studio_rpc_listener_cbfunction inapp/src/studio/rpc.c, as this seems to be the only non-BLE event listener specific to zmk-studio.Right now, I could only test this on a couple of custom boards. Here are the links to their
.dtsfiles, in case the issue is on my end: