Tinker Board Forum

Full Version: wiringPi for Android
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
(06-27-2019, 04:40 PM)lobo Wrote: [ -> ]I think you need to chmod 666 /dev/i2c-1. If your app is running after that, you would need to edit ueventd.rk30board.rc. This is done by repacking the boot.img and flashing to TB or directly to sdcard.
If it is not running, your app needs root. If you are on Android Nougat, you would need to install Magisk for that and put some code in your app for getting root permission.

"repacking the boot.img" as in building the android image again?

Is it sufficient that I add chmod 666 /dev/i2c-1 at the end of ueventd.rk30board.rc?

Also, the same file shows the following for ttyS*:
Code:
/dev/ttyS0                0660   bluetooth  net_bt_stack
/dev/ttyS1                0660   bluetooth  net_bt_stack
#/dev/ttyS2                0660   bluetooth  net_bt_stack

And the init.connectivity.rc file shows:
Code:
   chown bluetooth net_bt_stack /dev/ttyS1

   chown bluetooth net_bt_stack /dev/ttyS0

Could this be the reason that I am not able to use UART pins? Why do all of them show bluetooth  net_bt_stack?

I am sorry to be asking so many questions. I am not used to Linux or Android. I am learning now.

Thank you
Quote:Is it sufficient that I add chmod 666 /dev/i2c-1 at the end of ueventd.rk30board.rc?
Yes, as this would make it accessible for all users.

Quote:"repacking the boot.img" as in building the android image again?
No, here is a description how to:
https://tinkerboarding.co.uk/forum/threa...ml#pid2585
In section change permission permanently alternative 2 is written what you need.

Quote:Why do all of them show bluetooth  net_bt_stack?
This, for sure is relic. Remember that Asus used for building Android on the TB the SDK from Rockchip. And that for sure was made for smartphones...
Quote:Why do all of them show bluetooth  net_bt_stack?
This, for sure is relic. Remember that Asus used for building Android on the TB the SDK from Rockchip. And that for sure was made for smartphones...
[/quote]

So to use any particular ttyS*, I need to remove the
Code:
bluetooth  net_bt_stack
and make it
Code:
system system
?

like such:

Code:
/dev/ttyS1                0660   system system
in ueventd.rk30board.rc?

And in the init.connectivity.rc, change this line
Code:
chown bluetooth net_bt_stack /dev/ttyS1
into
Code:
chown bluetooth system /dev/ttyS1
or remove it completely?
Hi lobo,

I used the library with the image "20180712-tinker-board-android-marshmallow-userdebug-v13.14.0.95" and everything worked great. Now, I have updated the tinkerboard to the latest version available on the tinkerboard website "20190515-tinker-board-android-nougat-userdebug-v14.3.2.82", and now gpio does not work properly. Do you have any idea?


Thank you. Great job.
Best regards.
Sorry Spectrico, I can't test it. My two tinkerboards are in production. Could you please specify with more details what is not working?
(03-01-2020, 06:25 AM)lobo Wrote: [ -> ]Sorry Spectrico, I can't test it. My two tinkerboards are in production. Could you please specify with more details what is not working?


Hi Lobo, thanks for your reply.

When I try to change the PIN mode it doesn't work, and when I try to write the value for an output PIN it doesn't work either. Serial ports seem to work perfectly.

I post here what commands I am using in the console and what are the results.

Code:
rk3288:/ # gpio -v
gpio version: 2.31
Copyright (c) 2012-2015 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

TinkerBoard Details:
 Type: ASUS pi, Revision: 02, Memory: 2048MB, Maker: Asus
 This TinkerBoard supports user-level GPIO access.
   -> See the man-page for more details

rk3288:/ # gpio readall
+-----+-----+---------+------+---+--Tinker--+---+------+---------+-----+-----+
| CPU | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | CPU |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
|     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
| 252 |   8 |   SDA.1 |      | 1 |  3 || 4  |   |      | 5V      |     |     |
| 253 |   9 |   SCL.1 |      | 1 |  5 || 6  |   |      | 0v      |     |     |
|  17 |   7 | GPIO0C1 |  OUT | 0 |  7 || 8  | 1 | SERL | TxD1    | 15  | 161 |
|     |     |      0v |      |   |  9 || 10 | 1 | SERL | RxD1    | 16  | 160 |
| 164 |   0 | GPIO5B4 | SERL | 1 | 11 || 12 | 0 |      | GPIO6A0 | 1   | 184 |
| 166 |   2 | GPIO5B6 |  OUT | 1 | 13 || 14 |   |      | 0v      |     |     |
| 167 |   3 | GPIO5B7 |  OUT | 1 | 15 || 16 | 1 | OUT  | GPIO5B2 | 4   | 162 |
|     |     |    3.3v |      |   | 17 || 18 | 1 | OUT  | GPIO5B3 | 5   | 163 |
| 257 |  12 |   MOSI1 |      | 1 | 19 || 20 |   |      | 0v      |     |     |
| 256 |  13 |   MISO1 |      | 1 | 21 || 22 | 1 | OUT  | GPIO5C3 | 6   | 171 |
| 254 |  14 |   SCLK1 |      | 1 | 23 || 24 | 1 |      | CE0     | 10  | 255 |
|     |     |      0v |      |   | 25 || 26 | 1 | OUT  | CE1     | 11  | 251 |
| 233 |  30 |   SDA.2 |      | 1 | 27 || 28 | 1 |      | SCL.2   | 31  | 234 |
| 165 |  21 | GPIO5B5 | SERL | 1 | 29 || 30 |   |      | 0v      |     |     |
| 168 |  22 | GPIO5C0 |  OUT | 1 | 31 || 32 | 1 | SERL | GPIO7C7 | 26  | 239 |
| 238 |  23 | GPIO7C6 | SERL | 1 | 33 || 34 |   |      | 0v      |     |     |
| 185 |  24 | GPIO6A1 |      | 0 | 35 || 36 | 1 | SERL | GPIO7A7 | 27  | 223 |
| 224 |  25 | GPIO7B0 | SERL | 1 | 37 || 38 | 0 |      | GPIO6A3 | 28  | 187 |
|     |     |      0v |      |   | 39 || 40 | 0 |      | GPIO6A4 | 29  | 188 |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| CPU | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | CPU |
+-----+-----+---------+------+---+--Tinker--+---+------+---------+-----+-----+

rk3288:/ # gpio mode 3 IN

rk3288:/ # gpio readall
+-----+-----+---------+------+---+--Tinker--+---+------+---------+-----+-----+
| CPU | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | CPU |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
|     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
| 252 |   8 |   SDA.1 |      | 1 |  3 || 4  |   |      | 5V      |     |     |
| 253 |   9 |   SCL.1 |      | 1 |  5 || 6  |   |      | 0v      |     |     |
|  17 |   7 | GPIO0C1 |  OUT | 0 |  7 || 8  | 1 | SERL | TxD1    | 15  | 161 |
|     |     |      0v |      |   |  9 || 10 | 1 | SERL | RxD1    | 16  | 160 |
| 164 |   0 | GPIO5B4 | SERL | 1 | 11 || 12 | 0 |      | GPIO6A0 | 1   | 184 |
| 166 |   2 | GPIO5B6 |  OUT | 1 | 13 || 14 |   |      | 0v      |     |     |
| 167 |   3 | GPIO5B7 |  OUT | 1 | 15 || 16 | 1 | OUT  | GPIO5B2 | 4   | 162 |
|     |     |    3.3v |      |   | 17 || 18 | 1 | OUT  | GPIO5B3 | 5   | 163 |
| 257 |  12 |   MOSI1 |      | 1 | 19 || 20 |   |      | 0v      |     |     |
| 256 |  13 |   MISO1 |      | 1 | 21 || 22 | 1 | OUT  | GPIO5C3 | 6   | 171 |
| 254 |  14 |   SCLK1 |      | 1 | 23 || 24 | 1 |      | CE0     | 10  | 255 |
|     |     |      0v |      |   | 25 || 26 | 1 | OUT  | CE1     | 11  | 251 |
| 233 |  30 |   SDA.2 |      | 1 | 27 || 28 | 1 |      | SCL.2   | 31  | 234 |
| 165 |  21 | GPIO5B5 | SERL | 1 | 29 || 30 |   |      | 0v      |     |     |
| 168 |  22 | GPIO5C0 |  OUT | 1 | 31 || 32 | 1 | SERL | GPIO7C7 | 26  | 239 |
| 238 |  23 | GPIO7C6 | SERL | 1 | 33 || 34 |   |      | 0v      |     |     |
| 185 |  24 | GPIO6A1 |      | 0 | 35 || 36 | 1 | SERL | GPIO7A7 | 27  | 223 |
| 224 |  25 | GPIO7B0 | SERL | 1 | 37 || 38 | 0 |      | GPIO6A3 | 28  | 187 |
|     |     |      0v |      |   | 39 || 40 | 0 |      | GPIO6A4 | 29  | 188 |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| CPU | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | CPU |
+-----+-----+---------+------+---+--Tinker--+---+------+---------+-----+-----+

rk3288:/ # gpio write 2 0

rk3288:/ # gpio readall
+-----+-----+---------+------+---+--Tinker--+---+------+---------+-----+-----+
| CPU | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | CPU |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
|     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
| 252 |   8 |   SDA.1 |      | 1 |  3 || 4  |   |      | 5V      |     |     |
| 253 |   9 |   SCL.1 |      | 1 |  5 || 6  |   |      | 0v      |     |     |
|  17 |   7 | GPIO0C1 |  OUT | 0 |  7 || 8  | 1 | SERL | TxD1    | 15  | 161 |
|     |     |      0v |      |   |  9 || 10 | 1 | SERL | RxD1    | 16  | 160 |
| 164 |   0 | GPIO5B4 | SERL | 1 | 11 || 12 | 0 |      | GPIO6A0 | 1   | 184 |
| 166 |   2 | GPIO5B6 |  OUT | 1 | 13 || 14 |   |      | 0v      |     |     |
| 167 |   3 | GPIO5B7 |  OUT | 1 | 15 || 16 | 1 | OUT  | GPIO5B2 | 4   | 162 |
|     |     |    3.3v |      |   | 17 || 18 | 1 | OUT  | GPIO5B3 | 5   | 163 |
| 257 |  12 |   MOSI1 |      | 1 | 19 || 20 |   |      | 0v      |     |     |
| 256 |  13 |   MISO1 |      | 1 | 21 || 22 | 1 | OUT  | GPIO5C3 | 6   | 171 |
| 254 |  14 |   SCLK1 |      | 1 | 23 || 24 | 1 |      | CE0     | 10  | 255 |
|     |     |      0v |      |   | 25 || 26 | 1 | OUT  | CE1     | 11  | 251 |
| 233 |  30 |   SDA.2 |      | 1 | 27 || 28 | 1 |      | SCL.2   | 31  | 234 |
| 165 |  21 | GPIO5B5 | SERL | 1 | 29 || 30 |   |      | 0v      |     |     |
| 168 |  22 | GPIO5C0 |  OUT | 1 | 31 || 32 | 1 | SERL | GPIO7C7 | 26  | 239 |
| 238 |  23 | GPIO7C6 | SERL | 1 | 33 || 34 |   |      | 0v      |     |     |
| 185 |  24 | GPIO6A1 |      | 0 | 35 || 36 | 1 | SERL | GPIO7A7 | 27  | 223 |
| 224 |  25 | GPIO7B0 | SERL | 1 | 37 || 38 | 0 |      | GPIO6A3 | 28  | 187 |
|     |     |      0v |      |   | 39 || 40 | 0 |      | GPIO6A4 | 29  | 188 |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| CPU | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | CPU |
+-----+-----+---------+------+---+--Tinker--+---+------+---------+-----+-----+

rk3288:/ #


All those commands worked perfectly in the previous version of Android. I don't know if there is any command or action that I have to do previously.

Thank you very much.
Hi Spectrico, I have tested it now. I don't know from where you have downloaded and compiled. But when I use the version from my github account it works.
I can mode the pins from in to out and I measured also with meter if the level changes.
For reference, this is the version I patched to work on 7.1.2: https://github.com/joerg65/wiringTinker_Android
(03-07-2020, 12:07 PM)lobo Wrote: [ -> ]Hi Spectrico, I have tested it now. I don't know from where you have downloaded and compiled. But when I use the version from my github account it works.
I can mode the pins from in to out and I measured also with meter if the level changes.
For reference, this is the version I patched to work on 7.1.2: github.com/joerg65/wiringTinker_Android

Hi Lobo,

I have downloaded and compiled the version of your github account. I have no other version

The operating system version that I have is "20190515-tinker-board-android-nougat-userdebug-v14.3.2.82"

I think I'm missing something. Is it mandatory to recompile the kernel to add the gpiomem driver? I thought it was no longer necessary. With the previous version of AndroidOS (20180712-tinker-board-android-marshmallow-userdebug-v13.14.0.95) I did not compile the kernel and everything worked perfectly.

I don't know where the problem may be. Could it be a problem with system permissions? Could it be a problem with the version of ndk used to compile the lib?

Greetings and thanks again for your help.
(03-09-2020, 07:39 AM)Spectrico Wrote: [ -> ]Hi Lobo,

I have downloaded and compiled the version of your github account. I have no other version

The operating system version that I have is "20190515-tinker-board-android-nougat-userdebug-v14.3.2.82"

I think I'm missing something. Is it mandatory to recompile the kernel to add the gpiomem driver? I thought it was no longer necessary. With the previous version of AndroidOS (20180712-tinker-board-android-marshmallow-userdebug-v13.14.0.95) I did not compile the kernel and everything worked perfectly.

I don't know where the problem may be. Could it be a problem with system permissions? Could it be a problem with the version of ndk used to compile the lib?

Greetings and thanks again for your help.

Ah, sorry. I just compared the github version with my local and I see differences. I forgot about why it's not up to date. Huh
Can you try this libraries? If you can confirm that they work I can upload a new branch to github.
[attachment=461]
(03-09-2020, 07:26 PM)lobo Wrote: [ -> ]
(03-09-2020, 07:39 AM)Spectrico Wrote: [ -> ]Hi Lobo,

I have downloaded and compiled the version of your github account. I have no other version

The operating system version that I have is "20190515-tinker-board-android-nougat-userdebug-v14.3.2.82"

I think I'm missing something. Is it mandatory to recompile the kernel to add the gpiomem driver? I thought it was no longer necessary. With the previous version of AndroidOS (20180712-tinker-board-android-marshmallow-userdebug-v13.14.0.95) I did not compile the kernel and everything worked perfectly.

I don't know where the problem may be. Could it be a problem with system permissions? Could it be a problem with the version of ndk used to compile the lib?

Greetings and thanks again for your help.

Ah, sorry. I just compared the github version with my local and I see differences. I forgot about why it's not up to date. Huh
Can you try this libraries? If you can confirm that they work I can upload a new branch to github.

Hi Lobo, 

Now it works!!!.

Thank you very much for your help.

Best regards.
Pages: 1 2 3 4 5 6