Quiet Mode

STM32 PWM Frequency Change Debug

Symptom

At the 16 kHz carrier the shaft settles at the commanded speed. At 20 kHz the same command settles a quarter fast. The registers and bit fields are on the Datasheet tab. The motor's registers are in the Circuit figure.

Measured speed of the starter with 10500 RPM commanded: at the 16 kHz carrier the shaft reaches 10423 RPM by 49 ms, on the command; at 20 kHz it reaches 13014 RPM, a quarter fast

Circuit

Block diagram: U1 STM32F4 drives the bridge and motor M1 from TIM2 channel 1 on PA0, sends its log on USART1 TX on PA9 to a serial console, and reads the speed command and carrier setting the bench host writes into SRAM; below it, the three plant registers the program uses, each with offset, access and meaning

Pass condition

At every carrier the shaft is within 500 RPM of the command by 40 ms and within 300 at the end, no fault. TIM2 runs at the carrier set, prescaler 0.

Notes

The operator sets the carrier and speed before the drive starts. The drive runs 45 ms. TIM2 counts at 16 MHz, SysTick at 72 MHz.

Related challenges

Loading the interactive arena.