cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX/HAL RCC_MCO3 bug

SPetr.6
Associate II

When generating code for the STM32L051C8Tx and STM32L053C8Tx MCUs using CubeMX I am experiencing a build error when setting channel 1 of TIM21 in input capture mode. The following line is added in main.c within the void SystemClock_Config(void) function because the input capture is assigned to the PB13 pin:

HAL_RCC_MCOConfig(RCC_MCO3, RCC_MCO1SOURCE_SYSCLK, RCC_MCODIV_1);

RCC_MCO3 is not defined and this causes a compilation error. This macro is defined within stm32l0xx_hal_rcc.h, but is not included because the L051 and L053 are not listed.

#if  defined(STM32L031xx) || defined(STM32L041xx) || defined(STM32L073xx) || defined(STM32L083xx) || defined(STM32L072xx) || defined(STM32L082xx) || defined(STM32L071xx) || defined(STM32L081xx)
 
#define RCC_MCO3                         ((uint32_t)0x00000002)
 
#endif

Similar problem here in the same file:

#if  defined(STM32L031xx) || defined(STM32L041xx) || defined(STM32L073xx) || defined(STM32L083xx) || defined(STM32L072xx) || defined(STM32L082xx) || defined(STM32L071xx) || defined(STM32L081xx)
 
#define IS_RCC_MCO(__MCO__) (((__MCO__) == RCC_MCO1) || ((__MCO__) == RCC_MCO2) || ((__MCO__) == RCC_MCO3))
 
#else
 
#define IS_RCC_MCO(__MCO__) (((__MCO__) == RCC_MCO1) || ((__MCO__) == RCC_MCO2))

1 REPLY 1
Imen.D
ST Employee

Hello @SPetr.6​ ,

Thanks for reporting this issue.

I confirm this issue from my side, and raised it internally to the appropriate teams for fix.

Thank for your contribution.

Kind Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen