This post was last edited by yang_alex on 2018-7-2 12:09 In the previous article, I talked about the graphical setting of motor control parameters. If you have set the parameters according to your own preferences and verified the MCU pin assignment, then it is time to generate the code. Before automatically generating the code, there are several software that must be installed: First is your software development environment (IDE), which was mentioned in the first article. I use IAR EWARM here. The second is STM32CubeMX, which is a must for playing with ST's MCU. Next is ST's HAL library and LL library. This evaluation uses Nucleo-F302R8, so remember to install F3. The official website directly downloads stm32cube_fw_f3_v190, which needs to be patched and upgraded to stm32cube_fw_f3_v191. (Strange, wouldn't it be better if I just downloaded v191?) Of course, it also includes the X-CUBE-MCSDK we mentioned earlier. In addition to installing the Motor Workbench and MotorProfile tools mentioned in the previous two posts, this software will also install some motor control libraries. Note that there should be no Chinese characters in the software installation directory! ! ! After all these are installed, you can automatically generate code. Automatic code generation is performed in Motor Workbench. Continuing from the previous article, after setting the parameters and verifying the MCU pin assignment in Motor Workbench, click the blue downward arrow button in the interface to start the code generation process.
After clicking the button, a dialog box will pop up, asking you to select the version of STM32CubeMX (at least 4.25.0, the latest is 4.26.0), select the software development environment (IDE) you use, and choose whether to use the HAL library or the LL library.
Next, click "Generate" to start automatic code generation. Relevant information will be given after completion.
Finally, enter the relevant directory and open the project file with the software development environment (IDE).
OK, you can compile, download and debug!
At this point, the software code is automatically generated. The next step is to add your own code and debug.
This content is originally created by EEWORLD forum user yang_alex. If you want to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source