Skip to main content

Hardware

What the BYOK B01 is made of and how the firmware talks to it. Everything on this page is what the firmware does today on the one device it was written against; a different board revision may move a pin or two.

Overview

  • ESP32-S3 with 16 MB flash and 2 MB quad-SPI PSRAM. One radio shared between WiFi and Bluetooth LE.
  • 240 x 80 monochrome LCD on a UC1611s controller, spoken to over I2C.
  • Five buttons, one WS2812 RGB LED, a backlight, a Li-ion cell with a charger, a micro-SD slot.
  • USB-C through a TUSB320 role controller. The ESP32-S3's built-in USB-Serial/JTAG provides the console and flashing; the same PHY is re-routed to USB-OTG for Disk Mode.
  • There is no separate Bluetooth co-processor on this board. The ESP32-S3 does the keyboard link itself.

GPIO Map

Take this with a grain of salt

All the GPIOs are best guesses and may or may not be the correct ones on paper but for the purpose of this build, they work.

GPIOFunctionNotes
42Power keep-alive latchOutput, active low. Driven low first thing at boot and held there. Driving it high powers the device off on battery.
2BacklightLEDC PWM.
18LCD SDASoftware I2C, about 150 kHz.
10LCD SCL
17LCD reset lineHeld low for the whole run; the panel is reset in software with the 0xE1/0xE2 commands.
35LCD A0Held low.
47LCD panel enableHeld low.
39Display auxiliary lineHeld low.
6POWER buttonInput, pull-up, active low.
16EXECUTE buttonInput, pull-up, active low.
11LIGHT buttonInput, pull-up, active low.
15UP buttonInput, pull-up, active low.
7DOWN buttonInput, pull-up, active low.
14WS2812 status LEDRMT, GRB order.
1Battery voltageADC1 channel 0, 12 dB attenuation, through a divider: Vbat = Vpin x 1.515.
12Charger CHRGInput, pull-up, low while charging.
13Charger DONEInput, pull-up, low when full.
5SD CLKSDMMC slot 1, 1-bit mode, 40 MHz.
3SD CMD
4SD D0
8, 9I2C to the TUSB320Port 1 at 400 kHz, address 0x60. The firmware does not touch it; the USB role is fixed by hardware strapping.
19, 20USB D-, D+The one USB PHY.
43, 44UART0Unused by this firmware.
26 to 32Flash and PSRAM
0, 45, 46Strapping pins
36, 37UART1Present on the stock board for a co-processor that this revision does not have. Unused.

The LCD

The controller is a UC1611s. Two I2C addresses: 0x38 takes command opcodes, 0x39 takes command parameters and pixel data. Every byte is its own I2C transaction. The visible 80 rows are controller pages 10 to 19, so the driver writes with a page offset of 10. The framebuffer is row-major (30 bytes per row, MSB on the left) and is packed into the controller's page format (each byte is 8 vertical pixels) on the way out; only pages that changed since the last flush are sent. The default bias (VBIAS) is 0xB0 and Settings > Contrast changes it live.

Power

The device stays on because GPIO42 is held low. The firmware asserts it before anything else runs. When USB power is present the rail is held up regardless, which is why on the dock a long POWER press reboots rather than powers off.

Battery percentage comes from 64 averaged ADC samples with the calibrated curve, then a Li-ion voltage-to-percent table. Charger state comes from the two open-drain status lines. Both are polled once a second by a small task that also drives the LED's charge states.

Radio

WiFi and BLE share one radio and, more to the point, one pool of internal DMA-capable RAM. WiFi's frame buffers must live there, so the firmware keeps WiFi off until it is needed (the Synchronise page), gives the keyboard a wide connection interval and hands the coexistence arbiter to WiFi while a network operation runs, then restores a fast interval for typing. Bringing WiFi up costs about 70 KB of internal RAM.

Flash Layout

OffsetSizeWhat
0x0bootloader
0x8000partition table
0x900016 KBNVS (WiFi networks, keyboard bond)
0xF0004 KBPHY calibration
0x100003 MBfactory app
0x3100003 MBota_0 (unused)
0x6100003 MBota_1 (unused)
0x9100008 KBOTA data

The layout matches the stock firmware's app slots so that restoring the stock image puts everything back exactly.

Things to Leave Alone

Learned from experience

If you are extending the firmware: do not toggle GPIO19/20 (USB, the device loses its serial port until the battery is drained or it is power-cycled), do not drive GPIO42 high unless you mean to power off, and do not sweep unknown GPIOs looking for peripherals. The list above is what is known to be safe.