Hello,
I purchases the Sparkfun Brushless Gimbal motor driver which uses the TMC6300, as well as a Sparkfun BLDC Gimbal motor. I have been attempting to drive the motor using the PWM pins on the Teensy 4.1, but I have yet to make the motor move successfully. I am applying the driver 7.4 Volts (the motor has a nominal operating voltage of 7.4 V), and the blue LED turns on indicating that the driver is activated. I followed this SimpleFOC forum post for instructions on which pins to use on the Teensy 4.1, but I still have yet to get movement out of the motor.
Can anyone think of where my issues might lie?
Here is the code I am using (also copied and pasted from the above forum, with few alterations).
// 6pwm openloop velocity example
//
// Teensy4.x 6pwm driver generates a 6pwm signal using FlexTimers and it doesn't support the QuadTimers
// - Each high-low pair of the 6pwm has to be A and B channels of the same FlexTimer and to the same submodule
//
// List of available teensy 4.1 pins with their respective submodules and channels
// FlexPWM(timer number)_(submodule)_(channel)
// FlexPWM4_2_A pin 2
// FlexPWM4_2_B pin 3
// FlexPWM1_3_B pin 7
// FlexPWM1_3_A pin 8
// FlexPWM2_2_A pin 6
// FlexPWM2_2_B pin 9
// FlexPWM3_1_B pin 28
// FlexPWM3_1_A pin 29
// FlexPWM2_3_A pin 36
// FlexPWM2_3_B pin 37
#include <SimpleFOC.h>
// BLDC motor & driver instance
// BLDCMotor motor = BLDCMotor(pole pair number);
BLDCMotor motor = BLDCMotor(8);
// make sure to provide channel A for high side and channel B for low side
// BLDCDriver6PWM(pwmA_H, pwmA_L, pwmB_H,pwmB_L, pwmC_H, pwmC_L)
// Example configuration
BLDCDriver6PWM driver = BLDCDriver6PWM(2,3, 6,9, 8,7,32);
// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&motor.target, cmd); }
void doLimit(char* cmd) { command.scalar(&motor.voltage_limit, cmd); }
void setup() {
// driver config
// power supply voltage [V]
driver.voltage_power_supply = 8;
// limit the maximal dc voltage the driver can set
// as a protection measure for the low-resistance motors
// this value is fixed on startup
driver.voltage_limit = 9;
driver.init();
// link the motor and the driver
driver.enable();
motor.linkDriver(&driver);
// limiting motor movements
// limit the voltage to be set to the motor
// start very low for high resistance motors
// currnet = resistance*voltage, so try to be well under 1Amp
motor.voltage_limit = 8; // [V]
// open loop control config
motor.controller = MotionControlType::velocity_openloop;
// init motor hardware
motor.init();
//initial motor target
motor.target=10;
// add target command T
command.add('T', doTarget, "target velocity");
command.add('L', doLimit, "voltage limit");
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
motor.move(2);
// user communication
command.run();
}
Thanks for any and all help!