This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

GPIO toggling from user space



Hi,

I tried to toggle the gpio from user space using sysfs but it is not happening.

Can please somebody will let me know the full procedure for it include mux configuration and etc.

its urgent.

Regards,

Vimal

  • Vimal,

    Please refer to the below wiki:

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_GPIO_Driver_User_Guide#User_Space_-_Sysfs_control

    The mux configuration for every pin in the device is explained into the datasheet.

    Regards,
    Pavel

  • Vimal,

    See also the below wiki for the pinmux in the linux kernel:

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_User_Guide#TI814X.2FTI813X

    BR
    Pavel

  • Hi Pavel,

    i have reffered the said document and done the same but still it is not happening.

    I am trying with GP3[5].

    So can u please provide a example for the said pin.

    Regards,

    Vimal

  • Vimal,

    Refer to the below e2e thread for example:

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/t/182160.aspx

    BR
    Pavel

  • Hi Pavel,

    i have tried it but still it is not happening. where as it is getting toggled in CCS.

    Regards,

    Vimal

  • Vimal,

    Are you probing the AH26 physical pin?

    Can you tell me what is the value of the GP3[5] pinmux register (PINCNTL213 at address 0x48140B50) right after you boot up the linux kernel?

    In my DM814x EVM, the default value is set for VIN[1]A_D[5] signal and can not be changed from user space:

    root@dm814x-evm:~# devmem2 0x48140B50
    /dev/mem opened.
    Memory mapped at address 0x40235000.
    Read at address  0x48140B50 (0x40235b50): 0x00050004
    root@dm814x-evm:~# devmem2 0x48140B50 w 0x00050080

    /dev/mem opened.
    Memory mapped at address 0x402b7000.
    Read at address  0x48140B50 (0x402b7b50): 0x00050004
    Write at address 0x48140B50 (0x402b7b50): 0x00050080, readback 0x00050080
    root@dm814x-evm:~# devmem2 0x48140B50
    /dev/mem opened.
    Memory mapped at address 0x402dc000.
    Read at address  0x48140B50 (0x402dcb50): 0x00050004

    Regards,
    Pavel

  • Hi Pavel,

    here is the output. it is same as you got.

    root@(none):~# devmem2 0x48140B50
    /dev/mem opened.
    Memory mapped at address 0x40245000.
    Read at address  0x48140B50 (0x40245b50): 0x00050004
    root@(none):~#  devmem2 0x48140B50 w 0x00050080
    /dev/mem opened.
    Memory mapped at address 0x40231000.
    Read at address  0x48140B50 (0x40231b50): 0x00050004
    Write at address 0x48140B50 (0x40231b50): 0x00050080, readback 0x00050080
    root@(none):~# devmem2 0x48140B50
    /dev/mem opened.
    Memory mapped at address 0x402fc000.
    Read at address  0x48140B50 (0x402fcb50): 0x00050004

    i tried following different following pins also.

    GP0[29]

    GP0[31]

    GP0[10]

    GP0[11]

    Regards,

    Vimal

  • Hi Pavel,

    As it is not happening from the user space. Can u please tell me something about writing a gpio ioctl driver in kernel and change the value of it from user via ioctl.

    any example source code will be very helpful.

    Regards,

    Vimal

  • Vimal,

    You can toggle a GPIO pin from user space, but you can not change the PINCNTL213 value from user space. You should configure the PINCNTL213 value for GP3[5] in the linux kernel:

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_User_Guide#TI814X.2FTI813X

    Regards,
    Pavel

  • Hi Pavel,

    I have configure the PINCNTL213 as GPIO with following line in omap_board_mux board_mux[] __initdata structure but still could not able to toggle.

     TI814X_MUX(VOUT1_B_CB_C8,  OMAP_MUX_MODE7 | TI814X_PULL_UP),

    Regards,

    Vimal

  • Vimal,

    Vimal Gupta said:

    I have configure the PINCNTL213 as GPIO with following line in omap_board_mux board_mux[] __initdata structure but still could not able to toggle.

     TI814X_MUX(VOUT1_B_CB_C8,  OMAP_MUX_MODE7 | TI814X_PULL_UP),

    And what is the value of the PINCNTL213 when you read it from user space (with devmem2 tool)?

    Regards,
    Pavel

  • Hi Pavel,

    the value of the PINCTL213 is: 0x00050004. so i suspect that it is not muxing but i could not able to get the reason for it.

    here is the log of devmem2

    root@(none):~# devmem2 0x48140B50
    /dev/mem opened.
    Memory mapped at address 0x40245000.
    Read at address  0x48140B50 (0x40245b50): 0x00050004
    root@(none):~#  devmem2 0x48140B50 w 0x00050080
    /dev/mem opened.
    Memory mapped at address 0x40231000.
    Read at address  0x48140B50 (0x40231b50): 0x00050004
    Write at address 0x48140B50 (0x40231b50): 0x00050080, readback 0x00050080
    root@(none):~# devmem2 0x48140B50
    /dev/mem opened.
    Memory mapped at address 0x402fc000.
    Read at address  0x48140B50 (0x402fcb50): 0x00050004

  • Vimal,

    I suspect that the PINCNTL213 value is later overwritten from the ti81xx_video_mux() function in the arch/arm/mach-omap2/devices.c file. Please comment the below line:

    static void __init ti81xx_video_mux(void)
    {

        .................

          } else if (cpu_is_ti814x())    {

     ..................

    /*omap_mux_init_signal("vin1a_d5",
                    TI814X_PULL_DIS | TI814X_INPUT_EN);*/

    }

    Build new kernel and try with it.

    Regards,
    Pavel