Firmware for the CH32V203 microcontroller used as coprocessor on the Tanmatsu.
- I2C peripheral device presenting at address 0x5F for access from the host device
- Interrupt line for notifying host of important events
- Keyboard matrix scanning
- Real time clock
- Backup registers (data stored in the RTC power domain)
- PMIC (BQ25895) control and monitoring, including battery detection, ADC reading and and soft power control
- PWM backlight brightness control
This firmware is compatible with both the Tanmatsu and the WHY2025 badge. Please be sure to correctly adjust the HW_REV define in main.c to configure the firmware for the correct board.
Currently supported values:
Value | Device |
---|---|
1 | WHY2025 prototype 1 |
2 | WHY2025 prototype 2 |
TODO: Write setup toolchain here.
The build configuration is configured to use the compiler prefix 'riscv64-elf-'. (for exammple: riscv64-elf-gcc, riscv64-elf-g++)
When your system has a toolchain with this prefix, you can just use:
make
When your compiler has another prefix, for example 'riscv32-unknown-elf-' use the following:
make CMAKE_FLAGS="-DPREFIX=custom-prefix-" build
For example on my system, the compiler prefix is 'riscv32-unknown-elf-':
make CMAKE_FLAGS="-DPREFIX=riscv32-unknown-elf" build
After the build has run successfully, a file named 'main.bin' is placed in the project root.
The 'main.bin' file needs to be copied into the why2025-firmware-esp32p4 project.
cp ./main.bin < path to why2025-firmware-esp32p4 >/main/ch32_firmware.bin'
After this, build the P4 firmware again, and flash it to the badge.
When the badge reboots after the flash it'll flash the CH32 firmware as part of the boot sequence.
(In case instructions are needed to compile the P4 firmware, the README.md of the P4 firmware might help)
This firmware, copyright 2024 Nicolai Electronics, is made available under the terms of the MIT license, see LICENSE for the full license text. The platform files come from the ch32v003fun project by Cnlohr and are also licensed under the terms of the MIT license. Please see the CH32V003 LICENSE for a list of copyright holders.