firmware

Guides STM32 Soldier and Queen firmware changes with documented gotchas and canonical references.

23|1|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/Alexey-Lukin/silken_net --skill firmware-alexey-lukin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: firmware
Source: https://github.com/Alexey-Lukin/silken_net/tree/main/.claude/skills/firmware
Command: npx skills add https://github.com/Alexey-Lukin/silken_net --skill firmware-alexey-lukin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working on the silken_net STM32 firmware involves non-obvious traps — AES key-load ordering, RTC backup register budgets, STOP2-frozen ticks, gated CCM code paths — that silently break crypto, timing, or the wire format. This Skill routes you to the canonical docs and a curated gotcha list before you touch a peripheral init, the RTC map, the crypto path, or the wire format. ## Core Features & Use Cases - SSOT Navigation: Points to the exact canon documents (03_01–03_06, CLAUDE.md §5) and source files (soldier/main.c, queen/main.c, firmware/common headers) that own each fact, so summaries never drift from code. - Gotcha Index: Fourteen numbered, hard-won gotchas (ECB-restore after CBC, Load_AES_Key before MX_CRYP_Init, HAL_GetTick frozen in STOP2, vcap = VDDA not EDLC, post-FW.29 StatusByte layout) with full mechanism details in gotchas.md. - Task Recipes: Step-by-step flows for adding a sensor field, changing Lorenz parameters, modifying AES/CRYP init, and touching RTC-persisted state, including host-test parity discipline (make -C firmware/test). - Use Case: Before editing the seed/cold-start crypto, open the skill to learn that lorenz_seed.h is the single shared home and that the seed_derivation host test re-proves parity against OpenSSL. ## Quick Start Ask the assistant to use the firmware skill before modifying AES initialization in the Soldier or Queen main.c files.

Frequently Asked Questions about firmware

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new sensor field to the STM32 Soldier firmware?

Add the field in Soldier Phase 1 ADC, pack it into lora_payload, then update Queen's Process_And_Cache_Data and Flush_Cache_To_Rails, plus the Rails TelemetryUnpackerService unpack string. Check the RTC budget in doc 03_01 §2 first and run the host tests.

Why do LoRa decrypts fail after a CBC operation on the Queen gateway?

The Queen must call Restore_ECB_Mode() after every CBC operation, otherwise subsequent LoRa decrypts silently fail with the wrong KeySize and key left in CRYP. This shared-peripheral restore pattern applies to CRYP, Radio, SPI1, ADC, and DMA.

Why is HAL_GetTick unreliable for measuring time on STM32 STOP2 mode?

SysTick stops during STOP2, so a tick delta measures only active time, never wall time. Use wall-seconds instead via the HAL-free arithmetic in firmware/common/wall_time.h, with the RTC-calendar read living in soldier/main.c.

What is the correct order for Load_AES_Key and MX_CRYP_Init on STM32WL?

Load_AES_Key() must run before MX_CRYP_Init(); if reversed, CRYP silently uses a zeroed key. Both Soldier and Queen follow this order, and it is easy to break during refactoring.

How do I change Lorenz attractor parameters in the bio_contract?

Edit both firmware/bio_contracts/bio_contract.rb and the Rails attractor service, then run parity tests since both sides must stay bitwise-identical IEEE-754 Float. Regenerate lorenz_bytecode.h with gen_bytecode.sh and run the full rspec suite, never a subset.

Does a green local cppcheck lint guarantee CI passes for this firmware?

No. CI runs cppcheck 2.13 while local environments may have 2.21, and the versions classify diagnostics differently, producing false-green local runs. Suppression IDs also migrate with usage changes, so verify against the CI version.