cancel
Showing results for 
Search instead for 
Did you mean: 

STSPIN32G4 Error in generated code

AsimAsrar
Associate II

Hello,

I am using the STSPIN32G4 IOC file from MC Workbench for a motor control example. However, I encounter the following errors during the build process. Since these files are auto-generated, I can't directly fix them by declaring the missing elements

Error: C:/MCB Example/MtrCtrlMdlGen/temp/stm32g431rb_ihm16m1/Drivers/STM32G4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h:1007:47: error: 'OPAMP_POWERMODE_NORMALSPEED' undeclared (first use in this function); did you mean 'LL_OPAMP_POWERMODE_NORMALSPEED'? 1007 | #define OPAMP_POWERMODE_NORMAL OPAMP_POWERMODE_NORMALSPEED | ^~~~~~~~~~~~~~~~~~~~~~~~~~~

AsimAsrar_0-1719918843854.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @AsimAsrar 

Thanks for your inputs.

The issue you reported is known and already described in the release notes.

In the section known limitations you can find the following statement:

  • When generating a configuration based on an STM32G4xx series MCU and using internal OPAMPs with STM32CubeMx version 6.10.0, make sure to select HAL and not LL for the Drive Type in the Workbench.

I did a quick test with STM32CubeMX 6.11 and it seems that now it is fixed.

Regards

Cedric

View solution in original post

8 REPLIES 8
cedric H
ST Employee

Hello @AsimAsrar,

Your issue probably comes from a misalignment between the HAL version and your cubeMX version.

Could you please give the version of the tools you are using : MCSDK, CUBEMX, Cube package (HAL)

Thanks

Cedric

Hello Cedric, Below are the details.

CUBEMX Version: 6.10.0

Motor Control WorkBench: 6.3.0

AsimAsrar_1-1719935288851.png

 

While generating the IOC file I am selecting LL and not HAL.

AsimAsrar_0-1719935120800.png

 

AsimAsrar
Associate II

Attaching my IOC file as well for reference: 

Hello @AsimAsrar 

Thanks for your inputs.

The issue you reported is known and already described in the release notes.

In the section known limitations you can find the following statement:

  • When generating a configuration based on an STM32G4xx series MCU and using internal OPAMPs with STM32CubeMx version 6.10.0, make sure to select HAL and not LL for the Drive Type in the Workbench.

I did a quick test with STM32CubeMX 6.11 and it seems that now it is fixed.

Regards

Cedric

Hello,

Thank you for your suggestion. Setting the OPAMP to HAL did resolve the opamp error. However, I am still encountering an error related to 'TIM'. When I configure it as HAL, I receive the following error:

AsimAsrar_0-1720013176622.png

AsimAsrar_2-1720013729671.png

Note: I had to change few peripherals to LL as I was getting the above error for them as well.

Alternatively, when I set it to LL, I get this error:

AsimAsrar_1-1720013199652.png

Could you please advise on how to resolve this issue?

Thank you.

 

Hi,

Your attached IOC is not the one generated by the motor control workbench, so no chance that the project built from it can contain the Motor control FW lib (which contain the declaration of the missing constants, plus obviously all the motor control FW algorithm).

Regards

Cedric

AsimAsrar
Associate II

Hello,

It's the same IOC file, but I made a few modifications for my example. I disabled the motor control, adjusted some parameters of ADC2, and added LPUART.

Thank you.

AsimAsrar
Associate II

I had to change few parameters of TIM, and it's working now. Thank You.