6PWM problem when driver motor

Hello every one, I have a problem in simplefoc. It is ok when I use 3PWM mode to driver motor, but it is wrong when I use 6PWM. UVW of driver is always 0V. I don’t know why.

// program

#include <Arduino.h>
#include “SimpleFOC.h”

//BLDCDriver3PWM driver = BLDCDriver3PWM(PA8, PA9, PA10); // good running
BLDCDriver6PWM driver = BLDCDriver6PWM(PA8, PA9, PA10, PA7, PB0, PB1, PA11); // bad running
//BLDCDriver6PWM driver = BLDCDriver6PWM(PA8, PA9, PA10, PB13, PB14, PB15, PA11); // bad running

void setup() {
// power supply voltage [V]
driver.voltage_power_supply = 12;
// Max DC voltage allowed - default voltage_power_supply
driver.voltage_limit = 12;
// driver config
driver.init();
}

void loop() {
driver.setPwm(3, 1, 5);
}

platformio.ini

[env:genericSTM32F103CB]
platform = ststm32
board = genericSTM32F103CB
framework = arduino
lib_archive = false
lib_deps = askuric/Simple FOC@^2.3.4

If you use the build flag

SIMPLEFOC_STM32_DEBUG

You will get more details what is going wrong during the initialization.

1 Like

Thanks for you response! I have know what is wrong. The right code should be follow.

#include <Arduino.h>
#include “SimpleFOC.h”

BLDCDriver6PWM driver = BLDCDriver6PWM(PA8, PA7, PA9, PB0, PA10, PB1);

void setup() {
// power supply voltage [V]
driver.voltage_power_supply = 12;
// Max DC voltage allowed - default voltage_power_supply
driver.voltage_limit = 12;
// driver config
driver.init();

driver.enable();

_delay(1000);
}

void loop() {
driver.setPwm(1, 3, 5);
}