Skip to main content
Roberto Giovinetti
Associate III
July 1, 2019
Question

Motor control Workbench/STMCubeMX code generation don't create a buildable software

  • July 1, 2019
  • 12 replies
  • 3374 views

Hello everyone

I'm trying to use Motor Control tools to generate a project, but I can't get any result: every project I get from code generation is not buildable and I get a lot of errors.

I'm using Motor Control Workbench 5.4.0 and I'm using STEVAL-SPIN3202. I choose parameters, and I start to generate the software. In project generation I choose STM32CubeMX 5.2.1. In the Target Toolchain I choose ST True Studio (but I've tried STSW4STM32 and STM32CubeIDE also). In the firmware package option I choose the one the program suggest me.

Then I generate the code and this step works fine. A the end of this step I open STM32CubeMX and I generate the code. Everytihing works well until here. Problems begin when I open the project and I try to build it: there's no way! A lot of errors appears and I can't get a working debuggable project to test motors and hardware.

It's very frustrating. I can't understand where the problem is. As I told before, I used ST True studio, AC6 SW4STM32 and I downloaded and used STM32CubeIDE, but no one of this work.

Where am I wrong?

Thank you

Roberto

This topic has been closed for replies.

12 replies

cedric H
ST Technical Moderator
July 9, 2019

Hello Roberto,

Could you please provide the log file that is generated in the project folder (project_name,log) , and the stmcx you used if it is not confidential.

Regards

Cedric

Roberto Giovinetti
Associate III
July 9, 2019

Hello Cedric

Second one, stcmx file.

Roberto

Roberto Giovinetti
Associate III
July 9, 2019

Hello Cedric

I have to reply twice because the name of the file, for the system, is the same. First one log file.

cedric H
ST Technical Moderator
July 9, 2019

Hello Roberto,

I just tried your stmcx file and I compiled your project successfully.

I have a doubt regarding the project generation, and I wonder if everything is OK.

Could you confirm me that the mc_task.c of your generated project is the same than the one I just generated with your stmcx and attached to this post.

Thanks

Cedric

Roberto Giovinetti
Associate III
July 10, 2019

Dear Cedric

My mc_tasks is completely different! Is just empty... I don't know why.

I attach my generated one. I found it in the {project}\src folder.

Roberto

cedric H
ST Technical Moderator
July 10, 2019

Hello Roberto,

Your problem comes probably from the fact that cubeMX does not find the template source of the Motorcontrol libraries.

Could you try to :

  • start CubeMX,
  • In the Help menu, click on Updater Settings.

From this be sure that the CubeMx repository folder path is correct, with a "\" at the end of the line.

For instance, mine is :

C:\Users\cedricH\STM32Cube\Repository\

Once it is done, you can open your generated ioc file and click on generate from CubeMX.

Let me know if it does the job.

Regards

Cedric

cedric H
ST Technical Moderator
July 17, 2019

Hello Roberto,

STEVAL-SPIN3202 uses one shunt for current sensing and is based on STM32F0.

The FOC duration error is due to a two fast PWM frequency. You should stay under 12Khz PWM frequency to avoid FOC duration. If it does not fit with your motor requirement, you can increase the frequency but change the execution rate from each period to 2 PWM periods.

Regarding the Overcurrent, It could be that your start-up parameters configuration ask to much current. Try to decrease the Final current number.

Regards

Cedric

Roberto Giovinetti
Associate III
July 19, 2019

Hello Cedric

I've been trying to set parameters as you told me, but I've obtained nothing. The motor doesn't spin at all. I can only hear a little "tic" when I press "Start Motor" in the monitor window of Workbench. No error or fault led is on. Only Idle state is on, even though I started the motor. I've tried different values for the startup procedure, changing times, currents, speeds. The result doesn't change at all.

I've checked STEVAL-SPIN3202 jumpers and they are as indicated in datasheet.

I've changed PWM frequency down to 5KHz. I've tried to redo the entire project. Nothing to do...

I've entered correct motor values, from datasheet characteristics.

It seems to me that motor try to align, but after that there's no action. I can't see errors: no overcurrent, no FOC duration, no startup failure!

Another thing: if I use Debugger and I connect the monitor, when I launch "start motor" command an hard fault interrupt is triggered. I think that I can't use Debugger and monitor concurrently.

I don't really know how to solve the question....

Roberto

PKulk.2
Visitor II
December 31, 2020

I was facing the same issue for many days & I also tried to switch from versions of STMCubeMx & diferent IDEs.

But it is very silly issue & solution to it also very easy.

You just have to install the Java Run Time Environment (JRE) 8 or below JRE 10 & boom!!! it will work properly with any IDE.

Uninstall the JRE latest versions if you have any(e.g. JRE 14 or JRE 15) & keep only one JRE10 or below v10.

I'm using JRE8. STMCubeMx doesn't support JRE above 10.

You don't have to change anything else. (Project directory, names etc)