Skip to main content
Visitor II
January 27, 2022
Solved

How do I get the "Generate Code" to create HAL GPIO pins?

  • January 27, 2022
  • 1 reply
  • 1689 views

I've just finished the tutorials on MP1 and have built a few Nucleo projects. When I want to use a GPIO pin on the Nucleo board I go o the ioc file, name a pin and hit Project > Generate Code, and I'll see the pins at the bottom of my Core > main.c file, but when I do that in a new project for the MP1, I don't see anything added to the project.

Further, if I search the entire directory for the name of the pin "HEATER" in my case, I don't see it anywhere else but the ioc file.

```

$ grep -rnw . -e 'HEATER'

./test.ioc:647:PA10.GPIO_Label=HEATER

```

What am I doing wrong?

    This topic has been closed for replies.
    Best answer by PatrickF

    Hi,

    after selecting GPIO input or output, you also have to right click on the pin and assign 'pin reservation' to 'Cortex-M4'.

    M4 code will then be generated correctly.

    Regards,

    In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

    1 reply

    PatrickFAnswer
    Technical Moderator
    January 27, 2022

    Hi,

    after selecting GPIO input or output, you also have to right click on the pin and assign 'pin reservation' to 'Cortex-M4'.

    M4 code will then be generated correctly.

    Regards,

    In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

    msche.1Author
    Visitor II
    January 27, 2022

    Thanks! That did come up as a GPIO pin, but I'm still not able to control it. I was under the impression that the HAL made it the case that if I used the same "Pin Name" it would map to the same Arduino pin. For instance, I'm using PA10 which is mapped to D2 on the Neucleo, but that pin doesn't seem to go high on the STM32, am I missing something here? Is there a different pin mapping for SMT32MP1 with HAL?

    msche.1Author
    Visitor II
    January 28, 2022