How to turn on Debug LED from "terminal" or Java (Android).

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to turn on Debug LED from "terminal" or Java (Android).

1,605 Views
billbigelow
Contributor II

For a quick demo, I need to turn on/off one of the spare LEDs on the 6SLEVM (i.MX6 SoloLite EVK).

I'm demoing an Android app running on that board.

I see how to do it from a C program but not from Java in an Android app.

Sample java blog suggests finding it in the "Device Tree" the write to it like writing a file.

e.g. URI = /sys/devices/virtual/gpio/gpio115/value, or similar location in /sys/classes... or something like that.

Then, to check from the command line, I'd type "echo 1 > /sys/devices/virtual/gpio/gpio115/value"

But I can't find a "device" in the tree that looks like it's for that LED.

On the schematic, it's HSIC_STROBE (and HSIC_STROBE_GPIO).

In reference guide, it mentions GPIO3_20 for ALT5 (a/k/a gpio3.GPIO[20]).  I have no idea how that implies a node in the Device Tree.

In the schematic, it's D23, driven by Q5 (page 14).

Any ideas?

Labels (3)
0 Kudos
4 Replies

884 Views
igorpadykov
NXP Employee
NXP Employee

Hi Bill

please check below link how to control debug led on the i.MX6SL EVK

Problems modifying device tree to blink an LED

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

884 Views
billbigelow
Contributor II

Thanks that's a good link.

In brief (for other readers), the LEDs are not located under a GPIO folder of the device tree (as I posed in the question).

They are located in:

/sys/class/leds/Heartbeat/

My board doesn't have a "Heartbeat" directory under "/sys/class/leds". In fact the "/sys/class/leds" folder is empty.  As a sanity check, here's my terminal output:

root@android:/ # cd /sys/class/leds

root@android:/sys/class/leds # ls

root@android:/sys/class/leds #

So it appears that in the SD card that is shipped with the SoloLite EVK, the Heartbeat part of the device tree is missing.  This board was purchased in Dec 2014 and is running KitKat 4.4.2.

The SD card is labeled by Freescale as follows:

MX6SLEVK LCD

Android r12.10.02

110-77558 A

It's possible I should open another thread namely: "LED folder missing in SoloLite EVK using factory SD card".

0 Kudos

884 Views
billbigelow
Contributor II

Are you sure that is the correct device tree path for the SoloLite?  I don't see anything in the BSP that would create/map anything under the LED path mentioned.  I checked init.rc, init.freescale.rc and others.

Instead, it has some of the other GPIO directories that one would expect.  Here's my terminal output:

 

root@android:/sys/class/gpio # cat gpiochip0/label

gpio-0

root@android:/sys/class/gpio # cat gpiochip32/label

gpio-1

root@android:/sys/class/gpio # cat gpiochip64/label

gpio-2

root@android:/sys/class/gpio # cat gpiochip96/label

gpio-3

root@android:/sys/class/gpio # cat gpiochip128/label

gpio-4

root@android:/sys/class/gpio # cat gpiochip160/label

gpio-5

root@android:/sys/class/gpio # cat gpiochip192/label

gpio-6

root@android:/sys/class/gpio # cat gpiochip250/label

wm8962


None of these have a "value" folder in them.

I believe I need gpio-3 bit 21 (index 20) per the schematic.  That's HSIC_STROBE using the ALT5 column (gpio3.GPIO[20].  I don't see gpio3 in the schematic.


Most the directories are gpiochipxxx, not gpioxxx.  Note: there is a gpio115 directory, but I don't know what that is.  There is also an export and unexport directory.


The same folder structure exists in: /sys/devices/virtual/gpio, but I don't know the difference between these two directories.

 

0 Kudos

884 Views
igorpadykov
NXP Employee
NXP Employee

probably Demo image had not requirements to have these folders.

In any way one needs to implement patch to make led to work as suggests link.

https://community.freescale.com/thread/319064

patch: GPIO connected to an LED could not work when the PMIC driver was enabled

'[PATCH] ARM: dts: imx6sl-evk: Keep VGEN1 regulator always enabled' - MARC

0 Kudos