We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

GPIO pins SD pins as GPIO pins



  • @Nagarjuna-Reddy I can't test this right now, but first I think you need to remove the sdcard module as it will likely be managing the registers:

    rmmod mtk_sd

    Then I expect you can use the GPIO like so:

    gpioctl dirout-high 22
    gpioctl get 22
    gpioctl dirout-low 22
    gpioctl get 22

    cat /sys/class/gpio/gpio22/value



  • @crispyoz
    gpio 22 not created

    cd /sys/class/gpio/
    root@Omega-6834:/sys/class/gpio# ls
    export gpiochip0 gpiochip32 gpiochip64 unexport
    root@Omega-6834:/sys/class/gpio# ls
    export gpiochip0 gpiochip32 gpiochip64 unexport

    i enabled high gpio22, but voltages not showing.



  • @crispyoz said in GPIO pins SD pins as GPIO pins:

    rmmod mtk_sd
    Then I expect you can use the GPIO like so:
    gpioctl dirout-high 22
    gpioctl get 22
    gpioctl dirout-low 22
    gpioctl get 22
    cat /sys/class/gpio/gpio22/value

    voltage always showing HIGH. LOW method not happening.
    SD_WP_21 always showing HIGH(3.45V)
    SD_CD_23 always showing HIGH(3.45V)



  • @crispyoz
    Hi Sir, I hope you & your family safe,
    last time i spoken with you regarding SD_CD pin 23 & SD_WD pin 22 make it as a gpio.
    I got a reply from you but that solution not working.

    I am not able to control that Pins like (HIGH & LOW). Could you plz help me out to solve this problem?



  • @Nagarjuna-Reddy Thank you, I live in Sydney Australia so we are pretty safe here these days.

    Can you give us the details of what process you are following to perform your testing, I think this is pretty much the same question I always have to ask you. It is easier to help when we have all the information in the beginning, instead of having to ask for it.



  • @crispyoz
    hi, we have designed our customized onion board. our board is supporting the RS-485 connector. Modbus will work only when you are sending data before need to make it DE Gpio Pin as HIGH and receiving time before the need to make it RE Gpio pin as LOW. so DE & RE gpio pins we are tracked to SD_CD 23 & SD_WD 22 pin.

    for that I followed below steps:

    rmmod mtk_sd
    Then I expect you can use the GPIO like so:
    gpioctl dirout-high 22
    gpioctl get 22
    gpioctl dirout-low 22
    gpioctl get 22
    cat /sys/class/gpio/gpio22/value

    same way I did it GPIO SD-23 Pin.

    i did check using multimeter i got the below result. even when I turned-ON the board without done any changes also it's showing the same result.
    voltage always showing HIGH. LOW method not happening.
    SD_WP_22 always showing HIGH(3.45V)
    SD_CD_23 always showing HIGH(3.45V)


  • administrators

    @Nagarjuna-Reddy Pin multiplexing is controlled by the GPIO1_MODE register (the omega2-ctrl utility is an easy-to-use interface for changing the pin multiplexing settings but it doesn't include the SD pins)

    My suggestion is to use the devmem command to change the SD pin multiplexing setting to gpio in the GPIO1_MODE register, and then test changing the gpios.

    See the MT7688 datasheet for more info on the registers, and run devmem --help on the command line to see how to read the registers.

    Good luck!



  • Do we need to install devmem? It doesn't appear to be included by default...
    Is there any easier way to use SDIO as GPIO from the terminal?



  • @Lazar-Demin
    sir,
    still, I am not able to control SD pins. I followed what u said.

    5895a890-6d73-4377-ae04-1755d8e8638a-image.png

    root@Omega-67FB:~# devmem 10000060 32 01

    861a047d-4f22-4082-a5d1-7070e0ca4d4f-image.png.


  • administrators

    @Nagarjuna-Reddy Doesn't look like you're writing the correct value to the GPIO1_MODE register.
    Take a look at the GPIO1_MODE register definition, you're probably interested in the SD_MODE bit fields.



Looks like your connection to Community was lost, please wait while we try to reconnect.