mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-12-06 09:06:52 +01:00
hosted/xiao-c6-spi: esp-hosted co-processor firmware for the mcu-its-g5 XIAO ESP32-C6
This commit is contained in:
1 parent
523957d30d
commit
177bdcb3de
12 files changed
+306
-1
No files matched your search
@@ -0,0 +1,4 @@
|
|||||||
|
build/
|
||||||
|
managed_components/
|
||||||
|
sdkconfig
|
||||||
|
sdkconfig.old
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
|
project(xiao_c6_spi)
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
= XIAO ESP32-C6 esp-hosted co-processor (SPI)
|
||||||
|
|
||||||
|
esp-hosted-mcu 3.1.0 co-processor firmware (`examples/wifi/sta/cp`) for a Seeed XIAO ESP32-C6 that gives a
|
||||||
|
XIAO ESP32-C5 its Wi-Fi over SPI (`mcu-its-g5.yaml`). The user LED (GPIO15) blinks while it runs.
|
||||||
|
|
||||||
|
Wiring, D-pin to the same D-pin on both boards, plus GND and 3V3:
|
||||||
|
|
||||||
|
[cols="1,1,1,1"]
|
||||||
|
|===
|
||||||
|
| Signal | XIAO pin | C5 GPIO | C6 GPIO
|
||||||
|
|
||||||
|
| CLK | D8 | 8 | 19
|
||||||
|
| MISO | D9 | 9 | 20
|
||||||
|
| MOSI | D10 | 10 | 18
|
||||||
|
| CS | D3 | 7 | 21
|
||||||
|
| handshake | D0 | 1 | 0
|
||||||
|
| data ready | D1 | 0 | 1
|
||||||
|
| reset | D2 | 25 | 2 (the XIAO has no EN pin)
|
||||||
|
|===
|
||||||
|
|
||||||
|
Build with the ESP-IDF that ESPHome already downloaded, and flash over USB:
|
||||||
|
|
||||||
|
----
|
||||||
|
./build.sh /dev/serial/by-id/usb-Espressif_USB_JTAG_serial_debug_unit_90:64:9B:AB:5F:DC-if00
|
||||||
|
----
|
||||||
|
|
||||||
|
Keep the esp_hosted version in `main/idf_component.yml` in step with the one ESPHome uses on the host.
|
||||||
|
ESPHome's `update: platform: esp32_hosted` only supports ESP32-P4 and ESP32-H2 hosts, so this one is flashed by hand.
|
||||||
Executable
+12
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Build the co-processor firmware with the ESP-IDF that ESPHome already downloaded, and flash it
|
||||||
|
# when a port is given: ./build.sh [/dev/serial/by-id/usb-Espressif_...]
|
||||||
|
set -e
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
IDF=$(ls -d "$HOME"/.cache/esphome/idf/frameworks/5.5.* | sort -V | tail -1)
|
||||||
|
export IDF_PATH="$IDF" IDF_TOOLS_PATH="$HOME/.cache/esphome/idf"
|
||||||
|
export IDF_PYTHON_ENV_PATH="$HOME/.cache/esphome/idf/penvs/$(basename "$IDF")"
|
||||||
|
. "$IDF_PATH/export.sh" >/dev/null
|
||||||
|
[ -f sdkconfig ] || idf.py set-target esp32c6
|
||||||
|
idf.py build
|
||||||
|
[ -z "$1" ] || idf.py -p "$1" flash
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
dependencies:
|
||||||
|
espressif/esp_hosted:
|
||||||
|
component_hash: 22b08509494d4465f0e2f91ee16973d76fe90d5a930fa3910b7a43615db001bf
|
||||||
|
dependencies:
|
||||||
|
- name: cherry-embedded/cherryusb
|
||||||
|
registry_url: https://components.espressif.com
|
||||||
|
require: private
|
||||||
|
rules:
|
||||||
|
- if: target in [esp32p4]
|
||||||
|
- if: $CONFIG{ESP_HOSTED_HOST_USB_CHERRYUSB_MANIFEST} == 1
|
||||||
|
version: '>=1.6.0'
|
||||||
|
- name: espressif/esp_tinyusb
|
||||||
|
registry_url: https://components.espressif.com
|
||||||
|
require: private
|
||||||
|
rules:
|
||||||
|
- if: target in [esp32s2, esp32s3, esp32s31]
|
||||||
|
- if: $CONFIG{ESP_HOSTED_CP_TINYUSB_MANIFEST} == 1
|
||||||
|
version: '*'
|
||||||
|
- name: espressif/iot_usbh_rndis
|
||||||
|
registry_url: https://components.espressif.com
|
||||||
|
require: private
|
||||||
|
rules:
|
||||||
|
- if: target in [esp32p4]
|
||||||
|
- if: $CONFIG{ESP_HOSTED_HOST_USB_RNDIS_MANIFEST} == 1
|
||||||
|
version: ^0.5.2
|
||||||
|
- name: espressif/usb_host_cdc_acm
|
||||||
|
registry_url: https://components.espressif.com
|
||||||
|
require: private
|
||||||
|
rules:
|
||||||
|
- if: target in [esp32p4]
|
||||||
|
- if: $CONFIG{ESP_HOSTED_HOST_USB_CDC_ACM_MANIFEST} == 1
|
||||||
|
version: '*'
|
||||||
|
- name: idf
|
||||||
|
require: private
|
||||||
|
version: '>=5.5'
|
||||||
|
source:
|
||||||
|
registry_url: https://components.espressif.com/
|
||||||
|
type: service
|
||||||
|
targets:
|
||||||
|
- esp32
|
||||||
|
- esp32s2
|
||||||
|
- esp32s3
|
||||||
|
- esp32s31
|
||||||
|
- esp32c2
|
||||||
|
- esp32c3
|
||||||
|
- esp32c5
|
||||||
|
- esp32c6
|
||||||
|
- esp32c61
|
||||||
|
- esp32h2
|
||||||
|
- esp32h4
|
||||||
|
- esp32h21
|
||||||
|
- esp32p4
|
||||||
|
version: 3.1.0
|
||||||
|
idf:
|
||||||
|
source:
|
||||||
|
type: idf
|
||||||
|
version: 5.5.6
|
||||||
|
direct_dependencies:
|
||||||
|
- espressif/esp_hosted
|
||||||
|
- idf
|
||||||
|
manifest_hash: c37e626b03eed70cc211e75eb89460b788364cc18d9edb9dd97aec930c8ccc2c
|
||||||
|
target: esp32c6
|
||||||
|
version: 2.0.0
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
idf_component_register(SRCS "main.c"
|
||||||
|
INCLUDE_DIRS "."
|
||||||
|
REQUIRES esp_hosted
|
||||||
|
PRIV_REQUIRES nvs_flash esp_wifi)
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
dependencies:
|
||||||
|
espressif/esp_hosted:
|
||||||
|
version: '==3.1.0' # keep in step with the esp_hosted version ESPHome uses on the host
|
||||||
|
idf:
|
||||||
|
version: '>=5.5'
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include "esp_event.h"
|
||||||
|
#include "nvs_flash.h"
|
||||||
|
|
||||||
|
#include "esp_check.h"
|
||||||
|
#include "driver/gpio.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "freertos/task.h"
|
||||||
|
|
||||||
|
static const char *TAG = "wifi_mcu_example";
|
||||||
|
|
||||||
|
void app_main(void)
|
||||||
|
{
|
||||||
|
ESP_LOGI(TAG, "ESP-Hosted MCU WiFi Example Starting...");
|
||||||
|
|
||||||
|
/* Initialize NVS */
|
||||||
|
esp_err_t ret = nvs_flash_init();
|
||||||
|
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||||
|
ESP_ERROR_CHECK(nvs_flash_erase());
|
||||||
|
ret = nvs_flash_init();
|
||||||
|
}
|
||||||
|
ESP_ERROR_CHECK(ret);
|
||||||
|
|
||||||
|
/* create default event loop */
|
||||||
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||||
|
|
||||||
|
/* Heartbeat on the XIAO ESP32-C6 user LED (GPIO15, active low): shows the co-processor runs. */
|
||||||
|
gpio_set_direction(GPIO_NUM_15, GPIO_MODE_OUTPUT);
|
||||||
|
for (int on = 0;; on = !on) {
|
||||||
|
gpio_set_level(GPIO_NUM_15, !on);
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(500));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# ESP-Hosted shared partition table — 4 MB flash, dual OTA (1.75 MB per slot)
|
||||||
|
# Name, Type, SubType, Offset, Size
|
||||||
|
nvs, data, nvs, 0x9000, 0x4000
|
||||||
|
otadata, data, ota, 0xd000, 0x2000
|
||||||
|
phy_init, data, phy, 0xf000, 0x1000
|
||||||
|
ota_0, app, ota_0, 0x10000, 0x1C0000
|
||||||
|
ota_1, app, ota_1, 0x1D0000, 0x1C0000
|
||||||
|
@@ -0,0 +1,25 @@
|
|||||||
|
# ── Role: COPROCESSOR ────────────────────────────────────────────────
|
||||||
|
# ESP-Hosted coprocessor firmware (works with both MCU and Linux hosts
|
||||||
|
# via the unified MCU RPC v2 wire).
|
||||||
|
CONFIG_ESP_HOSTED=y
|
||||||
|
CONFIG_ESP_HOSTED_CP=y
|
||||||
|
CONFIG_ESP_HOSTED_CP_FOR_MCU=y
|
||||||
|
CONFIG_ESP_HOSTED_CP_RPC_V2=y
|
||||||
|
|
||||||
|
#Disable enterprise support by default
|
||||||
|
CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT=n
|
||||||
|
|
||||||
|
# BT Configuration
|
||||||
|
CONFIG_BT_ENABLED=n
|
||||||
|
#CONFIG_BT_CONTROLLER_ONLY=y
|
||||||
|
|
||||||
|
# OTA
|
||||||
|
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||||
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_eh_cp_ota_4m.csv"
|
||||||
|
|
||||||
|
# OS
|
||||||
|
CONFIG_FREERTOS_HZ=1000
|
||||||
|
CONFIG_ESP_WIFI_NVS_ENABLED=y
|
||||||
|
|
||||||
|
CONFIG_ESP_HOSTED_CP_FEAT_WIFI=y
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
# 1. CPU
|
||||||
|
#--------
|
||||||
|
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_160=y
|
||||||
|
|
||||||
|
# 2. BT Configuration
|
||||||
|
#---------------------
|
||||||
|
CONFIG_BT_ENABLED=n
|
||||||
|
CONFIG_BT_CONTROLLER_ONLY=y
|
||||||
|
CONFIG_BT_BLUEDROID_ENABLED=
|
||||||
|
CONFIG_BT_LE_SLEEP_ENABLE=y
|
||||||
|
|
||||||
|
# 3.1 BLE over SPI/SDIO
|
||||||
|
#-----------------------
|
||||||
|
CONFIG_BT_LE_HCI_INTERFACE_USE_RAM=y
|
||||||
|
|
||||||
|
# 3.2 BLE over UART
|
||||||
|
#-------------------
|
||||||
|
# Enable below config, delete sdkconfig, build/ and rebuild
|
||||||
|
# CONFIG_BT_LE_HCI_INTERFACE_USE_UART=y
|
||||||
|
# CONFIG_BT_LE_HCI_UART_TX_PIN=5
|
||||||
|
# CONFIG_BT_LE_HCI_UART_RX_PIN=12
|
||||||
|
# CONFIG_BT_LE_HCI_UART_FLOWCTRL=n
|
||||||
|
# # 4 pin solution is not working yet for c6
|
||||||
|
# #CONFIG_BT_LE_HCI_UART_RTS_PIN=9
|
||||||
|
# #CONFIG_BT_LE_HCI_UART_CTS_PIN=13
|
||||||
|
|
||||||
|
|
||||||
|
# 4. Partition Table
|
||||||
|
#--------------------
|
||||||
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_eh_cp_ota_4m.csv"
|
||||||
|
|
||||||
|
# 5. Mempool
|
||||||
|
#------------
|
||||||
|
CONFIG_ESP_CACHE_MALLOC=y
|
||||||
|
|
||||||
|
|
||||||
|
# # 6.1 LWIP split
|
||||||
|
# #---------------
|
||||||
|
#
|
||||||
|
# CONFIG_ESP_HOSTED_CP_FEAT_NW_SPLIT=y
|
||||||
|
# CONFIG_LWIP_TCP_LOCAL_PORT_RANGE_START=61440
|
||||||
|
# CONFIG_LWIP_TCP_LOCAL_PORT_RANGE_END=65535
|
||||||
|
# CONFIG_LWIP_UDP_LOCAL_PORT_RANGE_START=61440
|
||||||
|
# CONFIG_LWIP_UDP_LOCAL_PORT_RANGE_END=65535
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# # 6.2 LWIP split examples
|
||||||
|
# #-------------------------
|
||||||
|
|
||||||
|
|
||||||
|
# 7. Transport config
|
||||||
|
#---------------------
|
||||||
|
# ESP_HOSTED_TRANSPORT_CP_SDIO_NSEND_PSAMPLE=y
|
||||||
|
# ESP_HOSTED_TRANSPORT_CP_SDIO_DEFAULT_SPEED=y
|
||||||
|
#ESP_HOSTED_TRANSPORT_CP_SDIO_STREAMING_MODE=y
|
||||||
|
|
||||||
|
# For SPI Full duplex C6 on ESP32-P4-Function-EV-Board, please uncomment below
|
||||||
|
#CONFIG_ESP_HOST_DEV_BOARD_P4_FUNC_BOARD=y
|
||||||
|
#CONFIG_ESP_HOSTED_TRANSPORT_CP_SPI=y
|
||||||
|
|
||||||
|
|
||||||
|
# 8. Wifi config
|
||||||
|
#----------------
|
||||||
|
|
||||||
|
CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=20
|
||||||
|
CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=64
|
||||||
|
CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=64
|
||||||
|
CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y
|
||||||
|
CONFIG_ESP_WIFI_TX_BA_WIN=32
|
||||||
|
CONFIG_ESP_WIFI_AMPDU_RX_ENABLED=y
|
||||||
|
CONFIG_ESP_WIFI_RX_BA_WIN=32
|
||||||
|
|
||||||
|
CONFIG_ESP_WIFI_RX_IRAM_OPT=y
|
||||||
|
CONFIG_ESP_WIFI_IRAM_OPT=y
|
||||||
|
|
||||||
|
# # 9. LWIP config
|
||||||
|
# #----------------
|
||||||
|
# CONFIG_LWIP_TCP_SND_BUF_DEFAULT=65535
|
||||||
|
# CONFIG_LWIP_TCP_WND_DEFAULT=65535
|
||||||
|
# CONFIG_LWIP_TCP_RECVMBOX_SIZE=64
|
||||||
|
# CONFIG_LWIP_UDP_RECVMBOX_SIZE=64
|
||||||
|
# CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=64
|
||||||
|
# CONFIG_LWIP_TCP_SACK_OUT=y
|
||||||
|
# #CONFIG_LWIP_TCPIP_CORE_LOCKING=y
|
||||||
|
# #CONFIG_LWIP_TCPIP_CORE_LOCKING_INPUT=y
|
||||||
|
|
||||||
|
|
||||||
|
# 10. Optimizations
|
||||||
|
#-------------------
|
||||||
|
CONFIG_COMPILER_OPTIMIZATION_PERF=y
|
||||||
|
|
||||||
|
|
||||||
|
# 11. Stats
|
||||||
|
#-----------
|
||||||
|
#CONFIG_ESP_HOSTED_FUNCTION_PROFILING=y
|
||||||
|
#CONFIG_ESP_PKT_STATS=y
|
||||||
|
|
||||||
|
# # 12 iperf task
|
||||||
|
# #--------------
|
||||||
|
|
||||||
|
# Seeed XIAO ESP32-C6 as co-processor of a XIAO ESP32-C5 over SPI, wired D-pin to the same D-pin
|
||||||
|
CONFIG_EH_TRANSPORT_CP_SPI=y
|
||||||
|
CONFIG_EH_TRANSPORT_CP_SPI_MODE_3=y
|
||||||
|
CONFIG_EH_TRANSPORT_CP_SPI_HSPI_GPIO_CLK=19
|
||||||
|
CONFIG_EH_TRANSPORT_CP_SPI_HSPI_GPIO_MISO=20
|
||||||
|
CONFIG_EH_TRANSPORT_CP_SPI_HSPI_GPIO_MOSI=18
|
||||||
|
CONFIG_EH_TRANSPORT_CP_SPI_HSPI_GPIO_CS=21
|
||||||
|
CONFIG_EH_TRANSPORT_CP_SPI_GPIO_HANDSHAKE=0
|
||||||
|
CONFIG_EH_TRANSPORT_CP_SPI_GPIO_DATA_READY=1
|
||||||
|
# The XIAO has no EN pin: the host's reset pin goes to GPIO2 (D2)
|
||||||
|
CONFIG_EH_TRANSPORT_CP_SPI_GPIO_RESET=2
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
# Hardware: Seeed Studio XIAO ESP32-C5 (host, its own radio in 802.11p for ITS-G5)
|
# Hardware: Seeed Studio XIAO ESP32-C5 (host, its own radio in 802.11p for ITS-G5)
|
||||||
# + Seeed Studio XIAO ESP32-C6 (esp32_hosted co-processor, Wi-Fi uplink over SPI)
|
# + Seeed Studio XIAO ESP32-C6 (esp32_hosted co-processor, Wi-Fi uplink over SPI)
|
||||||
# Wi-Fi on the C6 needs esphome/esphome#22819 and hn/esphome-its-g5#3 (external components below)
|
# Wi-Fi on the C6 needs esphome/esphome#22819 and hn/esphome-its-g5#3 (external components below)
|
||||||
# and the esp-hosted-mcu 3.1.0 co-processor firmware (examples/wifi/sta/cp, SPI) on the C6.
|
# and the co-processor firmware from hosted/xiao-c6-spi on the C6.
|
||||||
# Pinout:
|
# Pinout:
|
||||||
# GPIO8 D8 -> esp32_hosted clk -> C6 D8 GPIO19
|
# GPIO8 D8 -> esp32_hosted clk -> C6 D8 GPIO19
|
||||||
# GPIO9 D9 <- esp32_hosted miso <- C6 D9 GPIO20
|
# GPIO9 D9 <- esp32_hosted miso <- C6 D9 GPIO20
|
||||||
|
|||||||
Reference in new issue
Block a user