I think I have a problem with these simplefocmini boards that i just got. I cannot get them to spin these little gimbal motors properly. The find_pole_pairs_number sketch reports error and I can see the motor is wiping back and forth instead of moving in one direction. Almost as if one phase was out. Is there a way to energize each phase in sequence (delayed by keypress so I can measure all the phase voltages at the motor and at the driver with a multimeter) ? I recognize this is the old fashioned way of driving bldc, not foc. But is there a way to setup simplefoc to debug the wiring in this way ? i’m just in a bit of a hurry because the Amazon return window is rapidly closing on these driver boards… Do you think that this is a realistic method of tracing down the problem ? Any suggestion are welcome, especially if there is an easier more direct way to diagnose.
Indeed that sounds like one phase out. You can call motor.setPhaseVoltage to set the electric angle without it being modified by pole_pairs, or call driver->setPwm to bypass the motor code entirely and directly set the output voltage on each phase (be careful if you have a motor connected, not to have too much difference between any two phases and burn it). You should be able to measure the voltages with a multimeter (one probe on ground, the other on the motor wire solder pad).
But once you figure out which phase isn’t working, debugging the reason why is more difficult. Double check the pins passed to the driver constructor are correct, and use multimeter to check electrical continuity from the MCU pin to the driver input pin. It could just be a bad solder joint.
Thanks, I was hoping it would be just a simple flaky wire issue. It looks more like the the stm32f411ce (blackpill) is not generating pwm signals. Although the pins do work as gpio pins. I notice there are various libraries, including the HAL for doing hardware PWM. Not the kind of fun I was expecting with this!
Which pins are you using? Only certain ones can do PWM, and they all need to belong to the same timer too. I’d recommend PA8, PA9, PA10 (labelled A8, A9, A10 on the blackpill)
Oh no, there go my 2 I2C ports! I guess I’ll be reading analog signals from the AS5600 instead. Thats still a decent first iteration, I guess, 2 gimbals motors run off one blackpill
Don’t worry, there are plenty of other timer pins that will work. TIM1 has special features for 6PWM drivers so it’s my default first choice, but 3PWM can use any of TIM1,2,3,4,5. TIM9,10,11 only have one or two channels each, so won’t work. The channels don’t have to be sequential either, just belong to the same timer.
Right, same timer. well that works! fwiw, I used the stm32cubemx to work out which pins to use. It has the nice graphical pin layout/allocation tool and I can avoid the brain fog inducing pin function table lookup.
2 posts were split to a new topic: STM32 pinouts docs - should we put more effort in it