![]() |
Coming soon |
Target description
For the first part of the tutorial:
This tutorial enables you to use ST Motor Profiler and after applying it you will be able to :
- Connect the motor control pack to your computer.
- Start the motor
- Monitor the speed.
For the second part of the tutorial:
This tutorial enables you to use ST Motor Control SDK and after applying it you will be able to :
- Connect the motor control pack to your computer.
- Start the motor
- Monitor the speed.
Prerequisites
- Computer with Windows 7 (or higher)
- ST-Link utility installed and updated
Hardware
- P-Nucleo-IHM03 pack
- Standard-A to- Mini-B USB cable + power source
Software
- ST Motor Profiler
Literature
- P-NUCLEO-IHM03 Data brief
- UM2374 STM32 Motor control User manual
Getting started with STM32 Motor control SDK5.0.
- Motor control overview =Characterize your first motor by means of ST Motor Profiler=
1. Install ST Motor Profiler
Get the installation file from and unzip it this link. Then just execute the .exe file so that the installation starts.
Once the installation is done the software is installed on your computer.
The ST Motor Profiler is automatically installed with the STM32 Motor Control Software Development Kit on your computer.
Once the installation is done, it will get installed automatically with the MotorControl Workbench while following the installation steps.
2. Connect the package to the computer
In this tutorial we will be working the P-NUCLEO-IHM03 Motor Control package composed by NUCLEO-G431RB as command board and X-NUCLEO-IHM16M1 as power board.
To start our application we should set up the boards and the power source, and finally connect it to the computer.
After setting up the boards and motor properly, let's launch the Motor Profiler application.
- The first step to do is to select the boards we are using by clicking on Select Boards button
- By referring to the user manual, the following parameters regarding the motor characteristics can be defined and set in the appropriate cases:
- Pole Pairs
- Max Speed
- Max Current
- VBus.
- After defining the values, the next step is to click on Connect button and check the motor working correctly.
First, ST Motor Profiler will create the following ST-Link checklist in order to load the added parameters to the software created for the board:
3. Start the test
After finishing the connection between the boards and the computer, it is now the time to start the test.
- Click on Start Profile button.
When clicking, the motor will start rotating in a high speed and the electrical as well as the mechanical models will get established as shown in the following photo, and if there is any fault it will be mentioned on the right of the window.
4. Monitor the speed
After checking that the motor is connected and working properly, the next step is to make it work while controlling its speed.
- Click on Play button and the following window appears.
- By moving the cursor, the speed can be monitored
- Start your own motor application
- Set and properly use the ST Motor Control pack
- Control the acceleration of the motor
5. Start the motor using ST Motor Control Workbench
- Computer with Windows 7 (or higher)
- ST-Link utility installed
Hardware
- P-Nucleo-IHM03 pack
- Standard-A -to- Mini-B USB cable + power source
Software
Literature
- P-Nucleo-IHM03 data brief
- UM2374 STM32 motor control SDK.user manual.
Getting started with STM32 Motor control SDK5.0.
5.1. Install Motor Control Workbench
For the installation of the Motor Control Workbench, please follow the steps mentioned in the previous part of the tutorial.
5.2. Start the first application
Since the pack used is the P-Nucleo-IHM03 it is mandatory to select the appropriate boards used.
First step to do so is to click on New Project and to select the NUCLEO-G431RB as control board & X-NUCLEO-IHM16M1 as power board and later click on ok as enumerated in the next photo:
After finishing selecting the pack's boards, another window appears that allows the user to check the details and set the values of the different caracteristics.
Later, just click on the generate file button presented in the photo below, and save the project in the appropriate directory.
Then a window that allows to choose the IDE to use, and the drive type appears. Just click on Generate and after the software finishes generating the .ioc file, do not change any parameter, just click on Run STM32CubeMX.
The .ioc file is open now and the next step is to simply generate the code in the STM32CubeIDE and do not forget to update the project information in the Project Manager section.
The main code generated is as follows:
int main(void)
{
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_ADC1_Init();
MX_ADC2_Init();
MX_CORDIC_Init(); /*CORDIC Initialization Function*/
MX_DAC1_Init();
MX_I2C1_Init();
MX_TIM1_Init();
MX_USART2_UART_Init();
MX_MotorControl_Init(); /*Initializes and configures the Motor Control Subsystem*/
while (1)
{
}
}
Once the code is generated, the only step to do is to connect the pack and to debug the program.
The program has been installed on the command board and once clicking on the user button, the engine rotates correctly.
5.3. Start the motor and rotate the engine with a delay
In this part, the target work is to start the motor and make it stop with a delay fixed by the user.
The first steps are same as the previous part until the code generation.
Then, add the following code to the while loop in the main file:
while (1)
{
MC_StartMotor1();
HAL_Delay(2000);
MC_StopMotor1();
}
Now you are able to:
- Start your first application using MotorControl Workbench
- Generate the motor control code
- Rotate the engine
- Specify the delay needed between the start and the stop