STM32F401 NUCLEO and Simple FOC Shield - arsi-apli/BLDC_Klipper_doc GitHub Wiki
Attention! A BLDC motor at the voltage specified by the manufacturer tends to reach high temperatures quickly. Therefore, it is necessary to use a regulated power supply or a regulated DC/DC voltage converter and start testing the motor from a much lower voltage. My motor is rated for 14.4V and I started from 5V. Although the implementation for NUCLEO allows power/current reduction, it is preferable to regulate the current with the source voltage, because power reduction via firmware reduces the resolution of PWM regulation.
This implementation allows simultaneous control of up to three BLDC motors and configuration of the pins used to control the motor electronics. It is primarily designed for the Simple FOC Shield, but any board designed for BLDC motor control can be used. A list of boards can be found here.
How to build the firmware
If the firmware has BLDC support enabled, the MCU can only drive BLDC motors because the code for the stepper motor is replaced by version that generates the BLDC PWM signals.
git clone https://github.com/arsi-apli/klipper.git
git checkout bldc_stepper
make menuconfig
If the command queue for the motor is empty, the motor power is reduced to the holding power..
make
make stlinkflash
To use it you need to install https://github.com/stlink-org/stlink
printer.cfg
[stepper_x] or [stepper_y] or [stepper_z] or [extruder] or [manual_stepper]
enable_pin: PA9 #Enable pin for the BLDC board
step_pin: PB3 #The same pin as was entered via menuconfig for PWM A. The pin is used to assign the correct BLDC motor, as up to three can be connected.
dir_pin: PD5 #The value is ignored
full_steps_per_rotation: 2520 #for 12N14P, (14/2)*360=2520
microsteps: 1
[mcu]
serial: /dev/ttyACM0
baud: 115200
restart_method: command