Skip to main content
Associate II
February 27, 2025
Question

Error when compiling an MC WB / cubeMX generated app

  • February 27, 2025
  • 1 reply
  • 509 views

When compiling a test app for the B-G431B-ESC1 board, I generated code using the MC Workbench and cube MX for a 6-step control of a BLDC.

If while in the Workbench, I choose to enable the "Electronic Speed Control" option, I get the error below when compiling inside the ST IDE:

 

C:/Users/pjreb/.st_workbench/projects/test_4_6s/MCSDK_v6.3.2-Full/MotorControl/MCSDK/MCLib/Any/Src/esc.c:293: multiple definition of `TIM2_IRQHandler'; ./Application/User/stm32g4xx_mc_it.o:C:/Users/pjreb/.st_workbench/projects/test_4_6s/Src/stm32g4xx_mc_it.c:103: first defined here

 

How can I fix this?

 

Thanks

1 reply

GMA
Technical Moderator
February 27, 2025

Hello @pjrebordao,

Thank you for your problem report.
Selecting another timer than TIM2 (used by ESC) on Workbench Speed Sensing Config should work

GMA_0-1740651589202.png

 

If you agree with the answer, please accept it by clicking on 'Accept as solution'.Best regards.GMA
Associate II
February 27, 2025

I changed to TIM3 and it compiled without errors.

However, now I can't get the motor to run. It wiggles back and forth and mostly doesn't respond to commands.

I also noticed this:

pjrebordao_0-1740659292139.png

 

Shouldn't be updated to TIM3 ?

 

 

Fabrice LOUBEYRE
ST Employee
February 27, 2025
Hello @pjrebordao,
First if not already read, i advise you to have a look to the following document:
By reading the chapter 6, you will be able to control the speed of the motor thanks to PWM input signal.
For information, when no PWM signal is present on the input, a periodic tone can be heard. As soon as the input signal is enabled, the tones stop.
However, if you have the motor pilot tool connected you can also make the motor spin thanks to its interface.
If you have a specific motor, i assume that you have created a .json file (with its specific characteristics) to set as input with the inverter board B-G431B-ESC1 of your project creation with MCSDK WB 6.3.2.
This will help to control the motor especially for revup and speed regulation.
 
Hope this will help you.
Best regards.
Fabrice