How do you control the GPIO pins on an STM32MP1?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-24 6:48 PM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-10 3:15 AM
Hello @msche.1​ ,
As explained on the wiki you can displays information and controls the gpiochip line with "gpiodetect", "gpioinfo", "gpioget", etc: https://wiki.st.com/stm32mpu/wiki/How_to_control_a_GPIO_in_userspace
The mapping of the GPIO is available in the datasheet, from page 93:
https://www.st.com/resource/en/datasheet/stm32mp157c.pdf
If you want the information of pin PA8 for example, you can first do a:
root@stm32mp1:~# gpiodetect
gpiochip0 [GPIOA] (16 lines)
gpiochip1 [GPIOB] (16 lines)
gpiochip2 [GPIOC] (16 lines)
gpiochip3 [GPIOD] (16 lines)
gpiochip4 [GPIOE] (16 lines)
gpiochip5 [GPIOF] (16 lines)
gpiochip6 [GPIOG] (16 lines)
gpiochip7 [GPIOH] (16 lines)
gpiochip8 [GPIOI] (16 lines)
gpiochip9 [GPIOZ] (16 lines)
You see that GPIOA is gpiochip0:
Then you can use:
root@stm32mp1:~# gpioget gpiochip0 8
0
Same thing with gpioset.
Regards,
Kevin
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'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-25 12:39 AM
Hi @msche.1​ ,
There's already several posts addressing this question.
I found for you How to code to control GPIO from python (st.com)
Don't hesitate to browse this community and the stm32mpu wiki.
Hope it help,
Olivier
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-01-25 9:36 AM
Thanks for the link, I have found that exact post, but I didn't find a way to figure out the mapping from (gpiochipX, line) to PIN. Do you know where I can find this mapping?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-10 3:15 AM
Hello @msche.1​ ,
As explained on the wiki you can displays information and controls the gpiochip line with "gpiodetect", "gpioinfo", "gpioget", etc: https://wiki.st.com/stm32mpu/wiki/How_to_control_a_GPIO_in_userspace
The mapping of the GPIO is available in the datasheet, from page 93:
https://www.st.com/resource/en/datasheet/stm32mp157c.pdf
If you want the information of pin PA8 for example, you can first do a:
root@stm32mp1:~# gpiodetect
gpiochip0 [GPIOA] (16 lines)
gpiochip1 [GPIOB] (16 lines)
gpiochip2 [GPIOC] (16 lines)
gpiochip3 [GPIOD] (16 lines)
gpiochip4 [GPIOE] (16 lines)
gpiochip5 [GPIOF] (16 lines)
gpiochip6 [GPIOG] (16 lines)
gpiochip7 [GPIOH] (16 lines)
gpiochip8 [GPIOI] (16 lines)
gpiochip9 [GPIOZ] (16 lines)
You see that GPIOA is gpiochip0:
Then you can use:
root@stm32mp1:~# gpioget gpiochip0 8
0
Same thing with gpioset.
Regards,
Kevin
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'
