cancel
Showing results for 
Search instead for 
Did you mean: 

Relation between *.stmx file and drive_parameters.h ?

BTrem.1
Senior II

Often I find that MCSDK does not have the exact MCU I need to use so I need to end up modifying the CubeMx *.ico file generated from MCSDK.

In trying to determine the relationship of these files I took an existing working project and renamed the *.stmx file to *.stmx_____. I then loaded the *.ico file with CubeMx with no complaints. Next I deleted the drive_parameters.h file then had CubeMx generate new code. The result was a new drive_parameters.h file was generated.

Where does the information for this new drive_parameters.h file come from? There was no old drive_parmeters.h file and the *.stmx file was not present.

I ask this because sometimes when rebuilding my project I find all my drive_parameters.h values have changed and I need to copy the file over from an archived project.

Thanks for any insight you can give on this. A secret decoder ring would be appreciated from ST 😉

Brian

1 ACCEPTED SOLUTION

Accepted Solutions
Dario CUCCHI
ST Employee

Hello Brian,

Once the CubeMX file .ioc is generated, it has in the middleware section a part called MotorControl, which contains all the information about the FOC algorithm, among which the "previous" drive_parameters.h file.

Modifying the CubeMX file can lead to some error, so I suggest to always generate the project starting from the Workbench (.stmcx file) .

Further modifications can be added directly to the code in the dedicated parts indicated between comments:

/* USER CODE BEGIN ... */

/* USER CODE END... */

Code inside these comments is kept when the project is generated again and not overwritten by the new code generation.

I hope this can help you in your project.

View solution in original post

2 REPLIES 2
Dario CUCCHI
ST Employee

Hello Brian,

Once the CubeMX file .ioc is generated, it has in the middleware section a part called MotorControl, which contains all the information about the FOC algorithm, among which the "previous" drive_parameters.h file.

Modifying the CubeMX file can lead to some error, so I suggest to always generate the project starting from the Workbench (.stmcx file) .

Further modifications can be added directly to the code in the dedicated parts indicated between comments:

/* USER CODE BEGIN ... */

/* USER CODE END... */

Code inside these comments is kept when the project is generated again and not overwritten by the new code generation.

I hope this can help you in your project.

Laurent Ca...
Lead II

The question has been moved from the "Motor Control Hardware" section to the "STM32 Motor Control" section (the question is about the STM32 SDK). 

Best regards

Laurent Ca...