Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-all-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
matrix:
# *_v3: ESP32-P4 chip revision v3.x (sdkconfig.rev3); IDF cannot
# build one image for both v1.x and v3.x silicon.
board: [wave_4b, wave_35, wave_5, wave_43, crowpanel, wave_7b,
wave_4b_v3, wave_35_v3, wave_5_v3, wave_43_v3, crowpanel_v3, wave_7b_v3]
board: [wave_4b, wave_35, wave_5, wave_43, crowpanel, wave_7b, p4_pico,
wave_4b_v3, wave_35_v3, wave_5_v3, wave_43_v3, crowpanel_v3, wave_7b_v3, p4_pico_v3]
name: build (${{ matrix.board }})
steps:
- name: Checkout repo
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ build_wave_43/
build_wave_5/
build_wave_7b/
build_crowpanel/
build_p4_pico/
build_*_v3/
build_wave_7b/
sdkconfig
Expand Down
12 changes: 6 additions & 6 deletions .justfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export IDF_PATH := env_var_or_default("IDF_PATH", env_var("HOME") + "/esp/esp-idf")
export IDF_PATH_FORCE := "1"

# Board parameter: "wave_4b" (default), "wave_35", "wave_5", "wave_43", "crowpanel", or "wave_7b"
# Board parameter: "wave_4b" (default), "wave_35", "wave_5", "wave_43", "crowpanel", "wave_7b", or "p4_pico"
# Usage: just build wave_35, just flash wave_4b, just build wave_5, just build wave_7b
# Each board builds into its own build_<board>/ directory, so switching
# boards is instant (no clean required) and per-board builds stay incremental.
# Append _v3 to a board (just build wave_43_v3) for ESP32-P4 chip revision
# v3.x: IDF cannot build one image for both v1.x and v3.x silicon.

boards := "wave_4b wave_35 wave_5 wave_43 crowpanel wave_7b"
boards := "wave_4b wave_35 wave_5 wave_43 crowpanel wave_7b p4_pico"

_check_board board:
#!/usr/bin/env sh
Expand Down Expand Up @@ -56,7 +56,7 @@ test:
./scripts/test.sh

clean:
rm -fRd build build_wave_4b build_wave_35 build_wave_5 build_wave_43 build_crowpanel build_wave_7b
rm -fRd build build_wave_4b build_wave_35 build_wave_5 build_wave_43 build_crowpanel build_wave_7b build_p4_pico
rm -fRd build_*_v3
rm -fRd build_pbkdf2_*
rm -fRd build_scanprof_*
Expand Down Expand Up @@ -98,14 +98,14 @@ site port="8000":
python3 -m http.server {{port}} -d site

# Simulator board resolution mapping
# wave_4b: 720x720, wave_35: 320x480, wave_5: 720x1280, wave_43: 480x800, crowpanel: 1024x600, wave_7b: 1024x600
# wave_4b: 720x720, wave_35: 320x480, wave_5: 720x1280, wave_43: 480x800, crowpanel: 1024x600, wave_7b: 1024x600, p4_pico: 720x1280
_sim_h_res board:
#!/usr/bin/env sh
case "{{board}}" in wave_35) echo 320;; wave_5) echo 720;; wave_43) echo 480;; crowpanel) echo 1024;; wave_7b) echo 1024;; *) echo 720;; esac
case "{{board}}" in wave_35) echo 320;; wave_5) echo 720;; wave_43) echo 480;; crowpanel) echo 1024;; wave_7b) echo 1024;; p4_pico) echo 720;; *) echo 720;; esac

_sim_v_res board:
#!/usr/bin/env sh
case "{{board}}" in wave_35) echo 480;; wave_5) echo 1280;; wave_43) echo 800;; crowpanel) echo 600;; wave_7b) echo 600;; *) echo 720;; esac
case "{{board}}" in wave_35) echo 480;; wave_5) echo 1280;; wave_43) echo 800;; crowpanel) echo 600;; wave_7b) echo 600;; p4_pico) echo 1280;; *) echo 720;; esac

# Build the desktop simulator
sim-build board="wave_4b": (_check_board board)
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [Unreleased]

### Added
- Board target for the Waveshare ESP32-P4-Pico (`p4_pico`), a display-less module with Raspberry Pi style DSI and CSI connectors and no radio chip, paired with Waveshare's 5-DSI-TOUCH-A (720x1280). The display is the HX8394 panel of the ESP32-P4-WiFi6-Touch-LCD-5, so it shares that board's panel driver, now its own component; its MCU at I2C 0x45 drives the backlight, and the GT911 touch controller is probed at 0x5D and 0x14. Untested on hardware

## [0.0.20] - 2026-09-23

### Added
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Do not introduce UI dependencies into core modules. If a core function needs use

The project uses two static analysis tools to catch bugs early. Both are available after sourcing ESP-IDF (`source ~/esp/esp-idf/export.sh`), except `cppcheck` which is installed separately.

Both tools cover `main/` and first-party components (`bbqr`, `cUR`, `k_quirc`, `sd_card`, `video`, `wave_4b`, `wave_35`, `wave_43`, `crowpanel`, `wave_7b`). `libwally-core` and `wave_5` are excluded (third-party upstream code: libwally-core is the original; wave_5 ships a vendored ST-style HX8394 driver).
Both tools cover `main/` and first-party components (`bbqr`, `cUR`, `k_quirc`, `sd_card`, `video`, `wave_4b`, `wave_35`, `wave_5`, `wave_43`, `crowpanel`, `wave_7b`, `p4_pico`). `libwally-core` and `esp_lcd_hx8394` are excluded (third-party upstream code: libwally-core is the original; esp_lcd_hx8394 is a vendored ST-style HX8394 driver).

**clang-tidy** (recommended, catches real bugs):
```bash
Expand All @@ -51,8 +51,8 @@ clang-tidy -p build/compile_commands.json main/core/wallet.c
# Run on all project source files (excluding libwally-core)
find main components/bbqr components/cUR components/k_quirc \
components/sd_card components/video \
components/wave_4b components/wave_35 components/wave_43 components/crowpanel \
components/wave_7b \
components/wave_4b components/wave_35 components/wave_5 components/wave_43 components/crowpanel \
components/wave_7b components/p4_pico \
-name '*.c' -not -path '*/build/*' 2>/dev/null | \
xargs -P$(nproc) -I{} clang-tidy -p build/compile_commands.json {}
```
Expand All @@ -66,8 +66,8 @@ The project `.clang-tidy` config enables bug-finding and security checks tuned f
# Run on project source directories
cppcheck main/ components/bbqr components/cUR components/k_quirc \
components/sd_card components/video \
components/wave_4b components/wave_35 components/wave_43 components/crowpanel \
components/wave_7b \
components/wave_4b components/wave_35 components/wave_5 components/wave_43 components/crowpanel \
components/wave_7b components/p4_pico \
--enable=warning,style,performance \
--suppress=missingIncludeSystem \
--suppress=missingInclude \
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ It signs PSBTs for single-sig, multisig and miniscript policies on both native s

## Hardware

Kern supports five Waveshare ESP32-P4 boards and one Elecrow CrowPanel board:
Kern supports five Waveshare ESP32-P4 boards, one Elecrow CrowPanel board, and the display-less Waveshare ESP32-P4-Pico paired with a Waveshare DSI display:

| Board | Display | Touch | Camera |
|-------|---------|-------|--------|
Expand All @@ -29,8 +29,9 @@ Kern supports five Waveshare ESP32-P4 boards and one Elecrow CrowPanel board:
| [ESP32-P4-WiFi6-Touch-LCD-4.3](https://www.waveshare.com/esp32-p4-wifi6-touch-lcd-4.3.htm) (`wave_43`) | 480x800 MIPI DSI | GT911 | OV5647, included |
| [ESP32-P4-WiFi6-Touch-LCD-7B](https://www.waveshare.com/esp32-p4-wifi6-touch-lcd-7b.htm) (`wave_7b`) | 1024x600 MIPI DSI | GT911 | OV5647, sold separately |
| [CrowPanel Advanced 10.1" ESP32-P4](https://github.com/Elecrow-RD/CrowPanel-Advanced-10.1inch-ESP32-P4-HMI-AI-Display-1024x600-IPS-Touch-Screen) and 7" siblings (`crowpanel`) | 1024x600 MIPI DSI | GT911 | SC2336, included |
| [ESP32-P4-Pico](https://www.waveshare.com/esp32-p4-pico.htm) (`p4_pico`) with a [5-DSI-TOUCH-A](https://www.waveshare.com/wiki/5-DSI-TOUCH-A) | 720x1280 MIPI DSI, sold separately | GT911, on the display | sold separately, OV5647 |

ESP32-P4 does not contain radio (WiFi, BLE), but these boards have a radio in a secondary chip (ESP32-C6 mini). Exploring radio-less, simpler and cheaper ESP32-P4-only boards is part of the project's hardware research.
ESP32-P4 does not contain radio (WiFi, BLE), but the Touch-LCD and CrowPanel boards have a radio in a secondary chip (ESP32-C6 mini). The ESP32-P4-Pico has no radio chip at all; it is the first radio-less target. It drives Waveshare's 5-DSI-TOUCH-A, the same HX8394 panel as the ESP32-P4-WiFi6-Touch-LCD-5, over the 22-pin cable included with the display; the display also needs 5 V from the Pico's header.

A MIPI CSI camera module is required for all boards. Kern ships drivers for the
OV5647 and SC2336 sensors and probes for whichever one is attached at boot, so
Expand Down Expand Up @@ -80,13 +81,14 @@ git submodule update --init --recursive

### Building the Project

Build with [just](https://github.com/casey/just) (recommended) or `idf.py` directly. All `just` commands accept a board parameter, one of `wave_4b` (default), `wave_35`, `wave_5`, `wave_43`, `crowpanel`, or `wave_7b`:
Build with [just](https://github.com/casey/just) (recommended) or `idf.py` directly. All `just` commands accept a board parameter, one of `wave_4b` (default), `wave_35`, `wave_5`, `wave_43`, `crowpanel`, `wave_7b`, or `p4_pico`:

```bash
just build # Build for wave_4b (default)
just build wave_35 # Build for wave_35
just build wave_5 # Build for wave_5
just build wave_43 # Build for wave_43
just build p4_pico # Build for the ESP32-P4-Pico + 5-DSI-TOUCH-A
just build crowpanel # Build for CrowPanel 7" / 10.1"
just build wave_7b # Build for wave_7b
just flash wave_5 # Flash for wave_5
Expand All @@ -111,6 +113,9 @@ idf.py -D 'SDKCONFIG_DEFAULTS=sdkconfig.defaults;sdkconfig.defaults.wave_5' buil
# wave_43
idf.py -D 'SDKCONFIG_DEFAULTS=sdkconfig.defaults;sdkconfig.defaults.wave_43' build

# p4_pico
idf.py -D 'SDKCONFIG_DEFAULTS=sdkconfig.defaults;sdkconfig.defaults.p4_pico' build

# crowpanel (7" / 10.1")
idf.py -D 'SDKCONFIG_DEFAULTS=sdkconfig.defaults;sdkconfig.defaults.crowpanel' build

Expand All @@ -131,6 +136,7 @@ just sim # Run simulator as wave_4b (720x720) with webcam (V4L2)
just sim wave_35 # Run simulator as wave_35 (320x480)
just sim wave_5 # Run simulator as wave_5 (720x1280)
just sim wave_43 # Run simulator as wave_43 (480x800)
just sim p4_pico # Run simulator as p4_pico (720x1280)
just sim crowpanel # Run simulator as crowpanel (1024x600)
just sim wave_7b # Run simulator as wave_7b (1024x600)
just sim-build wave_35 # Build only
Expand Down Expand Up @@ -241,6 +247,7 @@ Pre-release firmware is provided **for research and testing purposes only**. Any
| `wave_43` | Waveshare ESP32-P4-WiFi6-Touch-LCD-4.3 | 480x800 MIPI DSI |
| `crowpanel` | CrowPanel Advanced 7" / 10.1" ESP32-P4 | 1024x600 MIPI DSI |
| `wave_7b` | Waveshare ESP32-P4-WiFi6-Touch-LCD-7B | 1024x600 MIPI DSI |
| `p4_pico` | Waveshare ESP32-P4-Pico + 5-DSI-TOUCH-A | 720x1280 MIPI DSI |

### Requirements

Expand Down
13 changes: 13 additions & 0 deletions components/esp_lcd_hx8394/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if(CONFIG_KERN_BOARD_WAVE_5 OR CONFIG_KERN_BOARD_P4_PICO)
idf_component_register(
SRCS "esp_lcd_hx8394.c"
INCLUDE_DIRS "include"
REQUIRES esp_lcd
PRIV_REQUIRES driver
)
else()
idf_component_register(
REQUIRES esp_lcd
PRIV_REQUIRES driver
)
endif()
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* HX8394 MIPI-DSI panel driver for wave_5 BSP.
* HX8394 MIPI-DSI panel driver for the Waveshare 720x1280 5" panel.
*
* Adapted from waveshare/esp_lcd_hx8394 v1.0.3:
* - renamed `color_space` field to `rgb_ele_order` for ESP-IDF >= 6.0
* - removed private legacy-API I2C bus creation (the TPS65132 power-rail
* chip is initialised separately in wave_5.c before this driver runs,
* using the same i2c_master bus as the rest of the board).
* - removed private legacy-API I2C bus creation (any power-rail chip is
* initialised by the BSP before this driver runs, using the same
* i2c_master bus as the rest of the board).
*/

#include "soc/soc_caps.h"
Expand Down
13 changes: 13 additions & 0 deletions components/p4_pico/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if(CONFIG_KERN_BOARD_P4_PICO)
idf_component_register(
SRCS "p4_pico.c"
INCLUDE_DIRS "include"
REQUIRES driver esp_lcd bsp_common
PRIV_REQUIRES esp_lcd_touch_gt911 esp_lcd_hx8394
)
else()
idf_component_register(
REQUIRES driver esp_lcd bsp_common
PRIV_REQUIRES esp_lcd_hx8394
)
endif()
13 changes: 13 additions & 0 deletions components/p4_pico/idf_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
dependencies:
idf:
version: '>=5.4'
esp_lcd_touch_gt911: ^1
espressif/esp_lvgl_adapter:
version: '>=0.5.1'
public: true
lvgl/lvgl: '>=8,<10'

description: Minimal BSP for Waveshare ESP32-P4-Pico with a Waveshare 5-DSI-TOUCH-A display (720x1280, HX8394, GT911)
targets:
- esp32p4
version: 1.0.0
50 changes: 50 additions & 0 deletions components/p4_pico/include/bsp/display.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#pragma once
#include "esp_lcd_mipi_dsi.h"
#include "esp_lcd_types.h"
#include "sdkconfig.h"

/* LCD color formats */
#define ESP_LCD_COLOR_FORMAT_RGB565 (1)
#define ESP_LCD_COLOR_FORMAT_RGB888 (2)

/* LCD display color format */
#if CONFIG_BSP_LCD_COLOR_FORMAT_RGB888
#define BSP_LCD_COLOR_FORMAT (ESP_LCD_COLOR_FORMAT_RGB888)
#else
#define BSP_LCD_COLOR_FORMAT (ESP_LCD_COLOR_FORMAT_RGB565)
#endif
/* LCD display color bytes endianess */
#define BSP_LCD_BIGENDIAN (0)
/* LCD display color bits */
#define BSP_LCD_BITS_PER_PIXEL (16)
/* LCD display color space */
#define BSP_LCD_COLOR_SPACE (LCD_RGB_ELEMENT_ORDER_RGB)

#define BSP_LCD_H_RES (720)
#define BSP_LCD_V_RES (1280)
#define BSP_LCD_MIPI_DSI_LANE_BITRATE_MBPS (700)

#define BSP_LCD_MIPI_DSI_LANE_NUM (2)
#define BSP_MIPI_DSI_PHY_PWR_LDO_CHAN (3)
#define BSP_MIPI_DSI_PHY_PWR_LDO_VOLTAGE_MV (2500)

typedef struct {
int dummy;
} bsp_display_config_t;

typedef struct {
esp_lcd_dsi_bus_handle_t mipi_dsi_bus;
esp_lcd_panel_io_handle_t io;
esp_lcd_panel_handle_t panel;
esp_lcd_panel_handle_t control;
} bsp_lcd_handles_t;

esp_err_t bsp_display_new(const bsp_display_config_t *config,
esp_lcd_panel_handle_t *ret_panel,
esp_lcd_panel_io_handle_t *ret_io);
esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config,
bsp_lcd_handles_t *ret_handles);
esp_err_t bsp_display_brightness_init(void);
esp_err_t bsp_display_brightness_set(int brightness_percent);
esp_err_t bsp_display_backlight_on(void);
esp_err_t bsp_display_backlight_off(void);
2 changes: 2 additions & 0 deletions components/p4_pico/include/bsp/esp-bsp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#pragma once
#include "bsp/esp32_p4_pico.h"
97 changes: 97 additions & 0 deletions components/p4_pico/include/bsp/esp32_p4_pico.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#pragma once

#include "bsp/config.h"
#include "bsp/display.h"
#include "driver/gpio.h"
#include "driver/i2c_master.h"
#include "sdkconfig.h"

#if (BSP_CONFIG_NO_GRAPHIC_LIB == 0)
#include "esp_lv_adapter.h"
#include "lvgl.h"
#endif

/**************************************************************************************************
* BSP Capabilities
**************************************************************************************************/

#define BSP_CAPS_DISPLAY 1
#define BSP_CAPS_TOUCH 1
#define BSP_CAPS_BUTTONS 0
#define BSP_CAPS_AUDIO 0
#define BSP_CAPS_AUDIO_SPEAKER 0
#define BSP_CAPS_AUDIO_MIC 0
#define BSP_CAPS_SDCARD 0
#define BSP_CAPS_IMU 0

/**************************************************************************************************
* Pinout
**************************************************************************************************/
/* I2C: the same pair is routed to the DISPLAY and CAMERA connectors and to the
* header, so the display MCU, touch controller and camera SCCB all share it. */
#define BSP_I2C_SCL (GPIO_NUM_8)
#define BSP_I2C_SDA (GPIO_NUM_7)

/* A Raspberry Pi style DSI cable carries no reset or backlight line: the panel
* takes a DCS soft reset and the MCU on the display drives the backlight. */
#define BSP_LCD_BACKLIGHT (GPIO_NUM_NC)
#define BSP_LCD_RST (GPIO_NUM_NC)
#define BSP_LCD_TOUCH_RST (GPIO_NUM_NC)
#define BSP_LCD_TOUCH_INT (GPIO_NUM_NC)

/* I2C address of the display's backlight MCU */
#define BSP_LCD_MCU_I2C_ADDR (0x45)

/* Camera I2C (shares main I2C bus on this board) */
#define BSP_CAM_I2C_SCL BSP_I2C_SCL
#define BSP_CAM_I2C_SDA BSP_I2C_SDA
#define BSP_CAM_HAS_MOTOR 0

/**************************************************************************************************
*
* I2C interface
*
**************************************************************************************************/
#define BSP_I2C_NUM CONFIG_BSP_I2C_NUM

esp_err_t bsp_i2c_init(void);
esp_err_t bsp_i2c_deinit(void);
i2c_master_bus_handle_t bsp_i2c_get_handle(void);

/**************************************************************************************************
*
* Wireless co-processor
*
**************************************************************************************************/

/**
* @brief The Pico carries no wireless co-processor; this exists so the shared
* boot path can call it unconditionally. Always returns ESP_OK.
*/
esp_err_t bsp_wifi_coproc_disable(void);

/**************************************************************************************************
*
* LCD interface
*
**************************************************************************************************/

#if (BSP_CONFIG_NO_GRAPHIC_LIB == 0)

lv_display_t *bsp_display_start(void);

/**
* @brief Take LVGL mutex
*
* @param[in] timeout_ms Timeout in [ms]. 0 will block indefinitely.
* @return true Mutex was taken
* @return false Mutex was NOT taken
*/
bool bsp_display_lock(uint32_t timeout_ms);

/**
* @brief Give LVGL mutex
*/
void bsp_display_unlock(void);

#endif
Loading
Loading