LPTIM1 label causes SysTick/clock configuration to be removed
I am experiencing two separate issues with the generated LPTIM1 configuration in STM32CubeMX2.
1. Clock configuration is removed when assigning a label to LPTIM1
The first issue occurs when assigning a user label to LPTIM1.
As soon as a label is assigned to LPTIM1 and the code is regenerated, the RCC initialization and peripheral clock configuration are removed from mx_system_init().
The deleted code looks like this:
system_status_t mx_system_init(void)
{
.........
LL_ICACHE_Enable(ICACHE);
- /*
- Clock system section
- */
-
- /* Initialize RCC peripheral */
- if (mx_rcc_init() != SYSTEM_OK)
- {
- return SYSTEM_CLOCK_ERROR;
- }
-
- /* peripherals clock configuration and activation
- is centralized: no clock activation/deactivation in pppi_init */
-
- if (mx_rcc_peripherals_clock_config() != SYSTEM_OK)
- {
- return SYSTEM_CLOCK_ERROR;
- }
.........
Therefore, the calls to
mx_rcc_init();
mx_rcc_peripherals_clock_config();
are no longer present after assigning the LPTIM1 label.
As a consequence, the system clock is no longer initialized correctly and the application gets stuck later during ADC calibration.
Removing the user label from LPTIM1 and regenerating the code restores the clock configuration.
2. Unrelated I2C2 interrupt definitions are generated for LPTIM1
The second issue is independent of whether a user label is assigned to LPTIM1.
Inside the generated mx_lptim1.h, I2C2 interrupt definitions are generated for LPTIM1, for example:
#define BUZZER_TIMER_IRQn I2C2_ERR_IRQn
#define BUZZER_TIMER_IRQHandler I2C2_ERR_IRQHandler
#define _IRQn BUZZER_TIMER_IRQn
#define _IRQHandler BUZZER_TIMER_IRQHandler
The same issue is present even when no user label is assigned.
I2C2 is not related to LPTIM1 in this configuration, so I would not expect I2C2_ERR_IRQn or I2C2_ERR_IRQHandler to appear in the generated LPTIM1 header at all.
Has anyone seen similar behavior with STM32CubeMX2, or could this be a code generation issue?
