Skip to main content
Associate II
Jul 2, 2024 11:16 AM UTC
Solved

STSPIN32G4 Error in generated code

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

 

This topic has been closed for replies.
cedric H
cedric HBest answer
ST Technical Moderator
Jul 3, 2024 9:38 AM UTC

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

8 replies

cedric H
ST Technical Moderator
Jul 2, 2024 1:44 PM UTC

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

AsimAsrarAuthor
Associate II
Jul 2, 2024 3:49 PM UTC

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

 

AsimAsrarAuthor
Associate II
Jul 3, 2024 4:51 AM UTC

Attaching my IOC file as well for reference: 

cedric H
cedric HBest answer
ST Technical Moderator
Jul 3, 2024 9:38 AM UTC

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

AsimAsrarAuthor
Associate II
Jul 3, 2024 1:37 PM UTC

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.

 

AsimAsrarAuthor
Associate II
Jul 3, 2024 5:54 PM UTC

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.

AsimAsrarAuthor
Associate II
Jul 4, 2024 10:05 AM UTC

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