Skip to main content
Lmoio.1
Senior
May 25, 2021
Solved

How to define GPIOs as simple input/output in STM32CubeMX?

  • May 25, 2021
  • 2 replies
  • 1501 views

Hello,

I'm trying to define some GPIOs as simple input/output for STM32MP157. I'm using the STM32CubeMX tool, but I can't find where to assign the GPIOs to A7 or M4. In the pinout view, I correctly set them as input/output but when I generate the code, I don't find their definition, nor in the device tree .dts, neither in the m4 code (only clock enable is present).

Thanks

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

Hi,

For M4, 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.

For A7, there is no automated generation of device tree in CubeMx, you should add it manually.

For A7/Linux, see:

https://wiki.st.com/stm32mpu/wiki/Overview_of_GPIO_pins

https://wiki.st.com/stm32mpu/wiki/GPIO_device_tree_configuration

https://wiki.st.com/stm32mpu/wiki/How_to_control_a_GPIO_in_userspace

Regards.

2 replies

PatrickF
PatrickFBest answer
Technical Moderator
May 25, 2021

Hi,

For M4, 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.

For A7, there is no automated generation of device tree in CubeMx, you should add it manually.

For A7/Linux, see:

https://wiki.st.com/stm32mpu/wiki/Overview_of_GPIO_pins

https://wiki.st.com/stm32mpu/wiki/GPIO_device_tree_configuration

https://wiki.st.com/stm32mpu/wiki/How_to_control_a_GPIO_in_userspace

Regards.

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.NEW ! Sidekick STM32 AI agent, see here
Lmoio.1
Lmoio.1Author
Senior
May 25, 2021

@PatrickF​ Thank you very much!

PatrickF
Technical Moderator
May 25, 2021

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.NEW ! Sidekick STM32 AI agent, see here