Skip to main content
ALoua.1
Associate
June 13, 2023
Question

CubeMX not generating the correct MX_GPIO_init()

  • June 13, 2023
  • 6 replies
  • 1659 views

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

    This topic has been closed for replies.

    6 replies

    Peter BENSCH
    ST Technical Moderator
    June 13, 2023

    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
    ALoua.1Author
    Associate
    June 13, 2023

    Thank you, Peter!

    Here it is attached.

    Peter BENSCH
    ST Technical Moderator
    June 13, 2023

    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.
    ALoua.1
    ALoua.1Author
    Associate
    June 13, 2023

    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!

    Peter BENSCH
    ST Technical Moderator
    June 13, 2023

    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.