Stm32f103 spin motor code on custom board

Please take a look in our “examples” directory in the library, either on GitHub or in the Arduino examples menu. For example this one: Arduino-FOC/examples/motion_control/torque_control/hall_sensor/voltage_control/voltage_control.ino at master · simplefoc/Arduino-FOC · GitHub

Adapt this code to your pins.

Use the “genericSTM32F103” board definition in Ardino, or pretend its a “BluePill” board - you need to find a existing board definition using exactly the same MCU and set the right amount of RAM.

Write a simple serial output sketch, and hook up the board serial port to a Serial2USB adapter. Spend time figuring out which compile options in the Arduino Menu combined with which Serial object (Serial, Serial1, Serial2, SerialUSB) give you output on the serial monitor. You will need this to debug your code.

Once you have Serial output working, adapt the example sketch to use the right Serial setup for your board, and then try out SimpleFOC.
Advice: do first tests with the motor power and motor disconnected! Only connect a motor once you have verified that PWM output is working as expected.

One important question is whether the transistor based driver stage is “active high” or “active low” on both high and low sides. Getting this right will be the difference between it working, or turning into a burning lump of melted circuits. If it turns out to be “active low” on either high or low side gates, get back to us here for further instructions before connecting power.

thanks a lot Runger, you are valuable kind of person!!! end of topic from me…thnks