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.

How to configure GPIO pin as Input/Output

Hi All,

I want ro write a sipmle driver to blink all four lesds on am335x board.

All four leds are connected to GPIO bank 1. By default all gpio pins are configured as input.

My question is,

1. How to map gpio pins inside kernel.

2. How to configure gpio pins as input/output.

3. How to toggle all four leds.

Thanks in Advanance.

Regards,

Vishnu

  • Hi Vishnu,

    Have you had a look at

    http://processors.wiki.ti.com/index.php/Sitara_GPIO_Driver_User_Guide

    This might help you.

    Regards

    Sandhya

  • Hello vishnu

                 Which kernel and you are using ? Do you running Android or Linux ?

    1.Enable the LED driver in kernel using menuconfig

             Device Drivers  --->  

                      [*] LED Support  --->  

                               <*>   LED Support for GPIO connected LEDs                            

                                [*] LED Trigger support                             
                               <*> LED Timer Trigger 
                               <*> LED Heartbeat Trigger

                               etc as per your requirement 

    2. 

    static struct pinmux_config gpio_led_mux[] = {
    {"gpmc_ad4.gpio1_4", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
    {"gpmc_ad5.gpio1_5", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
    {"gpmc_ad6.gpio1_6", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
    {"gpmc_ad7.gpio1_7", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT},
    {NULL, 0},
    };

    Configure like this as per your kernel code and pin mux

    Cheers

    Kumar