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 change gpio-led pins in beagle bone board file?

Other Parts Discussed in Thread: SYSBIOS

Hi,

I am trying to modify the LEDs in board file (board-am335xevm.c). Presently it has configured for the GPIO_TO_PIN(1, 21), but we want to test the same functionlity for GPIO_TO_PIN(1,2).

We have modified the following:

#define BEAGLEBONE_USR1_LED  GPIO_TO_PIN(1, 6)
#define BEAGLEBONE_USR2_LED  GPIO_TO_PIN(1, 7)
#define BEAGLEBONE_USR3_LED  GPIO_TO_PIN(1, 2)
#define BEAGLEBONE_USR4_LED  GPIO_TO_PIN(1, 3)

static struct gpio_led bone_gpio_leds[] = {
        {
                .name                   = "beaglebone::usr0",
                .default_trigger        = "heartbeat",
                .gpio                   = BEAGLEBONE_USR1_LED,
        },
        {
                .name                   = "beaglebone::usr1",
                .default_trigger        = "mmc0",
                .gpio                   = BEAGLEBONE_USR2_LED,
        },
        {
                .name                   = "beaglebone::usr2",
                .gpio                   = BEAGLEBONE_USR3_LED,
        },
        {
                .name           = "beaglebone::usr3",
                .gpio           = BEAGLEBONE_USR4_LED,
        },
};

static struct gpio_led_platform_data bone_gpio_led_info = {
        .leds           = bone_gpio_leds,
        .num_leds       = ARRAY_SIZE(bone_gpio_leds),
};

static struct platform_device bone_leds_gpio = {
        .name   = "leds-gpio",
        .id     = -1,
        .dev    = {
                .platform_data  = &bone_gpio_led_info,
        },
};
static struct pinmux_config bone_pin_mux[] = {
{"gpmc_ad6.gpio1_6",    OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA }, //LED1
        {"gpmc_ad7.gpio1_7",    OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA }, //LED2
        {"gpmc_ad2.gpio1_2",    OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA }, //LED3
        {"gpmc_ad3.gpio1_3",    OMAP_MUX_MODE7 | AM33XX_PIN_OUTPUT | AM33XX_PULL_DISA }, //LED4
    /* Grounding gpio1_6 (pin 3 Conn A) signals bone tester to start diag tests */
    {"gpmc_ad6.gpio1_6", OMAP_MUX_MODE7 | AM33XX_PIN_INPUT_PULLUP}, //chandu commented for b_cast_pin_MUX
        {NULL, 0},
};
static void boneleds_init(int evm_id, int profile )
{
        int err;
        setup_pin_mux(bone_pin_mux);
        err = platform_device_register(&bone_leds_gpio);
        if (err)
                pr_err("failed to register BeagleBone LEDS\n");
}
if (beaglebone_leds_free == 1) {
                        pr_info("Beaglebone: initializing onboard LEDs");
                        boneleds_init(0,0);

after updating pinmux with different pins i am not able to see /sys/class entry of these LEDs.

Please let me know what is the change i need to look into.




  • Hi Chandu,

    I couldn't figure out why are you configuring gpio1_6 two times in the same pinmux config. Would you please explain?

    Could you please also attach your whole board-am335xevm.c board file?

    Best regards,
    Miroslav

  • Hi Miroslav,

    Thanks for the reply.

    Sorry i have forgotten to comment that. Now i am able to build and test with the new LED pins which are required.

    I have configured gpio1_2, gpio1_3, gpio1_6, gpio1_7. I have figured out the problem that is when i am configuring these pins, gpio_request for gpio1_3 is got failed.

    On that reason we are not getting entry in sys/class. presently i am not using that pin.

    To solve this i am directly used export from shell 

    root@CCD-TRANS-0000000000000:~# echo 35 > /sys/class/gpio/export
    -bash: echo: write error: Device or resource busy

    This error i am getting, and i have tried to unexport the same pin even i am getting same error.

    But when i am trying using a digitalio driver (gpio driver written) and able to access using my digital driver.

    But i did not understand why i am not able to access this particular pin from board-configuration file and from shell but where i can access from a newly written driver.

    Please let me is gpio1_3 is using from some other purposes. May be is that causes.

    Could you please tell me any other way to free this pin.

    Regards

    chandu

  • Hi,

    We have solved the issue of blockage of gpio1_3, which is using a 1-wire communication protocol in auto mode.

    This we can see by cat /sys/kernel/debug/gpio, will list all the gpio usage.

    We are removed the 1-wire communication protocol from board file and it is working fine.

    Thanks

    chandu

  • Hello

    I have started  with  CCSv5 and i am using  BeagleBone-AM3358 as target with on-board JTAG XDS100v2.

    I want to test GPIO on target, what will be the best point to start ??

    In different e2e forums i found starterware is having some demo SYSbios gpio  LED application for beaglebone.

    is that the better point to start ??

    Please share your ideas.


    Thanks

  • Satyaprakash Mishra,
     
    Instead of digging up old threads, and sticjing the same question to them, could you please post your question on NEW threads, if you want them answered properly. Also please note that there are separate forums for Starterware, Code Composer and Sys/Bios