cancel
Showing results for 
Search instead for 
Did you mean: 

motor control (especially FOC)

Nishino08
Associate II

Hi ,

Is there any sample code for motor control (especially FOC) in Cube IDE, Cube MX, motor control workbench, ST website, etc.?

I tried to search all the Cube IDE, ST website, etc., but I couldn't find it.

Also, is there any additional software I need to use them?

1 ACCEPTED SOLUTION

Accepted Solutions

Is it possible to get the FOC sample code in any way other than generating it in the workbench? (For example, is there a library on the Cube IDE, Workbench, or ST site that can reference other FOC code?) 

No i don't think so. The generated code is in .c files, if you want to edit the existing FOC code you can do it.

・After "Generate Program" in the workbench, an error occurs when importing to the Cube IDE and debugging. Is there something missing or wrong with the procedure?

You have to build the project and see if there are no compilation errors, if no errors then your code generation is proper.

View solution in original post

3 REPLIES 3
Zied b.
ST Employee

Hello, if you want to have code for motor control in FOC, you can download the MCSDK which is located at this link: Click here

After downloading and installing the MCSDK, simply launch the MC Workbench, select your Power Board and Control Board combination, choose FOC as the algorithm, and generate your project. If you have any other questions, please feel free to reply to me, otherwise please mark my answer as "Solution".
Thank you.

If you agree with my answer, please accept it by clicking on "Accept as solution".

Thank you for your answer. 

Currently, the generation of the FOC algorithm by the workbench is complete. 

So I have two more questions.

 Is it possible to get the FOC sample code in any way other than generating it in the workbench? (For example, is there a library on the Cube IDE, Workbench, or ST site that can reference other FOC code?)

 After "Generate Program" in the workbench, an error occurs when importing to the Cube IDE and debugging. Is there something missing or wrong with the procedure?

 Please answer.

Is it possible to get the FOC sample code in any way other than generating it in the workbench? (For example, is there a library on the Cube IDE, Workbench, or ST site that can reference other FOC code?) 

No i don't think so. The generated code is in .c files, if you want to edit the existing FOC code you can do it.

・After "Generate Program" in the workbench, an error occurs when importing to the Cube IDE and debugging. Is there something missing or wrong with the procedure?

You have to build the project and see if there are no compilation errors, if no errors then your code generation is proper.