How valmyr/fpoc works
FpOC is an FPGA-based PMSM/BLDC current-control system. Its documented demo samples phase currents and rotor angle, computes a torque/current-control response, drives three-phase PWM, and optionally reports target and actual current over UART. The README identifies the top-level interface and major FOC capabilities; source excerpts were unavailable, so internal module wiring is shown only where the documented design and module roles support it.
Main entry points: foc_top.v FOC Controller · fpga_top.v FPGA Top · i2c_register_read.v I2C Register Read · adc_ad7928.v AD7928 ADC Interface
Components 16
Board Integration
- FPGA Top
RTL/fpga_top.v
Sensing
- I2C Register Read
RTL/i2c_register_read.v - AD7928 ADC Interface
RTL/adc_ad7928.v
FOC Control
- FOC Controller
RTL/foc/foc_top.v - Clarke Transform
RTL/foc/clark_tr.v - Park Transform
RTL/foc/park_tr.v - Sine Cosine
RTL/foc/sincos.v - PI Controller
RTL/foc/pi_controller.v - Hold Detection
RTL/foc/hold_detect.v - Cartesian To Polar
RTL/foc/cartesian2polar.v - SVPWM Generator
RTL/foc/svpwm.v
Outputs
- UART Monitor
RTL/uart_monitor.v
Other components
- AS5600 Encoder
- Phase Currents
- Motor Driver
- Serial Monitor
Connections 17
- AS5600 Encoder → I2C Register Read: provides angle
- FPGA Top → I2C Register Read: reads registers
- Phase Currents → AD7928 ADC Interface: analog currents
- FPGA Top → AD7928 ADC Interface: samples currents
- I2C Register Read → FOC Controller: angle data
- AD7928 ADC Interface → FOC Controller: current samples
- FOC Controller → Clarke Transform: transforms currents
- FOC Controller → Park Transform: transforms currents
- FOC Controller → Sine Cosine: uses angle
- FOC Controller → PI Controller: controls current
- FOC Controller → Hold Detection: checks hold
- FOC Controller → Cartesian To Polar: converts command
- FOC Controller → SVPWM Generator: generates PWM
- FPGA Top → FOC Controller: runs control
- FPGA Top → UART Monitor: sends monitor data
- UART Monitor → Serial Monitor: transmits values
- FPGA Top → Motor Driver: outputs three-phase PWM