cancel
Showing results for 
Search instead for 
Did you mean: 

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

msche.1
Associate III

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?

1 ACCEPTED SOLUTION

Accepted Solutions
PatrickF
ST Employee

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 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

6 REPLIES 6
PatrickF
ST Employee

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 'Accept as Solution' on the reply which solved your issue or answered your question.

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?

Yes, indeed, on the STM32MP157x-DKx, the D2 on Nucleo connector is mapped on PE1

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.

How do I do this for pins I've assigned to an ADC? There is no option to assign it to the M4.

Never mind, I see that it's in not in the right click menu, but in the configurations.