Skip to main content
SPetr.6
Associate II
Jul 23, 2019 6:20 PM UTC
Question

CubeMX/HAL RCC_MCO3 bug

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))

This topic has been closed for replies.

1 reply

ST Technical Moderator
Jul 31, 2019 2:11 PM UTC

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

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks