Error in self designed driver board with l6234 chip

So I recently designed my own l6234d driver board with an esp32 RS485 capabilties and an encoder. However I can’t seem to get the gimbal motor moving continuous.
I am using the GM8112 Ipower motor.

Here is an Image from the driver board:


Here ist the code I am testing the setup with:

#include <SimpleFOC.h>

BLDCMotor motor = BLDCMotor(21, 4.2); 
BLDCDriver3PWM driver = BLDCDriver3PWM(16, 17, 18, 14);

void setup() {

  driver.voltage_power_supply = 24;


  motor.voltage_limit = 5;
  motor.current_limit = 1;
  // open loop control config
  motor.controller = MotionControlType::velocity_openloop;


  Serial.println("Motor ready!");
  Serial.println("Set target velocity [rad/s]");

void loop() {
  // open loop velocity movement
  // using motor.current_limit and motor.velocity_limit


Here is also a videofrom the movement from the motor:

It is very confusing because he turns for a short period of time and then suddently stops.

Any input is welcomed…

What are the jerks in movement?

I think something I notice here is that you are not using commander (which is not strictly necessary) but you are also not giving the motor any target. So I think this jerking is when the motor is enabled via motor.move, but there is no velocity target so it will stay at 0. It is just locking into the closest magnetic pole basically.

You can add something like = 2; in the setup (before main loop) or you can create a commander, and add a command that will allow you to send a target velocity via serial (you already have the serial port open, you may as well use it for this).

Here is example for creating commander interface and adding commands to it (the documentation was not very clear for me on first read through either)

before setup function, create these structure:

// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&, cmd); }

in the setup function, add this:

  // add target command T
  command.add('T', doTarget, "target velocity");

in the loop function add this:;

Then once you are uploaded the program and can enter the serial port, you can type a command like T6 to set to value of 6 (units rad/s).

If there is a problem with your board, it is more likely a problem with schematic rather than layout since the layout is pretty strongly guided. Can you post a link to schematic?