Jason
3b32f67087
Fix SPI bugs #9 (NULL platform_ops) and #10 (missing CS toggle), widen chip_select to uint16_t
...
Bug #9 : Both TX and RX SPI init params had platform_ops = NULL, causing
adf4382_init() -> no_os_spi_init() to fail with -EINVAL. Fixed by setting
platform_ops = &stm32_spi_ops and passing stm32_spi_extra with correct CS
port/pin for each device.
Bug #10 : stm32_spi_write_and_read() never toggled chip select. Since TX
and RX ADF4382A share SPI4, every register write hit both PLLs. Rewrote
stm32_spi.c to assert CS LOW before transfer and deassert HIGH after,
using stm32_spi_extra metadata. Backward-compatible: legacy callers
(e.g., AD9523) with cs_port=NULL skip CS management.
Also widened chip_select from uint8_t to uint16_t in no_os_spi.h since
STM32 GPIO_PIN_xx values (e.g., GPIO_PIN_14=0x4000) overflow uint8_t.
10/10 tests pass (8 original + 2 new regression tests).
2026-03-19 10:00:05 +02:00
Jason
397969348e
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
2026-03-19 09:42:59 +02:00
Jason
b93ee04592
Add .gitignore for test build artifacts, remove committed binaries and .o files
2026-03-19 09:28:48 +02:00
Jason
28a66889ad
Add MCU firmware test harness with 8 bug-confirming tests
...
Complete test infrastructure for the observe-before-fix methodology:
- stm32_hal_mock: HAL stub types + spy/recording ring buffer (512 entries)
- ad_driver_mock: ADF4382/AD9523 mock drivers with configurable returns
- 9 shim headers redirecting real #includes to mock types
- Makefile with individual (test_bug1..8) and aggregate (test) targets
All 8 tests pass, confirming:
#1 Timed sync init ordering (SetupTimedSync before initialized=true)
#2 AD9523 double setup (first call before reset release)
#3 TriggerTimedSync no-op (prints messages, no HW action)
#4 Phase shift before init error check
#5 SetFinePhaseShift GPIO-only placeholder (no PWM)
#6 Timer variable collision (last_check vs last_check1)
#7 GPIO pin mapping conflict (manager.h vs CubeMX main.h)
#8 uart_print/uart_println commented out
2026-03-19 09:28:19 +02:00
Jason
fda8aab7a2
Add DIAG instrumentation to beamformer, PA, USB, and remaining main.cpp subsystems
...
Completes the observe-before-fix instrumentation pass across all critical
firmware subsystems:
- ADAR1000_Manager.cpp: 99 DIAG calls covering power-up/down, TX/RX mode
switching, ADTR1107 init sequence, SPI transfers, ADC reads (with 100ms
timeout guard on unbounded busy-wait), and scratchpad verification.
- DA5578.c: 21 DIAG calls on init, reset, channel writes, clear pin
activation, and I2C error paths.
- ADS7830.c: DIAG on init (with test-read verification) and I2C
transmit/receive error logging in single-ended and differential reads.
- USBHandler.cpp: DIAG on state transitions, start flag detection,
settings data accumulation, and SET/END marker parsing.
- main.cpp remaining sections: CDC_Receive_FS callback, systemPowerUp/Down
sequences, executeChirpSequence (entry-only, timing-critical path),
runRadarPulseSequence (beam position + stepper logging), checkSystemHealth
(per-subsystem error logging with GPIO reads), attemptErrorRecovery,
Emergency_Stop, handleSystemError, PA IDQ calibration loops (DAC/ADC init,
per-channel initial readings, calibration iterations with final values),
TMP37 ADC3 init, error handler init, and GUI status send.
No behavioral changes. All logging is compile-time removable via DIAG_DISABLE.
2026-03-19 08:57:58 +02:00
Jason
bf912067cc
Add bring-up diagnostic instrumentation to clocking/LO subsystem and main init
...
Observe-before-fix instrumentation for bench bring-up: adds timestamped
DIAG logging to the AD9523 clock config, ADF4382A LO manager, power
sequencing, lock monitoring, temperature monitoring, and safe-mode entry.
Annotates known bugs (double ad9523_setup call, timed-sync init ordering,
TriggerTimedSync no-op, phase-shift before init-check, last_check timer
collision) without changing any runtime behavior.
2026-03-19 08:32:25 +02:00
NawfalMotii79
74d5a76abb
Merge pull request #7 from walidb212/fix/gy85-i2c-status
...
fix(firmware): propagate gy85 i2c failures
2026-03-15 01:57:28 +00:00
NawfalMotii79
eca26f413d
Merge pull request #6 from walidb212/refactor/adar-sequencing-constants
...
refactor(firmware): name adar power sequencing constants
2026-03-15 01:56:59 +00:00
wb-eugenia
a4b8a144ed
fix(firmware): return gps transport status
2026-03-13 19:41:45 +01:00
wb-eugenia
9bb6080a73
fix(firmware): propagate gy85 i2c failures
2026-03-13 19:38:42 +01:00
wb-eugenia
b1cb897275
refactor(firmware): name adar power sequencing constants
2026-03-13 19:32:10 +01:00
NawfalMotii79
da0b87bee9
Add files via upload
2026-03-09 00:18:58 +00:00
NawfalMotii79
5fbe97fa5f
Add files via upload
2026-03-09 00:17:39 +00:00