Written by Pete Johanson, ZMK Project Creator
This blog originally ran on Pete’s website. For more content like this, click here.
- Upgrade to LVGL 8.x API, and move to the new Kconfig settings.
- Tons of RP2040 work.
- Zephyr core API changes, including DTS
- Move to pinctrl Zephyr subsystem.
Getting The Changes
Use the following steps to update to the latest tooling in order to properly use the new ZMK changes:
User Config Repositories Using GitHub Actions
Existing user config repositories using Github Actions to build will pull down Zephyr 3.2 automatically, however if you created your user config a while ago, you may need to update it to reference our shared build configuration to leverage the correct Docker image.
Replace the contents of your
If it doesn’t exist already, add a new file to your repository named
and then update it as appropriate to build the right shields/boards for your configuration.
Upgrade a manual script
If you have a custom GitHub Actions workflow you need to maintain for some reason, you can update the workflow to to use the
stable Docker image tag for the build:
.github/workflows/build.ymlin your editor/IDE
zmkfirmware/zmk-build-arm:stablewherever it is found
- Locate and delete the lines for the DTS output step, which is no longer needed:
VS Code & Docker (Dev Container)
If you build locally using VS Code & Docker then:
- pull the latest ZMK
git pullfor your ZMK checkout
- reload the project
- if you are prompted to rebuild the remote container, click
- otherwise, press
Remote Containers: Rebuild Container
- Once the container has rebuilt and reloaded, run
west updateto pull the updated Zephyr version and its dependencies.
Once the container has rebuilt, VS Code will be running the 3.2 Docker image.
Local Host Development
The following steps will get you building ZMK locally against Zephyr 3.2:
- Run the updated toolchain installation steps, and once completed, remove the previously installed SDK version (optional, existing SDK should still work)
- Install the latest version of
pip3 install --user --update west.
- pull the latest ZMK
git pullfor your ZMK checkout
west updateto pull the updated Zephyr version and its dependencies
From there, you should be ready to build as normal!
A few testers have reported inconsistent issues with bluetooth connections on Windows after upgrading, which can be resolved by re-pairing your keyboard by:
- Remove the device from Windows.
- Clear the profile on your keyboard that is associated with the Windows device by triggering
&bt BT_CLRon your keymap while that profile is active.
- Restart Windows.
- Re-connect Windows to your keyboard.
Windows Battery Reporting Fix
Zephyr 3.2 introduced a new Kconfig setting that can be used to work around a bug in Windows related to battery reporting. Check out our bluetooth config for the full details. The key new configuration that can be set if using Windows is:
Due to conflicts with new devicetree node labels added for Zephyr’s reset system, the
&reset behavior has been renamed to
All of the in-tree keymaps have been fixed, but you may encounter build failures about duplicate names, requiring you rename the behavior reference in your keymap. Use the Keymap Upgrader and this will get fixed for you automatically.
The following changes have already been completed for all boards/shields in ZMK
main branch. For existing or new PRs, or out of tree boards, the following changes are necessary to properly work with the latest changes.
Before this change, setting up the details of pins to use them for peripherals like SPI, I2C, etc. was a mix of platform specific driver code. Zephyr has moved to the newer
pinctrl system to unify the handling of pin configuration, with additional flexibility for things like low power modes for those pins, etc.
Board specific shield overlays
The main area this affects existing shields is those with board specific overrides, e.g.
<shield>/boards/seeeduino_xiao_ble.overlay, that sets up additional components on custom buses, e.g. addressable RGB LEDs leveraging the SPI MOSI pin.
nRF52 Pin Assignments
Previously in ZMK, we relied on per-driver devicetree source properties to set the alternate pin functions for things like SPI or I2C. For example, here is the I2C bus setup as it was previously on the
With the move to the
pinctrl system, this setup now look like:
which references the
Although slightly more verbose this allows pin configuration infrastructure to be re-used, specify other modes, like sleep, etc. in a standard way across architectures.
Out of Tree Boards/Shields
All of the in-tree boards and shields have been upgraded, but if you maintain/use an out-of-tree board or shield that uses the converted boards and overrides pins for various buses, you may need to switch to
pinctrl to match ZMK’s new approach.
The approach is the following when updating a board:
- Add an entry
<board>_defconfigfile in the board directory.
- Add a new file with the naming convention
<board>-pinctrl.dtsito your board directory.
- In the new file, add your
pinctrlentries that set up different pin control configurations for whatever peripherals/buses are needed. Here’s the nice!nano file as an example:
- From the main
<board>.dtsfile, add an
#include "<board>-pinctrl.dtsi"to have the C-preprocessor combine the files.
- Update the various peripheral nodes to use the new
pinctrlconfigurations. For example, the following old configuration:
would be changed to:
pinctrl configuration is very dependent on the specific target SoC, you will rarely need to consider it for a shield overlay that leverages a pro micro or XIAO abstraction. As noted, you’re more likely to need to fix up pinctrl settings is using a board specific shield overlay, e.g.
<shield>/boards/<board>.overlay to set things up.
LVGL Kconfig changes.
With the update to LVGL 8.x, Zephyr now leverages an upstream Kconfig file for most LVGL settings. Due to this, the naming for many existing configs has been adjusted. For any configs moved upstream, the naming mostly involves a prefix change from
LVGL_ to the shorter
LV_. For any that are still Zephyr specific configs, they are now prefixed with
If you maintain or use an out of tree board/shield with a display, the following will need to be changed in your Kconfig files:
Other than those specific examples, most other Kconfig values can simply change the
LVGL_ prefix to
Raspberry Pi Pico/RP2040 Support
This Zephyr update allows ZMK to support the new(-ish) RP2040 SoC found in the Raspberry Pi Pico.
ZMK does not support wired split communication yet, so RP2040 is only usable for non-split keyboards. To follow progress on wired splits, see #1117.
The following RP2040 powered controllers have board definitions for folks to test:
- Raspberry Pi Pico (
- SparkFun Pro Micro RP2040 (
- Adafruit Keyboar/KB2040 (
- Seeeduino XIAO RP2040 (
- Adafruit Qt PY RP2040 (
- BoardSource blok (
- Elite-Pi (compatible with the
Zephyr’s improved power domain support is a foundation upon which we can provide a proper fix for the longstanding display re-init bug which has prevented ZMK from formally supporting our display code.
There is work still remaining to fully leverage the power domain system within ZMK to fix the bug, but upgrading Zephyr is the first necessary step.
Thanks to all the testers who have helped verify ZMK functionality on the newer Zephyr version.