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.

Turning LEDs on and off on the 816X EVM

Other Parts Discussed in Thread: PCF8575

Hi,

I would like to be able to turn the user LEDs on my EVM on and off, but I can't find any information on how to do this.  I can see from the EVM schematic that the 4 LEDs are tied to a PCF8575 I2C I/O expander.

I would like to be able to manipulate the LEDs at the Linux command line using the /dev/i2c-1 or /dev/i2c-2 driver and also be able to change the LED state from within a C program.

Any help would be greatly appreciated.

Paul

  • Hi Paul,

    All the IO's of the PCF8575 I2C I/O expander is exported to virtual gpio lines. Those can be controlled from the userspace (sysfs entries).

    You can look at the usage of GPIO_LCD_PWR_DOWN

    Details:-

    File: arch/arm/mach-omap2/board-ti8148evm.c

    Functions: setup_gpio_ioexp, ti814x_evm_i2c_init

    Struct: io_expander_data, ti814x_i2c_boardinfo1

    Notes:

    1. Look at the details of which GPIO is used for LED, program the same.

    2. Give the correct I2C expander address

    3. Give the correct gpio_base, in case of DM816x (2 * 32 + any other io expander gpio's)

    4. controlling GPIO value from sysfs entries (http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/130602.aspx#468956)

     

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

  • Hi Anil,

    Thanks for your quick response.

    I see the code you are talking about in board-ti816x-evm.c.

    So, do I have to modify this file and rebuild the kernel to program the LEDs from my application?

    Paul

  • Hi Paul,

    You have to add similar data in board-ti816x-evm.c (DM8148 specific) to board-ti816x-evm.c (DM8168) file with respect to LED GPIO numbers.

    Needs to add gpio_request(), gpio_export() and gpio_direction_output() for controlling the LED's.

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

  • Hi Anil,

    I am still not sure whether I need to rebuild the kernel to make the LEDs blink.  I'd rather manipulate the LEDs from user space than try to hack the kernel, if possible.

    I've seen in this FAQ

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

    where LEDs on some EVMs can be turned on from user space by using the command

    echo 1 > /sys/class/leds/DS5/brightness

    and turned off by using the command

    echo 0 > /sys/class/leds/DS5/brightness

    However, there is no such path on the 816X EVM.  Has this method not been implemented on this board?

    Paul

  • Hi Paul,

    Those class exports are from led driver(/sys/class/leds/DS5/brightness), its not applicable for DM8168 device.

    You have to modify the boardfile.

    For exporting the GPIO lines, just follow the steps mentioned above, its copy paste from board-ti8148.c to board-ti8168.c file, with little modifications.

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

  • hi Anil, 

    I am able to toggle the GPIO pin on dm816x... using sysfs entries.. now i need to generate PWM on any of the GPIO pins.. Can you suggest any possible way to do it? I can s from the TRM that timers TIM7_OUT to TIM4_OUT have PWM output.. and i didnt find any PWM drivers inbuilt with the kernel in the PSP guide.. 

    i am using ezsdk5.04 and kernel version is "linux-2.6.37-psp04.04.00"

    hope i am clear abt my doubt

    thanks

    best regards

    hitesh 

  • hi hitesh

    I am new in the devlopment side. presently i am working on 816x/389x EVM board. Can u please tell the procedure to turn on the led present on the board