You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Observation: SPI4 branch of HAL_SPI_MspInit reconfigures PLL2 with a zeroed struct (Rev 2) #1
Observation (Rev 2, app/rev2). The SPI4 (LoRa) branch of HAL_SPI_MspInit (init/rev2/config/Src/stm32h7xx_hal_msp.c) calls HAL_RCCEx_PeriphCLKConfig with a zero-initialised PLL2 struct (M = 0, N = 0) and Spi45ClockSelection = PLL2.
By reading the HAL: it disables PLL2 (the SPI2 branch had configured it), writes DIVM2 = 0, enables PLL2 and polls PLL2RDY for 2 ms, returning HAL_TIMEOUT, so error_fail_fast(ERROR_LORA_SPI_INIT_ERROR) (0x3c).
RM0433 (RCC_PLLCKSELR) says DIVM2 = 0 means the prescaler is disabled. The simulator's H7 RCC model follows that.
MEASURED (Simantic sim 0.10.1): in the simulator the 0x3c failure occurs at 4.08 ms without the sim-only patch. The reconfiguration would also drop the SPI2 flash clock (follows from the same reading; the sim follows the manual).
Not measured on silicon (no H750 rig); the simulated part is an STM32H743VG stand-in because the simulator has no H750 model. Whether silicon behaves the same is unverified; the README's verdict is that it is expected to, since neither the RM nor the model's bench data supports PLL2RDY with DIVM2 = 0.
This fork's build applies a sim-only patch (lora-pll2.patch) giving the SPI4 branch the SPI2 branch's PLL2 values; it is not committed to the firmware.
This was found by running the unmodified firmware on Simantic's simulator (no hardware involved). It is documented here, in Simantic's own fork, as an observation about the code; nothing was sent to the original project. Evidence and run details: https://github.com/simantic-dev/Flight-Computer-Firmware/blob/sim-demo/sim/README.md (section 'Sim-only build patch (lora-pll2.patch) and the PLL2 question').
Activity