cancel
Showing results for 
Search instead for 
Did you mean: 

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

Lmoio.1
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions
PatrickF
ST Employee

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.

View solution in original post

3 REPLIES 3
PatrickF
ST Employee

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.
Lmoio.1
Senior

@PatrickF​ Thank you very much!

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.