Advisable strategy for implementing an 8 pin PWM class for stepper motors?

Unfortunately I submitted the board for fabrication already… I assumed it was possible to simply extend the 6 pin pwm concept used in 3 phase motors to a stepper motor, i.e. half h-bridges controlled directly through mosfet driver ics from mcu pins. Unfortunately that appears to not be baked into simplefoc…

I did have the presence of mind to connect the pins to the relevant timer-capable pins and their complement outputs. The high side and low side of each half h-bridge are connected to the complementary outputs. Is it possible to just expand the 4 pinPWM class perhaps, such that there is a very short dead time thing and then the complementary pin goes high at the right time, after the other pin of the pair goes high, and vice versa? Is that not the sort of thing the complement output is for? That’s all I need I think.

I am trying to drive a stepper motor with absolute silence, quiet stuff is always hard and you need control over all the details, such as dead time. Also I don’t want the current regulation loops that are present in all other stepper motor drivers. I just need a voltage torque mode driver, the stepper motor has a 1000 pulses per line encoder (with a disk, not the angle sensor with the diametrically magnetised magnet kind).

I just need that class basically, then I can do the rest with the other parts like I did with a 3 phase motor with hall sensors… just 50 pole pairs instead of 11 basically.

:(

Omfg the forum thinks it knows what a valid post is better than a human does and wants it to be at least 20 characters. rolleyes.

There was a PR in the past with an attempt to implement 8-PWM. There’s also a board design for it, the Funqi-Stack… I tested that with 6-PWM but not 8-PWM.

There’s been a lot of Code changes since then, and on some MCU types it may be easier to implement than others. If you don’t need current sensing then RP2350/RP2040 might be a good one. Otherwise with STM32 or ESP32 it should be possible too, but it will require quite some hacking in the library code, I expect…

1 Like

for the record I have realized that simply using the 4pinpwm module and simply configuring the other 4 pins to be the complement with dead time seems promising, however I have not been able to try it yet. Still waiting for a decent working power stage. Interestingly, I found a way to do it on the Pico 2 (RP23250) using the PIO peripheral, so there is no need to use an STM32, I think.

The Pico doesn’t need to use its PIO for this, the normal timers can work fine for making 4 complementary PWMs… in fact it will be a lot easier to set up than on STM32… the pico‘s limitation is it’s ADCs and the current sensing, but we have a new solution for that problem using PIO and SPI based external ADCs :slight_smile:

on STM32 extending the 4-PWM code sounds like a good way to go…