# Current Development Setup This file holds the current `CM7` development setup and implementation specificities. The target architecture is documented in [`ARCHITECTURE.md`](./ARCHITECTURE.md). ## Platform Current bench development targets the STM32H747 on the Arduino Giga platform. The present `CM7` code uses: - STM32 HAL - FreeRTOS - CMSIS-RTOS v2 - `TIM2` as the main engine-control timer The current pin mapping is provisional: - `TIM2_CH1` / `PA0`: crank input capture - `TIM2_CH2` / `PA1`: cam input capture - `TIM2_CH3` / `PA2`: scheduled spark output compare ## Implementation Specificities ### Spark Charge Step The current spark path forces a charge transition before scheduling the release transition. This is temporary and belongs to the development setup, not the target architecture. The final design should handle dwell time explicitly: - compute when charging must begin - compute when spark must release - schedule both as normal output-compare transitions ### Injection Placeholder Injection scheduling is not complete. `tasks/crank.c` contains an early placeholder based on `INJECTION_PHASE`, but there is no finished actuator path yet. ### Sync Filtering The broad sync model is implemented, but thresholds and recovery behavior still need hardware validation. Current behavior includes: - `SYNC_NOT_OK`, `SYNC_PENDING`, and `SYNC_OK` - limited cam miss tolerance through `MAX_CAM_MISS` - crank interval filtering while synchronized - sync loss when cam timing is inconsistent with the expected crank state ### Timer and Pin Routing `TIM2` and the current Arduino Giga pins are useful for bench work. They should not be treated as final ECU hardware routing.