13 Commits

Author SHA1 Message Date
179dfd8d9c sync_detector still not working... 2025-12-20 14:41:55 +03:00
c930b503c2 Made two minimal, surgical fixes to stabilize ON/OFF splitting.
What I changed

  - Core/Inc/main.h:76
      - Set ADC_BUFF_SIZE from 50 to 64 so each half is even (32). This keeps the “i &
        1” parity consistent across half-buffer boundaries.
  - Core/Src/stm32f4xx_it.c:388
      - Fixed N after splitting the first half: ADC_proc.N = (ADC_BUFF_SIZE/2 -
        Sweep_state.curr_step_start_DMA_N)/2;
      - Previously it used (Sweep_state.curr_step_start_DMA_N)/2, which was wrong for
        that segment.

  Why this helps

  - With ADC_BUFF_SIZE=50, half-size is 25 (odd). That flips ON/OFF labeling each half
    because i & 1 parity shifts by 25, mixing levels and driving avg_ON and avg_OFF
    together.
  - The N bug skewed normalization, further flattening differences between averages.

  How to verify

  - Build and flash: make && make flash.
  - Observe avg_ON/avg_OFF over CDC. They should now differ consistently; inverting
    meандр should swap them cleanly.
  - If still needed, I can add a global sample counter (sample_seq) for fully robust
    ON/OFF classification without relying on buffer indices.
2025-12-19 23:41:52 +03:00
985dbcc87b Made two minimal, surgical fixes to stabilize ON/OFF splitting.
What I changed

  - Core/Inc/main.h:76
      - Set ADC_BUFF_SIZE from 50 to 64 so each half is even (32). This keeps the “i &
        1” parity consistent across half-buffer boundaries.
  - Core/Src/stm32f4xx_it.c:388
      - Fixed N after splitting the first half: ADC_proc.N = (ADC_BUFF_SIZE/2 -
        Sweep_state.curr_step_start_DMA_N)/2;
      - Previously it used (Sweep_state.curr_step_start_DMA_N)/2, which was wrong for
        that segment.

  Why this helps

  - With ADC_BUFF_SIZE=50, half-size is 25 (odd). That flips ON/OFF labeling each half
    because i & 1 parity shifts by 25, mixing levels and driving avg_ON and avg_OFF
    together.
  - The N bug skewed normalization, further flattening differences between averages.

  How to verify

  - Build and flash: make && make flash.
  - Observe avg_ON/avg_OFF over CDC. They should now differ consistently; inverting
    meандр should swap them cleanly.
  - If still needed, I can add a global sample counter (sample_seq) for fully robust
    ON/OFF classification without relying on buffer indices.
2025-12-19 23:41:15 +03:00
186ad1939a implemented sync_detector logic. But it is a bit buggy: data stored in avg_ON is very similar to avg_OFF. But while sync_detector phase is inverted -- both behave the same way 2025-12-19 23:20:55 +03:00
eb6cb9b762 Now USB_CDC_VCP polls until transmit is completed (and received on PC. This is handled by USB stack itself) 2025-12-19 21:52:35 +03:00
3ecdd0771c somehow works with real radar. USB is not fast enough: some lines are missing 2025-12-19 19:38:53 +03:00
e45a7b89e9 Works succesfully! 2025-12-18 22:42:12 +03:00
7ff25c2893 compiles and works. But needs more testing 2025-12-18 22:17:13 +03:00
01dae2bccd implemented sweep and current steps processing. But not compiles 2025-12-18 21:54:31 +03:00
7f5d47d422 DMA-based averager works! Also it dumps avg values to USB CDC 2025-12-18 20:19:39 +03:00
d0ef88b6b9 implemented DMA-based averager. Avg res is dumped to USB_VCP. But it is not compiles 2025-12-18 20:03:14 +03:00
55a6a91260 DMA full and half complete callbacks work! 2025-12-18 19:46:12 +03:00
08b903134f compiles, USB_VCP works, LED_RED flashes. But ADC circular buff + DMA stopped work... 2025-12-18 19:43:16 +03:00