Skip to main content
Associate
July 9, 2023
Solved

motor control (especially FOC)

  • July 9, 2023
  • 1 reply
  • 2062 views

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?

    This topic has been closed for replies.
    Best answer by SRedd.5

    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.

    1 reply

    ST Employee
    July 10, 2023

    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.

    Nishino08Author
    Associate
    July 11, 2023

    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.

    SRedd.5
    SRedd.5Best answer
    Senior III
    July 24, 2023

    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.