ALEX HATTORI

View Original

G431B ESC FOC

There was a week last month where I was oddly in the mood to work on firmware and decided to make a port of the Mini Cheetah motor controller firmware for the G431B ESC dev boards I originally had planned for use in the first quadruped.

The main differences were the new micro (mostly caused flash memory changes due to HAL differences), use of internal (to the micro) op amps as current sense amplifiers, 2x ADCs instead of 3x.

Firmware: https://github.com/alex-hattori/G431B_ESC_V1

Nothing super noteworthy but part of the interest stemmed from me rediscovering the existence of the STSPIN32G4 chip which basically combines the functionality of the micro and DRV chip, making motor controller hardware implementations even easier (STSPIN Chip, Encoder, FETs, done?). Now that I have a working port of the firmware for G4 hardware, it would be minimal effort to make a new physical controller that uses this firmware.

Some of this particular implementation is unideal but that’s how it goes with a dev board designed to use sensorless FOC with RC PWM input.

In particular, there are no SPI peripherals broken out so I bitbang the SPI for the encoder which ends up slowing down the control loop.