Skip to content

Observation: async LoRa TX state machine polls OPERATION_MODE over SPI4 with no delay (main loop starved in simulation) #3

Open

Description

@ShahriarAhnaf

Observation (not a confirmed defect). With LoRa telemetry on, the async LoRa TX state machine (lora_async.c) in LORA_TX_STATE_TRANSMITTING reads OPERATION_MODE over SPI4 from the read-complete callback until it sees STANDBY, with no delay. The driver has no DIO0 EXTI (HAL_NVIC_EnableIRQ( [lora placeholder] ) in sensor.c).

  • MEASURED (Simantic sim 0.10.1, sim/scenario.yaml, SDR_LORA=1, --trace-symbol / --trace-interrupts): from 4.0638 s virtual, SPI4 (IRQ84, priority 2) runs back to back: 779,191 entries by 7 s, no idle gap in a 5.5 ms window. SysTick (priority 15) stops (4063 ticks in 7 s), so the main loop's 10 ms HAL SPI2 timeout never expires and sensor_dump is not called again after 4.06 s.
  • About 4 SPI4 interrupts of about 3.8 us each per 15 us read, i.e. the simulated CPU is saturated.
  • Whether silicon leaves the main loop idle time here is unverified: it depends on the real cost of HAL_SPI_IRQHandler and the FSM callback (cache, flash wait states) against the real SPI4 byte time; neither was measured. About one SPI4 entry in four finds no enabled flag set, which may be a simulator modelling gap; a model gap is a candidate, not proven.
  • With LoRa off the flight loop runs at about 420 Hz in the same scenario.

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 'LoRa stall (the flight loop after 4.06 s)').

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions