Posts: 220
Threads: 4
Likes Received: 25 in 23 posts
Likes Given: 3
Joined: Sep 2017
Hello there, i am new to this forum. I have a TinkerBoard since 6 weeks and I try to port a project of mine. As I have already adapted the wiringPi code from Asus to Android, I would like to share it.
You can find it on github:
https://github.com/joerg65/wiringTinker_Android
As I describe there, to use the wiringPi GPIO functions from an app, it is needed a gpiomem driver. You will find the source code for the gpiomem driver also on my github repositories:
https://github.com/joerg65/gpiomem_tinkerboard
If there are any question, please ask better here and not on github. I tried to explain everything well. but sometimes there are missing some information.
Only some functions as GPIO read and write and soft pwm are tested, so there might be some not functional parts. The spi also need a modification in kernel, this I would publish in the next days.
The following 1 user Likes lobo's post:1 user Likes lobo's post
• fited
Posts: 14
Threads: 1
Likes Received: 0 in 0 posts
Likes Given: 0
Joined: Sep 2017
•
Posts: 19
Threads: 0
Likes Received: 0 in 0 posts
Likes Given: 0
Joined: Aug 2017
Great job, thanks for your work !
I push the library into jniLibs folder and build an android app to access gpio, it is
working for me.
This is my execution result.
* I modify the Application.mk for tinkerboard
Code:
APP_ABI := armeabi armeabi-v7a
•
Posts: 220
Threads: 4
Likes Received: 25 in 23 posts
Likes Given: 3
Joined: Sep 2017
Fine that it work for you and thank you for the update.
•
Posts: 1
Threads: 0
Likes Received: 0 in 0 posts
Likes Given: 0
Joined: Oct 2017
10-20-2017, 05:17 PM
Hi
I have xamarin with visual studio 2015 with c# for make my android app.
how can i use this library for programming?
thanks
•
Posts: 220
Threads: 4
Likes Received: 25 in 23 posts
Likes Given: 3
Joined: Sep 2017
10-22-2017, 09:09 AM
(This post was last modified: 10-22-2017, 09:10 AM by lobo.)
Hi, I have no experience with xamarin and c#. But it should be possible to import the libwiringPi.so library.
Take a look here:
https://developer.xamarin.com/guides/and...libraries/
First you need to compile the wiringPi, for that you'll need the Android NDK.
•
Posts: 7
Threads: 1
Likes Received: 1 in 1 posts
Likes Given: 0
Joined: Nov 2017
11-04-2017, 02:42 PM
Great job, works very well. Thank you.
•
Posts: 220
Threads: 4
Likes Received: 25 in 23 posts
Likes Given: 3
Joined: Sep 2017
Thank you.
But please don't use the softPWM functions. I found that it blocks the UI heavily and not yet found the reason why. On Odroid C1/C2 the same code runs well.
•
Posts: 19
Threads: 11
Likes Received: 2 in 2 posts
Likes Given: 0
Joined: Dec 2017
(09-27-2017, 05:24 PM)lobo Wrote: Hello there, i am new to this forum. I have a TinkerBoard since 6 weeks and I try to port a project of mine. As I have already adapted the wiringPi code from Asus to Android, I would like to share it.
You can find it on github: https://github.com/joerg65/wiringTinker_Android
As I describe there, to use the wiringPi GPIO functions from an app, it is needed a gpiomem driver. You will find the source code for the gpiomem driver also on my github repositories: https://github.com/joerg65/gpiomem_tinkerboard
If there are any question, please ask better here and not on github. I tried to explain everything well. but sometimes there are missing some information.
Only some functions as GPIO read and write and soft pwm are tested, so there might be some not functional parts. The spi also need a modification in kernel, this I would publish in the next days.
Hi lobo,
thanks for you share , which gpio port we can use (i mean not occupy for system )?
•
Posts: 220
Threads: 4
Likes Received: 25 in 23 posts
Likes Given: 3
Joined: Sep 2017
Hi leonzhangzhang
,
here you can see all gpio that are usable by wiringPi:
Code:
root@rk3288:/ # /system/bin/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 | IN | 0 | 7 || 8 | 0 | SERL | TxD1 | 15 | 161 |
| | | 0v | | | 9 || 10 | 1 | SERL | RxD1 | 16 | 160 |
| 164 | 0 | GPIO5B4 | IN | 1 | 11 || 12 | 0 | | GPIO6A0 | 1 | 184 |
| 166 | 2 | GPIO5B6 | IN | 0 | 13 || 14 | | | 0v | | |
| 167 | 3 | GPIO5B7 | IN | 1 | 15 || 16 | 1 | IN | GPIO5B2 | 4 | 162 |
| | | 3.3v | | | 17 || 18 | 1 | IN | GPIO5B3 | 5 | 163 |
| 257 | 12 | MOSI1 | | 0 | 19 || 20 | | | 0v | | |
| 256 | 13 | MISO1 | | 0 | 21 || 22 | 0 | IN | GPIO5C3 | 6 | 171 |
| 254 | 14 | SCLK1 | | 1 | 23 || 24 | 1 | | CE0 | 10 | 255 |
| | | 0v | | | 25 || 26 | 1 | | CE1 | 11 | 251 |
| 233 | 30 | SDA.2 | IN | 1 | 27 || 28 | 1 | | SCL.2 | 31 | 234 |
| 165 | 21 | GPIO5B5 | IN | 1 | 29 || 30 | | | 0v | | |
| 168 | 22 | GPIO5C0 | IN | 1 | 31 || 32 | 1 | SERL | GPIO7C7 | 26 | 239 |
| 238 | 23 | GPIO7C6 | SERL | 1 | 33 || 34 | | | 0v | | |
| 185 | 24 | GPIO6A1 | | 0 | 35 || 36 | 1 | IN | GPIO7A7 | 27 | 223 |
| 224 | 25 | GPIO7B0 | IN | 0 | 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--+---+------+---------+-----+-----+
All the pins that are IN or OUT can be used.
Note that the pins 32 and 33 normally also are usable, but I changed the devicetree to have the ttyS4 there.
Best is you check on your own system with
gpio readall.
•