Home > Uncategorized > An LED Glowing example with i.MX6 u-boot

An LED Glowing example with i.MX6 u-boot

November 16th, 2012

When you are booting u-boot first time, one thing you want is a visual indication that the u-boot has actually booted.

Here is an example how we can make a LED glow for the initial 3 seconds and then make it off. We will do it on the freescale's SabreLite evaluation board. Take a look at the Part of the schematics that has one GPIO pin spare for us - GPIO9 on the connector J7.

We will hook an LED between Pin 4 ( GPIO9) and 7 ( Ground) with a 200 Ohms resistor in series.

At the book time we can make the led glow using the following statement in the file mx6q_sabrelite.c in


It may not be a bad idea to insert it at the time we reset Phy.

void enet_board_init(void)
/* Sabrelite phy reset: gpio3-23 */
set_gpio_output_val(GPIO3_BASE_ADDR, (1 << 23), 0); // GPIO 9 for testing on Sabre Lite Eval Board set_gpio_output_val(GPIO1_BASE_ADDR, (1 << 9), 1); . . .

The statement

set_gpio_output_val(GPIO1_BASE_ADDR, (1 << 9), 1);

makes the LED glow.

To turn the LED off, you can use

set_gpio_output_val(GPIO1_BASE_ADDR, (1 << 9), 0);

after the point where it prints

printf("Hit any key to stop autoboot: %2d ", bootdelay);

Make sure you make the set_gpio_output_val function available in the main.c().


  1. jam
    April 22nd, 2013 at 09:15 | #1

    HI,I need linux source code for imx6(sabrelite).Can you please tell me the location...

  2. admin
    April 25th, 2013 at 04:54 | #2

    Hi jam,

    Please check this tutorial for u-boot source code


  3. Peter
    October 24th, 2014 at 10:41 | #3

    What about reading GPIO port? What I'm thinking is some switch to GPIO pins which would allow to make multiboot.

  1. No trackbacks yet.