Building a FOC Stepper Motor Controller with the MAX32672 Feather Board

Building a FOC Stepper Motor Controller with the MAX32672 Feather Board

Introduction

This project is a journey towards building a Field-Oriented Control (FOC) stepper motor controller based on the MAX32672 Feather Board. The goal is to create a compact, high-performance, closed-loop motor controller suitable for applications such as CNC machines, robotics, and distributed motion control systems.

I received the MAX32672 Feather Board as part of the “Learn, Build & Win” program organized by DigiKey in collaboration with Circuit Digest and supported by Analog Devices. The program selects participants based on their project proposals and provides them with development hardware to learn and build their ideas.

Special thanks to DigiKey, Circuit Digest, and Analog Devices for providing the opportunity and the hardware to explore advanced motor control and embedded systems.

I will be documenting the progress of this project in this thread as the hardware and firmware evolve.


Project Goals

  • Implement closed-loop FOC for hybrid stepper motors.
  • Achieve smooth operation with reduced vibration and resonance.
  • Build a distributed motor control architecture suitable for multi-axis CNC systems.
  • Utilize the DSP and floating-point capabilities of the MAX32672 for efficient real-time control.
  • Integrate current sensing, encoder feedback, and fault detection.

Hardware Used

Controller

  • MAX32672 Feather Board
  • Development using MaximSDK (MSDK) with VS Code

Motor Driver

Current prototype:

  • A4953 Dual H-Bridge Driver

Future plans:

  • Evaluate higher-power driver stages if required.

Current Sensing

Current prototype:

  • INA180 Current Sense Amplifier

Planned upgrade:

  • INA240 Current Sense Amplifier
    • Better common-mode transient rejection
    • More suitable for PWM motor control applications

Position Feedback

Current prototype:

  • AS5047P Magnetic Encoder Module

Future plans:

  • Integrate the AS5047P IC directly onto the controller PCB.

Why the MAX32672?

Motor control requires significant mathematical computation and fast signal acquisition. The MAX32672 offers several features that make it an excellent platform for FOC applications:

  • ARM Cortex-M4F running at up to 100 MHz
  • Hardware Floating Point Unit (FPU)
  • DSP/SIMD instructions
  • 1 MB Flash and 200 KB SRAM
  • High-speed 12-bit ADC with up to 1 Msps sampling
  • Multiple SPI interfaces
  • Low-power architecture

These capabilities make it possible to efficiently implement:

  • Clarke Transform
  • Park Transform
  • PI current control loops
  • Position and velocity control
  • Filtering and signal processing
  • Future condition monitoring algorithms

Development Progress

Stage 1: Encoder Bring-Up

Hardware

  • MAX32672 Feather Board
  • AS5047P Magnetic Encoder Module

Development Environment

  • MaximSDK (MSDK)
  • VS Code

Communication Interface

  • SPI

Status

SPI communication established

Successfully reading angular position

Continuous position updates verified

Current Test Setup

Example Output

Angle: 0.00°
Angle: 17.62°
Angle: 91.48°
Angle: 181.32°
Angle: 359.92°

The encoder communication is working reliably and provides smooth position feedback. This marks the first major milestone toward implementing closed-loop FOC.


Next Stage: Current Sensing

Hardware

  • INA180 Current Sense Amplifier

Objectives

  • Measure phase currents
  • Characterize ADC performance
  • Validate current feedback signals
  • Prepare for current control loops

Future Upgrade

  • INA240 Current Sense Amplifier for improved PWM rejection and measurement accuracy.

Future Development

Current Control

  • ADC synchronization
  • Offset calibration
  • Current filtering

FOC Implementation

  • Clarke Transform
  • Park Transform
  • PI Current Controllers
  • Space Vector PWM

Closed-Loop Motion Control

  • Torque control
  • Velocity control
  • Position control

Hardware Integration

Move from evaluation modules to a custom PCB containing:

  • MAX32672
  • AS5047P IC
  • INA240 current sensing
  • H-bridge driver stage
  • Communication interface

Distributed Motion Control

Long-term plans include networking multiple motor controllers together to create a distributed control architecture for CNC machines and robotics.


Current Status

Feature Status
Development Environment Working
SPI Communication Working
AS5047P Interface Working
Angular Position Feedback Working
Current Sensing In Progress
FOC Current Loop Planned
SVPWM Planned
Closed-Loop Stepper Control Planned
Custom PCB Planned

Acknowledgements

This project is being developed as part of the Learn, Build & Win program organized by DigiKey and Circuit Digest, with hardware support from Analog Devices.

A special thanks to:

  • DigiKey for supporting makers and engineers through initiatives like this.
  • Circuit Digest for organizing the program and fostering a community of learners and builders.
  • Analog Devices for providing the MAX32672 Feather Board and enabling experimentation with advanced embedded systems and motor control.

I’ll continue updating this thread as I progress through current sensing, PWM generation, and eventually closed-loop FOC implementation. Feedback and suggestions are always welcome!