This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
wiringPi for Android
#11
(12-19-2017, 04:40 PM)lobo Wrote: 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.

Hi, lobo
How did you connect the I2C mode? (27 and 28 PIN).
I see only up to 26 pins
http://joxi.ru/Y2Llj6VCnNKnM2

Help me please.
Reply
#12
Hi ankir33,
gpio readall should show all 40 pins. Do you use the wiringPi from my github or the one from Asus? Also need to know if you use the latest Android published last days or the former version. Could be that there are some changes in kernel. I have not yet updated to last version.
Reply
#13
I use both android assemblies.
The result is the same.
I use the wiringPi from your github, but I not install griomem.
The latest android includes - <10. Implement /dev/gpiomem for Android. DEVMOD=0666>

gpio readall show:
http://joxi.ru/Y2Llj6VCnNKnM2
Reply
#14
I need to install newest version and test with it. Please be patient, I think I have time to test coming Christmas days.
Reply
#15
Thanks, i will look forward to.
Reply
#16
Hi ankir33,

I found that the revision string in cpuinfo was changed to '00c0'. So wiringPi does check this and it is unknown and therefor put the model to Pi A. Need to add one line in the wiringPi.c into 'void piBoardId':
Code:
else if (strcmp (c, "00c0") == 0) { *model = PI_MODEL_TB ; *rev = PI_VERSION_1_2 ; *mem = 3 ; *maker = PI_MAKER_ASUS    ; }

Than it should work. Happy coding.
Reply
#17
(12-26-2017, 10:41 AM)lobo Wrote: Hi ankir33,

I found that the revision string in cpuinfo was changed to '00c0'. So wiringPi does check this and it is unknown and therefor put the model to Pi A. Need to add one line in the wiringPi.c into 'void piBoardId':
Code:
else if (strcmp (c, "00c0") == 0) { *model = PI_MODEL_TB ; *rev = PI_VERSION_1_2 ; *mem = 3 ; *maker = PI_MAKER_ASUS    ; }

Than it should work. Happy coding.

Thank you so much
Now "gpio readall" shows 27 and 28 pins (i2c)

What shows you a "gpio i2cdetect -y 1"?
It does not work for me.
Reply
#18
(12-26-2017, 01:38 PM)ankir33 Wrote:
(12-26-2017, 10:41 AM)lobo Wrote: Hi ankir33,

I found that the revision string in cpuinfo was changed to '00c0'. So wiringPi does check this and it is unknown and therefor put the model to Pi A. Need to add one line in the wiringPi.c into 'void piBoardId':
Code:
else if (strcmp (c, "00c0") == 0) { *model = PI_MODEL_TB ; *rev = PI_VERSION_1_2 ; *mem = 3 ; *maker = PI_MAKER_ASUS    ; }

Than it should work. Happy coding.

Thank you so much
Now "gpio readall" shows 27 and 28 pins (i2c)

What shows you a "gpio i2cdetect -y 1"?
It does not work for me.

i2cdetect is an external utility. The gpio utility can't find it on Android system. You would need to port the i2c tools to Android if you need them.
Btw. I never checked if the i2c interface is working with wiringPi. Please report back if it is working.
And as I see in wiringPiI2C.c you would need to use MiarmI2CSetup(4, devid) to access the i2c-4 bus.
Reply
#19
(12-26-2017, 10:41 AM)lobo Wrote: Hi ankir33,

I found that the revision string in cpuinfo was changed to '00c0'. So wiringPi does check this and it is unknown and therefor put the model to Pi A. Need to add one line in the wiringPi.c into 'void piBoardId':
Code:
else if (strcmp (c, "00c0") == 0) { *model = PI_MODEL_TB ; *rev = PI_VERSION_1_2 ; *mem = 3 ; *maker = PI_MAKER_ASUS ; }

Than it should work. Happy coding.

Hi lobo,
I appreciate the updated instructions, I also was able to build the wiringPi libs but the TB was detected as a RPI model A. But once I recompiled with this change it was correctly detected as a TB and would correctly show all the GPIO pins.
 
However, I still can only use gpio as root. I did rebuild the kernel with the changes as in github.com/joerg65/gpiomem_tinkerboard
I didn't quite understand how to use the rkflashtool, so I followed the flashing procedure in the wiki (tinkerboarding.co.uk/wiki/index.php?title=Software#Android_6.0.1_kernel)
Code:
Flash image:
Prepare one sdcard which has the full Android image inside.
then insert the sdcard into a linux based OS, and suppose the block device of the sdcard is /dev/sdx
$ sudo dd if=./resource.img of=/dev/sdx seek=32768
$ sudo dd if=./kernel.img of=/dev/sdx seek=65536
but still can only run gpio as root.

Is that flashing procedure the equivilant of using the rkflashtool, or is using the rkflashtool the only way? If so, can you give some more detailed instructions on using it?

Thanks for the great work,
Aaron
Reply
#20
Photo 
Hi Aaron, gpiomem driver should be there as Asus has implemented it 8 months ago.
Check, if you have /dev/gpiomem.
BTW, it doesn't matter how you flash, it should result into the same.
To use rkflashtool, disconnect everything from TB and connect a usb cable to the otg port, but before bridge the jumper (or solder points) of volume+ header (beside the hdmi connector). Then the TB should boot into bootloader. If you have a serial adapter connected to the debug port you can check this.
Code:
#Boot ver: 0000-00-00#2.30
empty serial no.
normal boot.
checkKey
vbus = 1
rockusb key pressed.
Then with rkflashtool:
Code:
./rkflashtool v
rkflashtool: info: rkflashtool v5.2
rkflashtool: info: Detected RK3288...
rkflashtool: info: interface claimed
rkflashtool: info: chip version: 320A-2014.08.13-V200
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)