This post was last edited by my student number on 2018-6-19 23:46 The environment construction mainly refers to the ST document UM2374, "Getting started with STM32 motor control SDK v5.0". Here is the attachment:
Getting started with STM32 motor control SDK v5.0.pdf
(2.12 MB, downloads: 37)
According to the description in the document, the following four software are required:
Each tool can be downloaded from the corresponding official website. Double-click to open it during installation. There is basically no problem with pressing next all the way. The functions of each software are roughly as follows: Workbench: debug to obtain motor parameters and generate a prototype of the project; CubeMx: configure chip clock and peripherals and generate project files; ST-LINK: connect the host computer to debug the chip; ST-LINK: download the compiled binary file SupportIDE: debug the compiled project and burn the program For the win10 system, the first use of the Motor Profiler in the Workbench may encounter the problem of "
The application on your computer needs to use the following Windows features: .NET Framework 3.5 (including .NET 2.0 and 3.0)". The solution can be found by searching: https://jingyan.baidu.com/article/d621e8da58a3772865913f01.html[font=Microsoft Yahei,
Let's get to the point. First, connect the motor and power supply as described in the previous section, connect the USB cable, and then open the Motor Profiler software. Click "select" to select the development board kit
宋体, sans-serif] Select the first set you click on, F302+IHM07M1
Fill in the parameters in the box on the right
If the speed is too low, you may encounter the problem of parameter recognition failure;
Click Connect in the lower left corner, it will turn green if the connection is successful
Before clicking Start Profile, it is recommended to hold the four feet of the matching motor with your hands, or use tools to fix the motor on the table. After successful configuration, relevant parameters will appear in the schematic diagram below. Click Save to name the file and save it
Then open MotorControl Workbench to set up the project. You can view the Help information on how to use the software and what each interface represents
Select New Project, and directly select MC Kit on the opened interface
Click OK to enter the configuration interface
The specific use and settings of each module can also refer to the HELP document. Don’t modify too much for the first time. Here, just fill in the motor parameters obtained earlier
After setting, select the save path and name the project. If no further configuration of CubeMax is required, you can directly select OutputFolderOption in the menu bar to set the IDE. Here I use MDK
Click Generation to generate the project
Double-click the file with the suffix uvprojx in the generated project directory to open the project. After compilation, there is 0 error, 0 warning
OK, let's try it out. Find the main.c file in MDK, double-click to open it, and then add the following code to the function static void MX_GPIO_Init(void) that initializes GPIO: GPIO_InitStruct.Pin = GPIO_PIN_5; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); [/code] Go back to the previous while(1) loop and add the following code between /* USER CODE BEGIN 3 */ and /* USER CODE END 3 */- HAL_GPIO_WritePin(GPIOA,GPIO_PIN_5,GPIO_PIN_SET); HAL_Delay(1000); HAL_GPIO_WritePin(GPIOA,GPIO_PIN_5,GPIO_PIN_RESET); HAL_Delay(1000);
复制代码 After compiling correctly, download the program to FLASH, connect the power supply, press the reset button on the NUCLEO board, and then you can see the green LED light flashing at intervals of 1s. Here is a copy of the F3 HAL library manual:
Description of STM32F3 HAL and low-layer drivers.7z
(9.78 MB, downloads: 18)
This content was originally created by EEWORLD forum user mystudentid. If you want to reprint or use it for commercial purposes, you must obtain the author's consent and indicate the source