Fix all 8 firmware bugs with regression tests

Bugs fixed in adf4382a_manager.c:
- Bug #1: Move initialized=true before sync setup, propagate sync failure
- Bug #3: Implement TriggerTimedSync with sw_sync pulse (was no-op)
- Bug #5: Replace GPIO-only placeholder with TIM3 PWM for DELADJ
- Bug #7: Correct GPIOG pin definitions to match CubeMX (pins 6-15)

Bugs fixed in main.cpp:
- Bug #2: Remove pre-reset ad9523_setup() call (keep only post-reset)
- Bug #4: Move init error check before phase shift calls
- Bug #6: Fix timer variable (last_check -> last_check1) in temp block
- Bug #8: Uncomment uart_print/uart_println debug helpers

Test harness updates:
- All 8 tests rewritten to assert correct post-fix behavior
- Added TIM PWM mock (SPY_TIM_PWM_START/STOP/SET_COMPARE)
- Added mock_adf4382_set_timed_sync_retval for failure injection
- Updated shims and Makefile for new test dependencies
- All 8 tests pass: make clean && make test -> 8/8 passed
This commit is contained in:
Jason
2026-03-19 09:42:59 +02:00
parent b93ee04592
commit 397969348e
17 changed files with 640 additions and 572 deletions
@@ -17,28 +17,30 @@
/* ---- Constants (copied from real adf4382a_manager.h) ---- */
/* GPIO Definitions — these are the manager.h pin mappings (the buggy ones) */
#define TX_CE_Pin GPIO_PIN_0
#define TX_CE_GPIO_Port GPIOG
#define TX_CS_Pin GPIO_PIN_1
#define TX_CS_GPIO_Port GPIOG
#define TX_DELADJ_Pin GPIO_PIN_2
#define TX_DELADJ_GPIO_Port GPIOG
#define TX_DELSTR_Pin GPIO_PIN_3
#define TX_DELSTR_GPIO_Port GPIOG
#define TX_LKDET_Pin GPIO_PIN_4
#define TX_LKDET_GPIO_Port GPIOG
#define RX_CE_Pin GPIO_PIN_5
#define RX_CE_GPIO_Port GPIOG
#define RX_CS_Pin GPIO_PIN_6
#define RX_CS_GPIO_Port GPIOG
/* GPIO Definitions — corrected to match CubeMX main.h (GPIOG pins 6-15) */
/* RX pins: GPIOG pins 6-10 */
#define RX_LKDET_Pin GPIO_PIN_6
#define RX_LKDET_GPIO_Port GPIOG
#define RX_DELADJ_Pin GPIO_PIN_7
#define RX_DELADJ_GPIO_Port GPIOG
#define RX_DELSTR_Pin GPIO_PIN_8
#define RX_DELSTR_GPIO_Port GPIOG
#define RX_LKDET_Pin GPIO_PIN_9
#define RX_LKDET_GPIO_Port GPIOG
#define RX_CE_Pin GPIO_PIN_9
#define RX_CE_GPIO_Port GPIOG
#define RX_CS_Pin GPIO_PIN_10
#define RX_CS_GPIO_Port GPIOG
/* TX pins: GPIOG pins 11-15 */
#define TX_LKDET_Pin GPIO_PIN_11
#define TX_LKDET_GPIO_Port GPIOG
#define TX_DELSTR_Pin GPIO_PIN_12
#define TX_DELSTR_GPIO_Port GPIOG
#define TX_DELADJ_Pin GPIO_PIN_13
#define TX_DELADJ_GPIO_Port GPIOG
#define TX_CS_Pin GPIO_PIN_14
#define TX_CS_GPIO_Port GPIOG
#define TX_CE_Pin GPIO_PIN_15
#define TX_CE_GPIO_Port GPIOG
/* Frequency definitions */
#define REF_FREQ_HZ 300000000ULL