Hey all, it seems Im in need of some more experienced assistance. I’ve got a TMC6300 driver and an EM3215 gimbal motor, both from SparkFun. I’m trying to get the motor spinning in an open loop config with a raspberry pi pico. I’ve installed mbed os and I’m using viscode and platformio to write the code for simplefoc. No matter what I do, the motor seems to jerk from phase to phase. In my current configuration, it does spin, but the motor occasionally starts jumping back and forth between two of the phases. I’ve tried using different pwm pins, changing pwm frequency, swapping power supplies, and increasing and decreasing target velocity.
In this recording, you can see the motor jerking around and only actually rotating when there’s a tiny bit of friction applied.
My wiring is as follows:
| TMC6300 | RPI Pico |
+---------+-----------------+
| VIO | 3v3 Out |
| UL | GP11 (PWM5,CHB) |
| UH | GP10 (PWM5,CHA) |
| VL | GP7 (PWM3,CHB) |
| VH | GP6 (PWM3,CHA) |
| WL | GP3 (PWM1,CHB) |
| WH | GP2 (PWM1,CHA) |
TMC6300 VIN,GND -> 2s 18650 for 7.4v nominal
If I’m understanding everything correctly, this means the motor has 7.4v, which I read on a different post that this is the optimal operating voltage for the EM3215. The TMC6300 is operating at 3.3v logic, and all half-bridge pairs are operating at the same clock speed since I’m using PWM channel pairs. I have tried wiring the half-bridges up to PWM1-CHA, PWM2-CHA, PWM3-CHA, PWM4-CHA, PWM5-CHA, and PWM6-CHA, but had the same result.
I wanna note, that I’m primarily a software guy, and haven’t touched C++ in far too long as I almost exclusively code in Python and MicroPython, but I’ve been learning a lot about the hardware, so please correct me on anything I said that may be wrong.
For the software portion, I followed along with sparkfun’s setup guide. While debugging, I started getting rid of the things I didn’t immediately need, like the commander (and the unnecessary comments).
#include <Arduino.h>
#include <SimpleFOC.h>
// EM3215 pole pairs (according to sparkfun)
BLDCMotor motor = BLDCMotor(7);
// TMC6300 -> RPI Pico
// UH, UL, VH, VL, WH, WL
// GP10, GP11, GP6, GP7, GP2, GP3
BLDCDriver6PWM driver = BLDCDriver6PWM(10,11, 6,7, 2,3);
float target_velocity = 6;
void setup() {
// 2x 18650 in series for 7.4v nominal
driver.voltage_power_supply = 7.4;
driver.voltage_limit = 5;
driver.pwm_frequency = 32000;
driver.init();
motor.linkDriver(&driver);
motor.voltage_limit = 3;
motor.controller = MotionControlType::velocity_openloop;
motor.init();
}
void loop() {
// open loop velocity movement
// using motor.voltage_limit and motor.velocity_limit
motor.move(target_velocity);
}
At this point I think I’ve exhausted all my troubleshooting options and I don’t know where to go from here. If anyone could help me figure out what’s wrong here or at least point me in the right direction, I would be greatly appreciative.
Thanks in advance!