Compare commits

..
4 Commits
Author SHA1 Message Date
randy 3d5a77bd13 m5core2: CANopen node 5 on a TJA1050 module at Port A (esp32_can GPIO32/33, 500 kbit/s)
CI / ESPHome config validation (push) Successful in 1m22s
CI / YAML lint (push) Successful in 7s
2026-12-03 17:02:28 +01:00
randy 0f6e2350cc ESPHome 2026.12: on_client_synced, CanPayload, cleanups
- LVGL panels (NSPanels, lvgl, lvgl-4848s040, m5core2, tft), m5paper: api on_client_synced
  instead of a 2 s delay and an api.connected check
- car-can: on_frame x is canbus::CanPayload, frames_per_id keeps it without a heap vector
- gateway: drop the commented ethernet (common/ethernet.yaml has it), LLDP (PR draft),
  manual_ip and use_address
- clock-1, echo: drop the commented neopixelbus lights
2026-12-03 17:01:53 +01:00
randy 01fe45ce8d hosted: C6 co-processor firmware moves to the ignored .hosted/, kept out of git 2026-12-03 09:56:15 +01:00
randy 7c704fa55d stackchan: WiFi output power 11 dB, the base right under the Core spoils the link 2026-12-02 19:31:55 +01:00
23 changed files with 43 additions and 471 deletions

No files matched your search

+1
View File
@@ -7,3 +7,4 @@
/archive/
/trash/
.device-builder.json
/.hosted/
+3 -8
View File
@@ -81,14 +81,9 @@ ota:
api:
# status page until Home Assistant connects (log viewers don't subscribe to states)
on_client_connected:
- delay: 2s
- if:
condition:
api.connected:
state_subscription_only: true
then:
- lvgl.page.show: page_home
# Home Assistant has subscribed and received every state
on_client_synced:
- lvgl.page.show: page_home
on_client_disconnected:
- if:
condition:
-4
View File
@@ -1,4 +0,0 @@
build/
managed_components/
sdkconfig
sdkconfig.old
-6
View File
@@ -1,6 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(xiao_c6_spi)
-28
View File
@@ -1,28 +0,0 @@
= 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.
-12
View File
@@ -1,12 +0,0 @@
#!/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
-63
View File
@@ -1,63 +0,0 @@
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
-4
View File
@@ -1,4 +0,0 @@
idf_component_register(SRCS "main.c"
INCLUDE_DIRS "."
REQUIRES esp_hosted
PRIV_REQUIRES nvs_flash esp_wifi)
@@ -1,5 +0,0 @@
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'
-39
View File
@@ -1,39 +0,0 @@
/*
* 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));
}
}
@@ -1,7 +0,0 @@
# 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
1 # ESP-Hosted shared partition table — 4 MB flash, dual OTA (1.75 MB per slot)
2 # Name, Type, SubType, Offset, Size
3 nvs, data, nvs, 0x9000, 0x4000
4 otadata, data, ota, 0xd000, 0x2000
5 phy_init, data, phy, 0xf000, 0x1000
6 ota_0, app, ota_0, 0x10000, 0x1C0000
7 ota_1, app, ota_1, 0x1D0000, 0x1C0000
-25
View File
@@ -1,25 +0,0 @@
# ── 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
@@ -1,112 +0,0 @@
# 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
+4 -5
View File
@@ -48,7 +48,7 @@ logger:
globals:
# CAN ID -> frames seen and the last data
- id: frames_per_id
type: std::map<uint32_t, std::pair<uint32_t, std::vector<uint8_t>>>
type: std::map<uint32_t, std::pair<uint32_t, canbus::CanPayload>>
- id: ecm_last_seen
type: uint32_t
initial_value: '0'
@@ -80,13 +80,12 @@ canbus:
0x262, 0x263, 0x266, 0x2C1, 0x2C3, 0x3A0, 0x3D3, 0x4AC,
0x440, 0x442, 0x443, 0x44D, 0x640};
bool watch = std::find(std::begin(noisy), std::end(noisy), can_id) == std::end(noisy);
bool changed = e.second != x;
bool changed = !std::equal(x.begin(), x.end(), e.second.begin(), e.second.end());
// 0x224 (brake): byte 5 counts, compare the rest
if (can_id == 0x224 && x.size() > 5 && e.second.size() == x.size()) {
watch = true;
auto a = x, b = e.second;
a[5] = b[5] = 0;
changed = a != b;
changed = !std::equal(x.begin(), x.begin() + 5, e.second.begin()) ||
!std::equal(x.begin() + 6, x.end(), e.second.begin() + 6);
}
if (watch && e.first > 1 && changed) {
char hex[format_hex_pretty_size(8)];
-54
View File
@@ -51,60 +51,6 @@ api:
- rtttl.play:
rtttl: !lambda 'return song;'
# light:
# - platform: neopixelbus
# type: GRB
# pin: 2
# variant: WS2812
# method: ESP8266_UART1
# num_leds: 1
# name: "${name} Light"
# id: neo
# effects:
# # Use default parameters:
# - random:
# # Customize parameters
# - random:
# name: "My Slow Random Effect"
# transition_length: 30s
# update_interval: 30s
# - random:
# name: "My Fast Random Effect"
# transition_length: 4s
# update_interval: 5s
# - strobe:
# - strobe:
# name: Strobe Effect With Custom Values
# colors:
# - state: True
# brightness: 100%
# red: 100%
# green: 90%
# blue: 0%
# duration: 500ms
# - state: False
# duration: 250ms
# - state: True
# brightness: 100%
# red: 0%
# green: 100%
# blue: 0%
# duration: 500ms
# - flicker:
# - flicker:
# name: Flicker Effect With Custom Values
# alpha: 95%
# intensity: 1.5%
# - addressable_rainbow:
# - addressable_rainbow:
# name: Rainbow Effect With Custom Values
# speed: 10
# width: 50
# - addressable_scan:
# - addressable_scan:
# name: Scan Effect With Custom Values
# move_interval: 100ms
globals:
- id: alarm_id
type: bool
-7
View File
@@ -77,13 +77,6 @@ binary_sensor:
id: media_out
light:
# - platform: neopixelbus
# type: GRB
# pin: 27
# variant: WS2812
# num_leds: 1
# name: On-Board LED"
# id: neo_buildin
- platform: rgb
name: Light
id: led_light
-42
View File
@@ -49,10 +49,6 @@ esp32:
sram1_as_iram: true
external_components:
# Ethernet LLDP 802.1AB transmitter
# - source: github://pr#11760
# components: [ethernet]
# refresh: 1h
- source: github://pr#2112
components: ["m5stack_4relay"]
refresh: 1h
@@ -67,44 +63,6 @@ i2c:
scl: 16
scan: true
# ethernet:
# lldp:
# # Enable LLDP transmission
# #enabled: true
# # Optional: override default port
# port: eth
# # Optional: override default system name
# system_name: mcu-${device}
# # Optional: override default system description
# system_description: ${comment}
# # Optional: override default "fast mode" burst packet count
# tx_fast_count: 4
# # Optional: override default LLDP frame transmission interval
# tx_interval: 30
# # Optional: override default hold count, used in conjuction with tx_interval to calculate overall TTL
# tx_hold: 4
# ethernet:
# type: LAN8720
# mdc_pin: 23
# mdio_pin: 18
# clk_mode: GPIO17_OUT
# phy_addr: 0
# power_pin: 12
# use_address: 10.17.240.245
# # Optional manual IP
# manual_ip:
# static_ip: 10.17.240.254
# gateway: 10.17.240.1
# subnet: 255.255.255.0
# ethernet:
# use_address: 10.17.241.254
# use_address: 10.17.241.98
# use_address: mcu-gateway.local
uart:
id: uart_modbus
tx_pin: 4
+3 -8
View File
@@ -86,14 +86,9 @@ packages:
api:
# status page until Home Assistant connects (log viewers don't subscribe to states)
on_client_connected:
- delay: 2s
- if:
condition:
api.connected:
state_subscription_only: true
then:
- lvgl.page.show: main_page
# Home Assistant has subscribed and received every state
on_client_synced:
- lvgl.page.show: main_page
on_client_disconnected:
- if:
condition:
+3 -8
View File
@@ -148,14 +148,9 @@ packages:
api:
# status page until Home Assistant connects (log viewers don't subscribe to states)
on_client_connected:
- delay: 2s
- if:
condition:
api.connected:
state_subscription_only: true
then:
- lvgl.page.show: main_page
# Home Assistant has subscribed and received every state
on_client_synced:
- lvgl.page.show: main_page
on_client_disconnected:
- if:
condition:
+17 -9
View File
@@ -16,7 +16,7 @@
# GPIO39 -> touch_lcd (touchscreen ft63x6 interrupt_pin)
# AXP192 GPIO4 -> LCD reset (on_boot)
# Grove (free):
# Port A red (Core2) I2C GPIO32 SDA, GPIO33 SCL
# Port A red (Core2) I2C GPIO32 SDA, GPIO33 SCL -> can_bus (esp32_can rx GPIO32, tx GPIO33), TJA1050 module
# Port B black (base) GPIO GPIO26 out/DAC, GPIO36 in/ADC (input only); GPIO26 taken by the LoRa868 RST
# Port C blue (base) UART GPIO13 RX, GPIO14 TX -> i2c_port_c (i2c scl GPIO13, sda GPIO14)
# Touch buttons (below the LCD, raw y 240-280): A prev page, B keyboard page, C next page
@@ -127,14 +127,9 @@ mlx90640:
api:
# status page until Home Assistant connects (log viewers don't subscribe to states)
on_client_connected:
- delay: 2s
- if:
condition:
api.connected:
state_subscription_only: true
then:
- lvgl.page.show: {id: main_page, lvgl_id: lvgl_main}
# Home Assistant has subscribed and received every state
on_client_synced:
- lvgl.page.show: {id: main_page, lvgl_id: lvgl_main}
on_client_disconnected:
- if:
condition:
@@ -144,6 +139,19 @@ api:
then:
- lvgl.page.show: {id: status_page, lvgl_id: lvgl_main}
canbus:
- platform: esp32_can
id: can_bus
rx_pin: 32
tx_pin: 33
can_id: 5
bit_rate: 500kbps
canopen:
- id: can_open
canbus_id: can_bus
node_id: 5
i2c:
- id: i2c_main
sda: 21
+4 -17
View File
@@ -124,28 +124,15 @@ wifi:
- component.update: m5paper_display
api:
# status screen until Home Assistant connects (log viewers don't subscribe to states)
on_client_connected:
- delay: 2s
- if:
condition:
api.connected:
state_subscription_only: true
then:
- lambda: id(show_status) = false;
# status screen until Home Assistant has subscribed and received every state (log viewers don't subscribe)
on_client_synced:
- lambda: id(show_status) = false;
- if:
condition:
lambda: return !id(calendar_page);
then:
- component.update: m5paper_display
# outside the battery cycle (power button, USB) WiFi is up anyway: always refresh
- if:
condition:
and:
- lambda: return !id(calendar_page);
- api.connected:
state_subscription_only: true
then:
# outside the battery cycle (power button, USB) WiFi is up anyway: always refresh
- script.execute: fetch_events
on_client_disconnected:
- if:
+5
View File
@@ -910,6 +910,11 @@ st25r_i2c:
id: nfc_tag
state: ""
# the StackChan base right under the Core spoils the WiFi link (ping 160-250 ms, stuttering audio,
# m5stack/StackChan#119); 11 dB brings it to ~20 ms. A ~1 cm gap from the base fixes it fully.
wifi:
output_power: 11dB
api:
actions:
- action: stackchan_say
+3 -8
View File
@@ -38,14 +38,9 @@ packages:
api:
# status page until Home Assistant connects (log viewers don't subscribe to states)
on_client_connected:
- delay: 2s
- if:
condition:
api.connected:
state_subscription_only: true
then:
- lvgl.page.show: main_page
# Home Assistant has subscribed and received every state
on_client_synced:
- lvgl.page.show: main_page
on_client_disconnected:
- if:
condition: