cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to set the GPIO low permanently from the command line

darla14
Senior

Hello,

I am using STM32mp157f-dk2 board and I have a peripheral connected on GPIO pin #16 ( PF1)

on doing gpoiget gpiochip5 1 > i get 1

on doing gpiosetgpiochip5 1=0 i DO NOT get any error but on doing again gpioget gpiochip5 1 > i get 1 again

I see it is shared with SDMMC3_CMD . On directly connecting it to Ground , it becomes low , not otherwise from the above commands.

Is this the same MMC on which starter image is written?Is it safe to pull it down permanently from the hardware?

  

May I know how to make it low from the software permanenetly.

Regards,D

1 ACCEPTED SOLUTION

Accepted Solutions
darla14
Senior

Thanks @PatrickF​  This worked actually by following example code on stm32mpu wiki using the libgpiod example code :

Regards,

View solution in original post

4 REPLIES 4
PatrickF
ST Employee

Hi @darla14​ ,

may I suggest to try using devmem2 to directly access GPIO registers.

e.g.

# enable GPIOF IP clock in RCC
devmem2 0x50000A28 W 0x00000020
 
# set PF1 in GPIO output mode
# read the value (I read 0xBFBFFFCF on my DK2)
devmem2 0x50007000 W 
# write the value modified with MODER1=0b01
devmem2 0x50007000 W 0xBFBFFFC7
 
# set PF1 = 0 using bit BR1 in GPIOF_BSRR (but PF1 should be already 0 as default value)
devmem2 0x50007018 W 0x00020000

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.
PatrickF
ST Employee

In fact, using "gpioget gpiochip5 1" will put PF1 in input mode (I assume you have an external pull-up as you read '1'), so should not be used after having issued "gpioset gpiochip5 1=0" which put PF1 in output with '0'.

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.
darla14
Senior

Thanks @PatrickF​  This worked actually by following example code on stm32mpu wiki using the libgpiod example code :

Regards,

PatrickF
ST Employee

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.