Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
2 changes: 2 additions & 0 deletions main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ elseif(CONFIG_BOARD_TYPE_ESP32P4_WIFI6_Touch_LCD_XC)
set(BUILTIN_TEXT_FONT font_puhui_basic_30_4)
set(BUILTIN_ICON_FONT font_awesome_30_4)
set(DEFAULT_EMOJI_COLLECTION twemoji_64)
elseif(CONFIG_BOARD_TYPE_ESP32P4_Function_EV_Board)
set(BOARD_TYPE "esp32-p4-function-ev-board")
elseif(CONFIG_BOARD_TYPE_BREAD_COMPACT_WIFI_LCD)
set(BOARD_TYPE "bread-compact-wifi-lcd")
set(BUILTIN_TEXT_FONT font_puhui_basic_16_4)
Expand Down
3 changes: 3 additions & 0 deletions main/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ choice BOARD_TYPE
config BOARD_TYPE_ESP32P4_WIFI6_Touch_LCD_XC
bool "Waveshare ESP32-P4-WIFI6-Touch-LCD-3.4C or ESP32-P4-WIFI6-Touch-LCD-4C"
depends on IDF_TARGET_ESP32P4
config BOARD_TYPE_ESP32P4_Function_EV_Board
bool "ESP32-P4-Function-EV-Board"
depends on IDF_TARGET_ESP32P4
config BOARD_TYPE_TUDOUZI
bool "土豆子"
depends on IDF_TARGET_ESP32S3
Expand Down
35 changes: 35 additions & 0 deletions main/boards/esp32-p4-function-ev-board/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# ESP32-P4-Function-EV-Board

Board support for ESP32-P4-Function-EV-Board. Wi‑Fi uses ESP‑Hosted via the on‑board ESP32‑C6. LCD is supported via the official MIPI‑DSI LCD adapter.

## Features
- Wi‑Fi: `esp_wifi_remote` + `esp_hosted` (SDIO) with ESP32‑C6 co‑processor
- Display: 7" MIPI‑DSI LCD (1024×600) via adapter; can also run headless
- Audio: Can run with dummy codec; board includes ES8311 + PA if needed

## Configure
In `menuconfig`: Xiaozhi Assistant -> Board Type -> ESP32-P4-Function-EV-Board

Ensure these are set (auto-set when building via config.json):
- `CONFIG_SLAVE_IDF_TARGET_ESP32C6=y`
- `CONFIG_ESP_HOSTED_P4_DEV_BOARD_FUNC_BOARD=y`
- `CONFIG_ESP_HOSTED_SDIO_HOST_INTERFACE=y`
- `CONFIG_ESP_HOSTED_SDIO_4_BIT_BUS=y`

## LCD Connection (from Espressif user guide)
- Connect the LCD adapter board J3 to the board’s MIPI DSI connector (reverse ribbon).
- Wire `RST_LCD` (adapter J6) to `GPIO27` (board J1).
- Wire `PWM` (adapter J6) to `GPIO26` (board J1).
- Optionally power the LCD adapter via its USB or provide `5V` and `GND` from the board.

These pins are pre-configured in `config.h` as `PIN_NUM_LCD_RST=GPIO27` and `DISPLAY_BACKLIGHT_PIN=GPIO26`. Resolution is set to 1024×600.

## Build (example)
```powershell
idf.py set-target esp32p4
idf.py menuconfig
idf.py build
```

Tip: In menuconfig, choose Xiaozhi Assistant -> Board Type -> ESP32-P4-Function-EV-Board.
If building a release via scripts, the `config.json` in this folder appends the required Hosted options.
36 changes: 36 additions & 0 deletions main/boards/esp32-p4-function-ev-board/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef _BOARD_CONFIG_H_
#define _BOARD_CONFIG_H_

#include <driver/gpio.h>

// Audio (board has ES8311/PA, but app can run with dummy codec)
#define AUDIO_INPUT_SAMPLE_RATE 24000
#define AUDIO_OUTPUT_SAMPLE_RATE 24000

// Buttons / LEDs
#define BUILTIN_LED_GPIO GPIO_NUM_NC
#define BOOT_BUTTON_GPIO GPIO_NUM_0
#define VOLUME_UP_BUTTON_GPIO GPIO_NUM_NC
#define VOLUME_DOWN_BUTTON_GPIO GPIO_NUM_NC

// Optional LCD via MIPI-DSI adapter (7" 1024x600)
#define DISPLAY_WIDTH 1024
#define DISPLAY_HEIGHT 600
#define DISPLAY_MIRROR_X false
#define DISPLAY_MIRROR_Y false
#define DISPLAY_SWAP_XY false

#define DISPLAY_OFFSET_X 0
#define DISPLAY_OFFSET_Y 0

// LCD adapter wiring (per Espressif user guide):
// RST_LCD -> GPIO27, PWM(backlight) -> GPIO26
#define PIN_NUM_LCD_RST GPIO_NUM_27
#define DISPLAY_BACKLIGHT_PIN GPIO_NUM_26
#define DISPLAY_BACKLIGHT_OUTPUT_INVERT false

// MIPI DSI PHY supply (used by other P4 boards)
#define MIPI_DSI_PHY_PWR_LDO_CHAN (3)
#define MIPI_DSI_PHY_PWR_LDO_VOLTAGE_MV (2500)

#endif // _BOARD_CONFIG_H_
14 changes: 14 additions & 0 deletions main/boards/esp32-p4-function-ev-board/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"target": "esp32p4",
"builds": [
{
"name": "esp32-p4-function-ev-board",
"sdkconfig_append": [
"CONFIG_SLAVE_IDF_TARGET_ESP32C6=y",
"CONFIG_ESP_HOSTED_P4_DEV_BOARD_FUNC_BOARD=y",
"CONFIG_ESP_HOSTED_SDIO_HOST_INTERFACE=y",
"CONFIG_ESP_HOSTED_SDIO_4_BIT_BUS=y"
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include "wifi_board.h"
#include "codecs/dummy_audio_codec.h"
#include "display/display.h"
#include "application.h"
#include "button.h"
#include "config.h"

#include <wifi_station.h>
#include <esp_log.h>

#define TAG "ESP32P4FuncEV"

class ESP32P4FunctionEvBoard : public WifiBoard {
private:
Button boot_button_;
Display* display_;

void InitializeButtons() {
boot_button_.OnClick([this]() {
auto& app = Application::GetInstance();
if (app.GetDeviceState() == kDeviceStateStarting && !WifiStation::GetInstance().IsConnected()) {
ResetWifiConfiguration();
}
app.ToggleChatState();
});
}

public:
ESP32P4FunctionEvBoard() : boot_button_(BOOT_BUTTON_GPIO) {
display_ = new NoDisplay();
InitializeButtons();
}

virtual AudioCodec* GetAudioCodec() override {
static DummyAudioCodec audio_codec(AUDIO_INPUT_SAMPLE_RATE, AUDIO_OUTPUT_SAMPLE_RATE);
return &audio_codec;
}

virtual Display* GetDisplay() override {
return display_;
}

virtual Backlight* GetBacklight() override {
return nullptr;
}
};

DECLARE_BOARD(ESP32P4FunctionEvBoard);
4 changes: 4 additions & 0 deletions sdkconfig.defaults.esp32p4
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ CONFIG_SPIRAM_MEMTEST=n
CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y

CONFIG_SLAVE_IDF_TARGET_ESP32C6=y
CONFIG_ESP_HOSTED_ENABLED=y
CONFIG_ESP_HOSTED_P4_DEV_BOARD_FUNC_BOARD=y
CONFIG_ESP_HOSTED_SDIO_HOST_INTERFACE=y
CONFIG_ESP_HOSTED_SDIO_4_BIT_BUS=y

CONFIG_SR_WN_WN9_NIHAOXIAOZHI_TTS=y

Expand Down