Commit Graph
2 Commits
Author SHA1 Message Date
kyle c0849f91b6 Add PWM winding-current control with per-speed duty (FR19)
Drive motor IN1-IN4 from TIM4/TIM5 compare outputs
(P23=TIM4_CHA, P24=TIM4_CHB, P25=TIM5_CHA, P26=TIM5_CHB) on a
15.625 kHz carrier derived at init from the actual PCLK
(PCLK/2, 128-tick period; MCU boots on the 4 MHz internal RCH).

Each half-step writes the four compare registers: an energized
coil gets the speed level's duty cycle (85/90/95/100%), a
de-energized coil gets a compare value above the period so its
output stays static low. The advanced timers stop (outputs low)
at standstill and power-off; coils stay energized at the level
duty while parked for a reversal. No forced-output conditions
are used, and the half-step sequencing and trapezoidal ramp are
unchanged.

Docs updated: FR19 in FIRMWARE_REQUIREMENTS.md, README.md,
STATE_MACHINE.md.
2026-11-08 12:34:48 +00:00
kyle 66f5bfbf1a Initial commit: HC32F005 turning table firmware
Firmware (src/app):
- system state machine: IDLE / ROTATING / POWER_OFF
- button: 20 ms debounce, short/double/long classification, boot hold-off
- LED: idle slow blink, solid, speed/direction feedback patterns
- motor: 8-phase half-step drive with trapezoidal acceleration,
  speed levels 2.5/5/7.5/10 RPM, reversal via standstill
- power latch on P33 (push-pull, high = hold, low = cut) with
  decelerate-to-stop sequence before power-off (FR18)
- base timer mode-2 reload semantics (interval = 0x10000 - ARR)

Build: Makefile for arm-none-eabi-gcc, selective DDL compile,
vendor startup + linker script under src/.

Docs: FIRMWARE_REQUIREMENTS.md, STATE_MACHINE.md, README.md.
Vendor datasheet/RM/DDL references under docs/ are kept locally and
tracked in a separate shared repo.
2026-11-06 08:14:55 +00:00