Skip to main content
msche.1
Associate III
January 27, 2022
Solved

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

  • January 27, 2022
  • 6 replies
  • 1729 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'

6 replies

PatrickF
PatrickFBest answer
ST Employee
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'

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.Tip of the day: Try Sidekick STM32 AI agent
msche.1
msche.1Author
Associate III
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.1
msche.1Author
Associate III
January 28, 2022