Skip to main content
Associate II
August 10, 2026
Solved

STM32CubeMX2 peripheral init

  • August 10, 2026
  • 4 replies
  • 89 views

Despite the peripherals are callable, the code preview from STM32CubeMX2 does not call the init functions of the peripherals.
What is the trick to get this done ?

We also see in the HAL common settings, the option to toggle generated vs callable is not selectable.

Is this something to do with the older version of STM32CubeMX2 v1.1.1 and STM32CubeMX2 v1.0.0 ?

Please suggest 

Best answer by Sara BEN HADJ YAHYA

Hi ​@Srikar,

Thank you for your question.

In STM32CubeMX2, the peripheral init function calls are generated in mx_system.c.
So if you open HAL System Init, you can check the code preview of mx_system.c to see these initialization calls.

The Generated / Callable option cannot be toggled directly from the HAL System Init view. It is managed from the peripheral configuration instead.

For example, in the I2C1 configuration, under General information, you can change the Resource initialization code generation setting. After that, the change will be reflected in mx_system.c.

Regards,

Sara.

4 replies

Andrew Neil
Super User
August 10, 2026

In MX1, there was an option to generate the init functions, but not call them ...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Associate II
August 12, 2026

so which version is more easy to use?1.1.1or 1.0.0

 

SrikarAuthor
Associate II
August 12, 2026

V1.1.1

Sara BEN HADJ YAHYA
ST Technical Moderator
August 20, 2026

Hi ​@Srikar,

Thank you for your question.

In STM32CubeMX2, the peripheral init function calls are generated in mx_system.c.
So if you open HAL System Init, you can check the code preview of mx_system.c to see these initialization calls.

The Generated / Callable option cannot be toggled directly from the HAL System Init view. It is managed from the peripheral configuration instead.

For example, in the I2C1 configuration, under General information, you can change the Resource initialization code generation setting. After that, the change will be reflected in mx_system.c.

Regards,

Sara.

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.