No description
  • C 99.2%
  • Assembly 0.3%
  • CMake 0.2%
  • Linker Script 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Wisse 62cfca5dcc Add configurable motor speed setting
- Motor: build soft start/stop ramps per speed (0% = half, 50% = original,
  100% = double), ramp time stays constant; safety timeout scales with move
- Zigbee: MotorSpeed attribute (0x0005) in the settings cluster, stored in EE
- z2m converter: motor_speed setting
- Bump FW_VERSION to 3
2026-11-06 22:04:37 +01:00
.vscode Fix all zigbee and ota versions. 2026-10-25 17:25:38 +01:00
Bootloader Added Zigbee OTA updates with bootloader [untested] 2026-10-21 09:29:21 +02:00
cmake Upgrade CubeMX + project to new bundles. 2026-10-21 08:57:50 +02:00
Core Add configurable motor speed setting 2026-11-06 22:04:37 +01:00
Drivers Upgrade CubeMX + project to new bundles. 2026-10-21 08:57:50 +02:00
Middlewares/ST Upgrade CubeMX + project to new bundles. 2026-10-21 08:57:50 +02:00
STM32_WPAN Add configurable motor speed setting 2026-11-06 22:04:37 +01:00
tools Added Zigbee OTA updates with bootloader [untested] 2026-10-21 09:29:21 +02:00
Utilities Upgrade CubeMX + project to new bundles. 2026-10-21 08:57:50 +02:00
zigbee2mqtt Add configurable motor speed setting 2026-11-06 22:04:37 +01:00
.clangd Upgrade CubeMX + project to new bundles. 2026-10-21 08:57:50 +02:00
.cproject Moved from ble to zigbee. 2023-03-11 09:42:50 +01:00
.gitignore Basic working BLE. First connection made. 2023-02-22 10:22:58 +01:00
.mxproject Upgrade CubeMX + project to new bundles. 2026-10-21 08:57:50 +02:00
.project Basic working BLE. First connection made. 2023-02-22 10:22:58 +01:00
BackBlind.ioc Blind as Zigbee Window Covering with settings cluster and z2m converter [untested] 2026-10-21 10:09:41 +02:00
CMakeLists.txt Add configurable motor speed setting 2026-11-06 22:04:37 +01:00
CMakePresets.json Upgrade CubeMX + project to new bundles. 2026-10-21 08:57:50 +02:00
ReadMe.md Blind as Zigbee Window Covering with settings cluster and z2m converter [untested] 2026-10-21 10:09:41 +02:00
startup_stm32wb5mxx_cm4.s Upgrade CubeMX + project to new bundles. 2026-10-21 08:57:50 +02:00
STM32WB5MMGHX_FLASH.ld Added Zigbee OTA updates with bootloader [untested] 2026-10-21 09:29:21 +02:00
STM32WB5MMGHX_RAM.ld Basic working BLE. First connection made. 2023-02-22 10:22:58 +01:00
stm32wb5mxx_flash_cm4.ld Fix all zigbee and ota versions. 2026-10-25 17:25:38 +01:00

BackBlind

Software project for controlling the Blinds in the Back of the house.

First steps

  • Working pheriphals;
  • Working BLE connection (easy to test with phone);
  • Encoder + Button
  • Motor control
  • I2C
  • Light sensor
  • BME

Next steps

  • Change to Zigbee
  • Add to HA OTA updates (Zigbee)

The firmware can be updated over Zigbee with the standard OTA Upgrade cluster (client on endpoint 1). Flash layout, see Core/Inc/ota_layout.h:

Address Size Content
0x08000000 16 KB Bootloader (Bootloader/)
0x08004000 212 KB Application
0x08039000 212 KB Download slot
0x0806E000 4 KB Update record
0x08070000 64 KB Zigbee NVM (kept, device stays paired)

How it works:

  1. The device finds the OTA server on the coordinator and asks for a new image at startup and once a day. A "check for update" from the server (Image Notify) also starts a query.
  2. The image is downloaded into the download slot, then the CRC is checked and an update record is written.
  3. After the server says to upgrade, the device reboots. The bootloader checks the image again, copies it to the application slot, and starts it.

First time (wired)

Devices running the old firmware (app at 0x08000000) must be flashed once over SWD:

  • build/<preset>/Bootloader/Bootloader.hex (at 0x08000000)
  • the application as usual (debugger / BackBlind.elf, now linked at 0x08004000)

The debugger only flashes the application, so the bootloader stays in place.

Releasing an update

  1. Increase FW_VERSION in CMakeLists.txt.
  2. Build. This creates build/<preset>/BackBlind-<version>.ota (manufacturer 0x1041, image type 0x0002) using tools/make_ota.py.
  3. Offer the .ota file through the OTA server. For zigbee2mqtt use a local OTA index (ota: zigbee_ota_override_index_location). The device definition (external converter) must have OTA enabled.

Notes:

  • If STM32CubeMX regenerates the linker scripts, set FLASH back to ORIGIN = 0x08004000, LENGTH = 212K. make_ota.py refuses images that are not linked for the app slot.
  • Only the M4 application is updated. The CPU2 wireless stack is not.

Zigbee interface

Endpoint Device Clusters
1 Window covering Basic, Identify, Window Covering (0x0102), BackBlind settings (0xFC10), OTA client
2 Simple sensor Identify, Temperature, Humidity, Pressure, Illuminance

Window Covering (standard): tilt only blind. CurrentPositionTiltPercentage (0% = open, 100% = closed), Up/Open goes to OpenLevel, Down/Close to 100%, Stop, Go To Tilt Percentage. Mode bit 0 (reversed) inverts the motor direction.

BackBlind settings cluster 0xFC10 (manufacturer specific, plain integers):

Attr Name Type Description
0x0000 TiltRange uint16 Encoder steps from 0% to 100% (default 944)
0x0001 DeadSteps uint16 Encoder steps of gear play on a direction change
0x0002 OpenLevel uint8 Tilt (%) for the Up/Open command (default 50)
0x0003 StartupLevel uint8 Tilt (%) assumed after a power loss
0x0004 SyncLevel uint8 Write: the blind is now at x% (no movement)

The settings are stored in their own EE words and survive re-pairing.

zigbee2mqtt: copy zigbee2mqtt/backblind.mjs to <z2m data>/external_converters/.