Hey!
I feel bit silly and braindead at this point.
So some of you have seen my project SmartKnob.
After switch to STM32 board i have made everything works (screen, sensor, blows and whistles) but the driver & motor, i took for granted that it will work out of box, like it did with my esp32.
I am using
STM32F446RE - MCU (Nucleo64)
TMC6300 - Driver
Arduino STM_CORE by ST
6PWM Driver in simple foc
Scenario:
Power on, 5V supplied to TMC6300.
SimpleFoc test program on open-loop velocity
Pin Config:
BLDCDriver6PWM driver = BLDCDriver6PWM(PA8, PB13, PA9, PB14, PA10, PB15); //TIM1
Compile, upload… nothing
Power draw 0.004A just.
Upon rotating motor by hand TMC6300 board diag light light up (so driver is fine)
Motor doesnt stall, doesnt draw any current,
I’m confident i have everything hooked up correctly.
Unfortunately don’t have oscilloscope to check PWM signal between mcu and driver.
I’m very confused whats wrong, should i have included <variant.h> of some sort to work with STM32 ?
Hooking it back up to ESP32 works.
Full Code:
// Open loop motor control example
#include <SimpleFOC.h>
// BLDC motor & driver instance
// BLDCMotor motor = BLDCMotor(pole pair number);
BLDCMotor motor = BLDCMotor(7);
//BLDCDriver6PWM driver = BLDCDriver6PWM(PIN_UH, PIN_UL, PIN_VH, PIN_VL, PIN_WH, PIN_WL);
BLDCDriver6PWM driver = BLDCDriver6PWM(PA8, PB13, PA9, PB14, PA10, PB15); //TIM1
//target variable
float target_velocity = 0;
// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&target_velocity, cmd); }
void setup() {
// driver config
// power supply voltage [V]
driver.voltage_power_supply = 5;
driver.init();
// link the motor and the driver
motor.linkDriver(&driver);
// limiting motor movements
motor.voltage_limit = 2; // [V]
motor.velocity_limit = 5; // [rad/s] cca 50rpm
// open loop control config
motor.controller = MotionControlType::velocity_openloop;
// init motor hardware
motor.init();
// add target command T
command.add('T', doTarget, "target velocity");
Serial.begin(115200);
Serial.println("Motor ready!");
Serial.println("Set target velocity [rad/s]");
_delay(1000);
}
void loop() {
// open loop velocity movement
// using motor.voltage_limit and motor.velocity_limit
motor.move(target_velocity);
// user communication
command.run();
}