cancel
Showing results for 
Search instead for 
Did you mean: 

FOC duration and Software error. The motor doesn't start rotation

msingh
Senior

Hi,

NUCLEO-F303RE

X-NUCLEO-IHM07M1

Maxon motor 496653 with 5.8:1 gear ratio

Motor Profiler 5.4.4

MotorControl Workbench 5.4.4

STM32CubeMX 5.5

STM32CubeIDE 1.4.0

I have created a motor profile using the motor profiler and confirmed the hardware is working correctly. I have then attempted to create a position control project using the AN5464 as a guide. I have got to a stage where the motor doesn't rotate at all. I have tried to debug the code and I have realised that it gets stuck at the "while(MC_GetAlignmentStatusMotor1()!=TC_ALIGNMENT_COMPLETED){}" line of code. I have attached a PDF showing the value returned by the function.

I have then tried to connect to the board via the monitor in the motor control workbench and it shows FOC duration and Software error as soon as the MC_StartMotor1() function is called. Does anyone know what's going on?

Thanks in advance

Kind Regards

Manpreet Singh

1 ACCEPTED SOLUTION

Accepted Solutions
AntoineC
ST Employee

Hello @msingh​,

The new PWM duty cycle is calculated and has to be computed before the next PWM cycle starts. If the duty cycle is set too late to be taking into account in the next PWM cycle, a FOC Duration error occured.

Timings in the motor control algorithm are critical, please be sure to build and run your project with STM32Cube IDE in release mode with optimization O-Fast.

Fix your PWM Frequency and increase your delay between each FOC loop, you can increase 1 by 1 the Execution Rate parameter until the FOC duration disappear.

FOC loop is executed at PWM Frequency / execution rate

0693W000005D3O3QAK.png 

Best Regards,

Antoine

View solution in original post

3 REPLIES 3
msingh
Senior

I forgot to mention that I have created a project using the IHM08M1 and F303RE and the project works fine. I am now trying the same with the above hardware set up (used the same PID settings).

msingh
Senior

I have an update on this, Reducing the PWM frequency has helped to remove the FOC duration and Software error. However, the motor is still not able to rotate, I can see the current increasing as the motor is supposed to rotate but the rotor never moves.

AntoineC
ST Employee

Hello @msingh​,

The new PWM duty cycle is calculated and has to be computed before the next PWM cycle starts. If the duty cycle is set too late to be taking into account in the next PWM cycle, a FOC Duration error occured.

Timings in the motor control algorithm are critical, please be sure to build and run your project with STM32Cube IDE in release mode with optimization O-Fast.

Fix your PWM Frequency and increase your delay between each FOC loop, you can increase 1 by 1 the Execution Rate parameter until the FOC duration disappear.

FOC loop is executed at PWM Frequency / execution rate

0693W000005D3O3QAK.png 

Best Regards,

Antoine