How to turn on a motor - Example with MCSDK & Cube IDE: “FOC duration” fault or/and "Software error"
1. Pre-work
I have followed all the steps presented in the
Motor control Getting started:
- Generation from MC Workbench and compilation in STM32CubeIDE done OK without any warnings and errors.
- I have successfully uploaded the code to MCU and I have connected to monitor part of MC Workbench by COM port communication, but the "FOC duration" fault or/and "Software error" was indicated if I press "Start Motor" button.
I use MCSDK v5.x, STM32CubeMX v6.x and STM32CubeIDE v1.x. What is wrong with my MC Kit IHM03?
2. Motor Control requirements
There is one unknown point for non familiar user. The MC (Motor Control) application driven by FOC algorithm is based on a bit complex calculations of transformations and another mathematics which request precise timing and fast computations.
It is mandatory to use the optimization level for speed in used IDE.The generated project for STM32CubeIDE contains two Build Configurations: Debug and Release.
The real code debugging with break points and/or stepping in over code rows is not possible in the MC application because we cannot loose the continuity in generated stator field. The Debug is a default configuration. The
optimization in this configuration is switched off.
3. Switch on Optimization level for speed
We have to
switch on the optimization level for speed or we have to
use "Release" build configuration with well switched on optimization.
3.1 Option 1: Switch on the optimization for speed
3.2 Option 2: set Build configuration "Release" as active
3.3 Option 3 : Directly Build the "Release" Build configuration