🛠 Automated Motor Control with HPM5100

HPMicro HPM5100: 400 MHz RISC-V MCU for Motor Control and Analog Sensing · avance · Implémentez un système de contrôle moteur temps réel utilisant les PWM synchronisés et les ADC haute vitesse du HPM5100.

Objectifs

This advanced tutorial aims to configure the HPM5100 for closed-loop BLDC motor control. You will learn to leverage the 32 synchronized PWM channels and 4 SAR ADCs at 2 MSPS for precise regulation. The goal is to achieve minimal latency using the 400 MHz RISC-V core and 416 KB SRAM.

Matériel nécessaire

Étapes

  1. Configure system clocks to reach 400 MHz via the SDK configuration file. Ensure thermal conditions meet specifications to avoid throttling if attempting 480 MHz.
  2. Initialize the PWM module. Select one of the 32 channels to generate three complementary signals with dead-time for the power driver. Enable channel synchronization to ensure coherent switching.
  3. Configure the 16-bit SAR ADCs. Select two channels for phase current reading and one for bus voltage. Set the sampling frequency to 2 MSPS for high temporal resolution.
  4. Implement the ISR triggered by ADC conversion completion. In this routine, read raw values, apply digital filtering, and calculate the error relative to the setpoint.
  5. Apply a PI (Proportional-Integral) controller calculated in floating-point or optimized fixed-point for the RISC-V core. Update PWM comparison registers in real-time.
  6. Enable secure boot via the hardware security interface to protect firmware against copying, essential in industrial applications.

Vérification

Use an oscilloscope to observe PWM signals on output pins. Verify that dead-time is correct and transitions are sharp. On the PC, connect the UART interface (1 of 5 available) to print current and speed values. Ensure latency between ADC read and PWM update remains below 10 µs.

Pour aller plus loin

Integrate CAN FD communication at 8 Mbps for remote control via an industrial bus. Leverage USB 2.0 OTG for firmware updates (DFU) or advanced debugging. Finally, explore the XPI interface to add external Flash memory if control code exceeds internal capacity.

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials