Skip to main content
Graduate
December 17, 2021
Solved

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

  • December 17, 2021
  • 4 replies
  • 1808 views

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

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

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

    Regards,

    4 replies

    Technical Moderator
    January 4, 2022

    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.

    Technical Moderator
    January 4, 2022

    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.

    darla14AuthorAnswer
    Graduate
    February 11, 2022

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

    Regards,

    Technical Moderator
    February 11, 2022

    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'