mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-12-06 01:06:52 +01:00
stm32: F4 Discovery and miniSTM32F103ZE-EK, button debounce, ST-LINK serials
This commit is contained in:
1 parent
93f622f430
commit
3cafd749d3
3 files changed
+154
No files matched your search
@@ -0,0 +1,75 @@
|
|||||||
|
---
|
||||||
|
# Hardware: CZ miniSTM32F103ZE-EK (STM32F103ZET6, 512K flash, no radio), external ST-LINK/V2 on SWD
|
||||||
|
# Pinout:
|
||||||
|
# PA9/PA10 USART1 TX/RX -> PL-2303 on mini-USB CN3 (logger)
|
||||||
|
# PE2 DS2 (active low) -> LED (light binary)
|
||||||
|
# PB10 K1 (active low) -> Button (binary_sensor gpio)
|
||||||
|
# ST-LINK SN: 48FF6B064967515318282087 (esphome-zephyr upload can't pick a probe without VCP)
|
||||||
|
# flash: STM32_Programmer_CLI -c port=SWD sn=48FF6B064967515318282087 mode=UR -d <build>/.west_build/mcuboot/zephyr/zephyr.bin 0x08000000
|
||||||
|
# -d <build>/.west_build/zephyr/zephyr/zephyr.signed.bin 0x08010000 -v -rst
|
||||||
|
esphome:
|
||||||
|
name: mcu-stm32-f103ze
|
||||||
|
friendly_name: STM32 F103ZE
|
||||||
|
|
||||||
|
# needs the esphomeplatformzephyr fork (esphome-zephyr), upstream has no stm32: platform yet
|
||||||
|
# waveshare_open103z: same F103ZE, 8 MHz HSE, console on USART1 PA9/PA10
|
||||||
|
stm32:
|
||||||
|
variant: STM32F1
|
||||||
|
board: waveshare_open103z
|
||||||
|
framework:
|
||||||
|
type: zephyr
|
||||||
|
# no network, so no OTA: one image slot, MCUboot only verifies and boots it
|
||||||
|
single_slot: true
|
||||||
|
# waveshare_open103z ships no partitions: MCUboot 32K, storage 32K (16 x 2K pages), the app in the rest.
|
||||||
|
# MCUboot needs the same table; the fork appends its own code-partition = &boot_partition after it
|
||||||
|
overlays:
|
||||||
|
app: &partitions |
|
||||||
|
&flash0 {
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
boot_partition: partition@0 {
|
||||||
|
label = "mcuboot";
|
||||||
|
reg = <0x00000000 DT_SIZE_K(32)>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
storage_partition: partition@8000 {
|
||||||
|
label = "storage";
|
||||||
|
reg = <0x00008000 DT_SIZE_K(32)>;
|
||||||
|
};
|
||||||
|
slot0_partition: partition@10000 {
|
||||||
|
label = "image-0";
|
||||||
|
reg = <0x00010000 DT_SIZE_K(448)>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/ { chosen { zephyr,code-partition = &slot0_partition; }; };
|
||||||
|
mcuboot: *partitions
|
||||||
|
|
||||||
|
logger:
|
||||||
|
|
||||||
|
output:
|
||||||
|
- platform: gpio
|
||||||
|
id: led_out
|
||||||
|
pin:
|
||||||
|
number: PE2
|
||||||
|
inverted: true
|
||||||
|
|
||||||
|
light:
|
||||||
|
- platform: binary
|
||||||
|
name: LED
|
||||||
|
id: led
|
||||||
|
output: led_out
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: gpio
|
||||||
|
name: Button
|
||||||
|
pin:
|
||||||
|
number: PB10
|
||||||
|
inverted: true
|
||||||
|
mode:
|
||||||
|
input: true
|
||||||
|
pullup: true
|
||||||
|
on_press:
|
||||||
|
light.toggle: led
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
---
|
||||||
|
# Hardware: ST STM32F4DISCOVERY (STM32F407VGT6, 1M flash, no radio), ST-LINK/V2 without VCP
|
||||||
|
# Pinout:
|
||||||
|
# PA11/PA12 micro-USB CN5 (OTG FS) -> logger (USB CDC)
|
||||||
|
# PD12 LD4 green (active high) -> LED (light binary)
|
||||||
|
# PA0 B1 user (active high) -> Button (binary_sensor gpio)
|
||||||
|
# ST-LINK SN: 53FF6E065087545435390387 (esphome-zephyr upload can't pick a probe without VCP)
|
||||||
|
# flash: STM32_Programmer_CLI -c port=SWD sn=53FF6E065087545435390387 mode=UR -d <build>/.west_build/mcuboot/zephyr/zephyr.bin 0x08000000
|
||||||
|
# -d <build>/.west_build/zephyr/zephyr/zephyr.signed.bin 0x08010000 -v -rst
|
||||||
|
esphome:
|
||||||
|
name: mcu-stm32-f4disco
|
||||||
|
friendly_name: STM32 F4 Discovery
|
||||||
|
|
||||||
|
# needs the esphomeplatformzephyr fork (esphome-zephyr), upstream has no stm32: platform yet
|
||||||
|
stm32:
|
||||||
|
variant: STM32F4
|
||||||
|
board: stm32f4_disco
|
||||||
|
framework:
|
||||||
|
type: zephyr
|
||||||
|
# no network, so no OTA: one image slot, MCUboot only verifies and boots it
|
||||||
|
single_slot: true
|
||||||
|
# NVS sector = flash page; needs >= 2 of them, so storage takes the two 16K pages (sectors 2-3)
|
||||||
|
kconfig_options:
|
||||||
|
SETTINGS_NVS_SECTOR_COUNT: 2
|
||||||
|
# stm32f4_disco ships no partitions at all: MCUboot in sectors 0-1, storage in 2-3, the app in 4-11.
|
||||||
|
# MCUboot needs the same table; the fork appends its own code-partition = &boot_partition after it
|
||||||
|
overlays:
|
||||||
|
app: &partitions |
|
||||||
|
&flash0 {
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
boot_partition: partition@0 {
|
||||||
|
label = "mcuboot";
|
||||||
|
reg = <0x00000000 DT_SIZE_K(32)>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
storage_partition: partition@8000 {
|
||||||
|
label = "storage";
|
||||||
|
reg = <0x00008000 DT_SIZE_K(32)>;
|
||||||
|
};
|
||||||
|
slot0_partition: partition@10000 {
|
||||||
|
label = "image-0";
|
||||||
|
reg = <0x00010000 DT_SIZE_K(960)>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/ { chosen { zephyr,code-partition = &slot0_partition; }; };
|
||||||
|
mcuboot: *partitions
|
||||||
|
|
||||||
|
logger:
|
||||||
|
hardware_uart: USB_CDC
|
||||||
|
|
||||||
|
output:
|
||||||
|
- platform: gpio
|
||||||
|
id: led_out
|
||||||
|
pin: PD12
|
||||||
|
|
||||||
|
light:
|
||||||
|
- platform: binary
|
||||||
|
name: LED
|
||||||
|
id: led
|
||||||
|
output: led_out
|
||||||
|
|
||||||
|
# B1 has an external pull-down on the board
|
||||||
|
binary_sensor:
|
||||||
|
- platform: gpio
|
||||||
|
name: Button
|
||||||
|
pin: PA0
|
||||||
|
# B1 bounces, toggle fired twice per press
|
||||||
|
filters:
|
||||||
|
- delayed_on_off: 30ms
|
||||||
|
on_press:
|
||||||
|
light.toggle: led
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
# PA2/PA3 USART2 TX/RX -> ST-LINK virtual COM port (logger)
|
# PA2/PA3 USART2 TX/RX -> ST-LINK virtual COM port (logger)
|
||||||
# PA5 LD2 green (active high) -> LED (light binary)
|
# PA5 LD2 green (active high) -> LED (light binary)
|
||||||
# PC13 B1 user (active low) -> Button (binary_sensor gpio)
|
# PC13 B1 user (active low) -> Button (binary_sensor gpio)
|
||||||
|
# ST-LINK SN: 066BFF554954777167032417 (on-board V2-1, upload --device /dev/ttyACM0 resolves it from the VCP)
|
||||||
esphome:
|
esphome:
|
||||||
name: mcu-stm32-nucleo
|
name: mcu-stm32-nucleo
|
||||||
friendly_name: STM32 Nucleo
|
friendly_name: STM32 Nucleo
|
||||||
@@ -66,5 +67,8 @@ binary_sensor:
|
|||||||
pin:
|
pin:
|
||||||
number: PC13
|
number: PC13
|
||||||
inverted: true
|
inverted: true
|
||||||
|
# B1 bounces, toggle fired twice per press
|
||||||
|
filters:
|
||||||
|
- delayed_on_off: 30ms
|
||||||
on_press:
|
on_press:
|
||||||
light.toggle: led
|
light.toggle: led
|
||||||
Reference in new issue
Block a user