Odroid N2 "getGpioList()" returns empty array, can't access gpio ports

334 Views Asked by At

Im running Lineage 16.0 on the Odroid N2. I want to access the GPIO pins via an Android App and have found something interesting inside the Android-Things documentary.

https://developer.android.com/things/sdk/pio/gpio

Now my problem is, my app doen't find any gpio ports. The following code only returns an empty array:

PeripheralManager manager = PeripheralManager.getInstance();
List<String> portList = manager.getGpioList();

Of course permissions are set as following:

<uses-permission android:name="com.google.android.things.permission.USE_PERIPHERAL_IO" />

I then just ignored that and tried to connect to the GPIO ports with this code:

PeripheralManager manager = PeripheralManager.getInstance();
Gpio gpio = manager.openGpio("488");

But still no success. but I'm not exactly sure if it doesn't work because instead "488" isn't the correct name for the GPIO-port or because of something else. I've also tried some variations like "BCM12" etc.

In either case, I'd like to get "getGpioList()" working first, but I honestly can't find the error.

2

There are 2 best solutions below

0
Andrii Omelchenko On BEST ANSWER

Android Things didn't support Odroid N2 hardware platform. All Android Things supported hardware described in Official Documentation.

1
Sang Chul Go On

Please check reference android image supported by the Hardkernel. Physical Pin number is pin name, like pin #7's pin name is just a "7". Like below! :)

PeripheralManager manager = PeripheralManager.getInstance();
Gpio gpio = manager.openGpio("7");