cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX not generating the correct MX_GPIO_init()

ALoua.1
Associate II

Hello,

I am working with cubeMX and trying to configure a pin to output mode.

The MX_GPIO_init()  is not generated correctly, there is just clock enabling of the bus connected to the GPIO ports without the configuration of the pins.

I am using

CubeMX: 6.8

CubeIDE: 1.12.0

Thank you,

Ahmed

6 REPLIES 6
Peter BENSCH
ST Employee

Welcome, @Ahmed Louati​, to the community!

Then post the IOC file you used here, so that we can take a look at it.

Regards

/Peter

In order 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.
ALoua.1
Associate II

Thank you, Peter!

Here it is attached.

Initially you did not tell us which STM32 (apparently) does not work.

From the IOC I could then see that you are using the dual core STM32H745ZI, where you have to specify for the GPIO in which context, i.e. which core they are to be controlled.

In your specific case:

  • click right on each of the GPIOs
  • select Pin Reservation
  • then change from Free to Cortex-M7 or Cortex-M4

Generate code and be happy.

Hope that helps?

Good luck!

/Peter

In order 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.

Forgot to mention:

You can also change several pins together by:

  • switching to the GPIO overview (e.g. A->Z > GPIO)
  • marking the GPIO to be changed in the table Configuration (center column)
  • then in the table below (different settings lead to a white field) set the setting for all GPIO via the item Pin Context Assignment

In order 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.
ALoua.1
Associate II

Ah! I didn't know about the Pin Reservation config! I am not that familiar with dual-core STM32 MCUs.

Thank you, Mr. Peter, for your fast and detailed reply!

So grateful!

You're welcome!

If the problem is solved, please mark this thread as answered by selecting Select as best, as also explained here. This will help other users find that answer faster.

Regards

/Peter

In order 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.