Skip to main content
DLoec.1
Visitor II
March 30, 2023
Question

Bug: Pins with similar labels get same label in code

  • March 30, 2023
  • 2 replies
  • 852 views

I named one pin aLoadcell- and another aLoadcell+ in STM32CubeMx (v6.6.1). They both got the same C #define in the code, as both the '-' and the '+' were replaced by a '_'.

#define aLoadCell__Pin GPIO_PIN_2
#define aLoadCell__GPIO_Port GPIOC
#define aLoadcell__Pin GPIO_PIN_3
#define aLoadcell__GPIO_Port GPIOC

STM32CubeMx should check on uniqueness of all (pin) labels.

This topic has been closed for replies.

2 replies

Bob S
Super User
March 30, 2023

And it should never silently change or ignore the user's input.

And as you saw it silently changes those invalid variable/define name characters to underscores and you end up with duplicate defines.

Interestingly, at least up through CubeMX 6.5.0, if I name two pins with the same names, i.e. both PA8 and PB8 as "SOMEPIN", CubeMX silently renames one of them to include the pin number. For example, for the 2nd pin (PB8), the name becomes "SOMEPINB8". So it appears CubeMX checks for duplicate names, but only before it (silently) changes names due to invalid characters.

Ghofrane GSOURI
Technical Moderator
April 3, 2023

Hello @DLoec.1​ @Bob S​ 

Thank you for your contributions and for your detailed explanations,

I confirm the issue on my side, it has been reported to STM32CubeMX development team .

Internal ticket number:  148880(This is an internal tracking number and is not accessible or usable by customers).

I will keep you posted with updates.

Thx

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.