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:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Google Play Store ON clean install TinkerOS_Android 7 Nougat V14.1.2.50
#21
Has anyone tried to use the Android TV stuff (ie: services, store) instead of the standard Android stuff? I'm looking to use the current Android 7.1 build as a basis for making my own Android TV setup.
Reply
#22
(10-20-2018, 05:05 PM)AngryManMLS Wrote: Has anyone tried to use the Android TV stuff (ie: services, store) instead of the standard Android stuff? I'm looking to use the current Android 7.1 build as a basis for making my own Android TV setup.

hi AngryManMLS,
that would be nice.. ;-]..
but I think ASUS see the tinker board.. more of a development board... ]]]....
its security is wide open.. 
I tried the TVLauncher from the Play store... with TinkerOS_Android 7 Nougat V14.1.2.50...
but.. went back to default Launcher3 as I don't have Air Mouse or touch screen setup... yet ]]]]....

found this link.. https://tinkerboarding.co.uk/forum/thread-347.html
but looks like it needs root.. [.. on TinkerOS_Android 7 Nougat V14.1.2.50 no joy yet...
only adb root shell.. and termux root shell... SuperSU APP not working....
well... you can install SuperSU... but just don't restart the tinker board ]]]]]]].............

----------------------
hope it helps,
k.
Reply
#23
GPIO, Tinker Board & the world… continue from post[19]

GPIO (general purpose input/output) pins along the top edge of the board...
https://tinkerboarding.co.uk/wiki/index.php/GPIO

following Pi GPIO
A powerful feature of the Asus Tinker Board.. is the row of GPIO (general-purpose input/output) pins along the top edge of the board. 
A 40-pin GPIO header.. Any of the GPIO pins can be designated (in software) as an input or output pin and used for a wide range of purposes.

Voltages
Two 5V pins and two 3V3 pins are present on the board, as well as a number of ground pins (0V), which are un-configurable. 
The remaining pins are all general purpose 3V3 pins, meaning outputs are set to 3V3 and inputs are 3V3-tolerant.

Outputs
A GPIO pin designated as an output pin can be set to high (3V3) or low (0V).

Inputs
A GPIO pin designated as an input pin can be read as high (3V3) or low (0V). 
This is made easier with the use of internal pull-up or pull-down resistors. 
Pins GPIO2 - [ASUS 252] and GPIO3 [ASUS 253] have fixed pull-up resistors,
but for other pins this can be configured in software.

before I get a breadboard, resistors, capacitors, LEDs and diodes to connect to the tinker boards GPIOs..
plug in Pibrella – The easiest way to play with electronics on your tinker board… ;-]...

[Image: iGBduRl.png]
More
As well as simple input and output devices, 
the GPIO pins can be used with a variety of alternative functions, 
some are available on all pins, others on specific pins.

PWM (pulse-width modulation)  (@/sys/class/pwm/pwmchip0)
Software PWM available on all pins.... ??????
Hardware PWM available on GPIO12 [ASUS 239], GPIO13 [ASUS 238], GPIO18 [ASUS 184], GPIO19 [ASUS 185]

SPI  (@/sys/bus/spi/devices)
SPI0: MOSI (GPIO10) [ASUS 257]; MISO (GPIO9) [ASUS 256]; SCLK (GPIO11) [ASUS 254]; CE0 (GPIO8) [ASUS 255], CE1 (GPIO7) [ASUS 251]
(spi2.0 -> ../../../devices/platform/ff130000.spi/spi_master/spi2/spi2.0/)

SPI1: MOSI (GPIO20) [ASUS 187]; MISO (GPIO19)[ASUS 185]; SCLK (GPIO21) [ASUS 188]; CE0 (GPIO18)[ASUS 184]; CE1 (GPIO17)[ASUS 164]; CE2 (GPIO16) [ASUS 223]
(spi2.1 -> ../../../devices/platform/ff130000.spi/spi_master/spi2/spi2.1/)

I2C
Data: (GPIO2) [ASUS 252]; Clock (GPIO3) [ASUS 253]

EEPROM Data: (GPIO0) [ASUS 233]; EEPROM Clock (GPIO1) [ASUS 234] ????

Serial
TX (GPIO14) [ASUS 161]; RX (GPIO15) [ASUS 160]

so.. two rows of GPIO pins, which are connections between the tinker board, and the real world...

Output pins are like switches that the tinker board can turn on or off (like turning on/off a LED light)... 
But it can also send a signal to another device...

Input pins are like switches that you can turn on or off from the outside world (like a on/off light switch)...
But it can also be a data from a sensor, or a signal from another device...

That means that you can interact with the real world, 
and control devices and electronics using the tinker board and its GPIO pins..;-]...

"A journey of a thousand miles begins with a single step".. so just get one of the lights to turn on/off ]]].......

following.. GPIO API.. Shell
GPIO can be used direct from the shell: 
to turn the Pibrella's Green light on / off...  
Code:
echo 17 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio17/direction
echo 0 > /sys/class/gpio/gpio17/value
echo 1 > /sys/class/gpio/gpio17/value
echo 0 > /sys/class/gpio/gpio17/value
echo in > /sys/class/gpio/gpio17/direction
cat /sys/class/gpio/gpio17/value
echo 17 > /sys/class/gpio/unexport
Note.. you can do this from adb Android root shell or.. Termux tsu shell... 
could not get echo command to work with tsudo.. 
(need to read more on android permission & chcon... maybe [[[...)

also remember.. as SUPERSU App is not installed... 
you will need pc/mac/vm.. on same LAN as tinker board..
to ssh into and then adb back into tinker board to run.. 
Code:
su --daemon
..seems you don't need to add "&" at the end for su to run as a daemon ;-]...

In addition the on board LEDs are at:
GPIO.ASUS
----------------------------------------------------------------------------------------------------
PWR_LED 3         # /sys/devices/platform/gpio-leds/leds/pwr-led
ACT_LED 48        # /sys/devices/platform/gpio-leds/leds/act-led
LED1_LED 49      # /sys/devices/platform/gpio-leds/leds/led1-led
----------------------------------------------------------------------------------------------------
have not found Ethernet LEDs yet.. ]]]]]...........

recap.. got tinker board.. installed TinkerOS_Android 7 Nougat with working play store.. 
installed and setup termux with ssh server.. and got root shell.. 
connected Pibrella.. and got green LED to turn on and off... 
now.. what ?... 

well... go & read up on coding / programming ;-]...... tbc...
-------------------
hope it helps,
k.
Reply
#24
Termux on TinkerOS Android 7 Nougat Controlling GPIO Pins from Bash Scripts...

following Simon Prickett : Controlling Raspberry Pi GPIO Pins from Bash Scripts: Traffic Lights


Accessing the GPIO Pins from a Bash Script
Without adding further dependencies, Bash scripts can access and control the tinker board's GPIO pins using sysfs. 
This presents as a set of filesystem paths which can be manipulated to configure individual pins 
as inputs or outputs and to set and read their values. 

On the tinker board, these paths look like
Code:
/sys/class/gpio/gpio<pin_number>

and each has a /direction and /value, for example for GPIO 17:
Code:
/sys/class/gpio/gpio17/direction
/sys/class/gpio/gpio17/value
the direction and value can be set by writing values to these “paths” as the root...

The pin numbering scheme used by sysfs is the ASUS GPIO one...
so.. you will have to modify the original PIN assignment in trafficlights.sh for the three LEDs..
Code:
..
# Assign names to GPIO pin numbers for each light
RED=166
YELLOW=164
GREEN=17
..

create and change to pibrella folder under code in home..
Code:
mkdir -p ~/code/pibrella
cd ~/code/pibrella

create file with > nano trafficlights.sh
Code:
#!/data/data/com.termux/files/usr/bin/bash

# Common path for all GPIO access
BASE_GPIO_PATH=/sys/class/gpio

# Assign names to GPIO pin numbers for each light
RED=166
YELLOW=164
GREEN=17

# Assign names to states
ON="1"
OFF="0"

# Utility function to export a pin if not already exported
exportPin()
{
  if [ ! -e $BASE_GPIO_PATH/gpio$1 ]; then
    echo "$1" > $BASE_GPIO_PATH/export
  fi
}

# Utility function to unexport a pin to clean up at exit
unexportPin()
{
  if [ -e $BASE_GPIO_PATH/gpio$1 ]; then
    echo "$1" > $BASE_GPIO_PATH/unexport
  fi
}

# Utility function to set a pin as an output
setOutput()
{
  echo "out" > $BASE_GPIO_PATH/gpio$1/direction
}

# Utility function to change state of a light
setLightState()
{
  echo $2 > $BASE_GPIO_PATH/gpio$1/value
}

# Utility function to turn all lights off
allLightsOff()
{
  setLightState $RED $OFF
  setLightState $YELLOW $OFF
  setLightState $GREEN $OFF
}

# Ctrl-C handler for clean shutdown
shutdown()
{
  allLightsOff
  # Unexport pins to clean up on exit..
  unexportPin $RED
  unexportPin $YELLOW
  unexportPin $GREEN
  exit 0
}

trap shutdown SIGINT

# Export pins so that we can use them
exportPin $RED
exportPin $YELLOW
exportPin $GREEN

# Set pins as outputs
setOutput $RED
setOutput $YELLOW
setOutput $GREEN

# Turn lights off to begin
allLightsOff

# Loop forever until user presses Ctrl-C
while [ 1 ]
do
  # Red
  setLightState $RED $ON
  sleep 3

  # Red and Yellow
  setLightState $YELLOW $ON
  sleep 1

  # Green
  setLightState $RED $OFF
  setLightState $YELLOW $OFF
  setLightState $GREEN $ON
  sleep 5

  # Yellow
  setLightState $GREEN $OFF
  setLightState $YELLOW $ON
  sleep 2

  # Yellow off
  setLightState $YELLOW $OFF
done
note.. the beginning of bash script file must be #!/data/data/com.termux/files/usr/bin/bash 
for termux and not #!/bin/bash....

if you ever try to run a bash script and it fails with command not found.. etc.. try to fix with
Code:
termux-fix-shebang trafficlights.sh

next make file executable ..
Code:
chmod 700 trafficlights.sh

then run trafficlights.sh as root..
Code:
tsudo ./trafficlights.sh
note.. Ctrl-C to exit........

interesting.. that tsudo now works with bash shell script.. 
when I first tired to make green led blink with for loop and echo commands.. 
tsudo...  failed to run...??? and I had to use tsu to drop into root shell then run..
Code:
for i in {1..5}; do echo 1 > /sys/class/gpio/gpio17/value; sleep 0.1; echo 0 > /sys/class/gpio/gpio17/value; sleep 0.1; done

which works for bash shell but not sh (The Bourne shell or the POSIX sh language specification...) ;-]....

for that I had to use while loop..
Code:
i=1; while [ "$i" -le 100 ]; do  echo 1 > /sys/class/gpio/gpio17/value; sleep 0.1; echo 0 > /sys/class/gpio/gpio17/value; sleep 0.1; echo "Flash $i"; i=$(( $i + 1 )); done

so. should be able to use  tsudo if you make a blink function.. ]]]]......... 
read up on.. Ryans Tutorials: What is a Bash Script?

----------------------;-]..
hope it helps,
k.

next> continue reading up on coding.. Apache.. PhP.. PhP-Apache.. WebSocket.. Node.js.. node-RED & wiringPi.... lots of fun...]].....
Reply
#25
Termux on TinkerOS Android 7 Nougat gpioTB function utility to control tinker board's GPIO pins using sysfs...

following Luke Sandell: Raspberry Pi GPIO via the Shell

create file.. under ~/code/pibrella/ > nano gpioTB
Code:
#!/data/data/com.termux/files/usr/bin/bash

# Utility to control the GPIO pins of the tinker board
# Can be called as a script or sourced so that the gpioTB
# function can be called directly

function gpioTB()
{
   local verb=$1
   local pin=$2
   local value=$3

   local pins=($GPIO_PINS)
   #local pins=(256 251 255 257 167 162 163 171 233 234 165 168 239 238 185 233 234 187 188)
   if [[ "$pin" -lt ${#pins[@]} ]]; then
       local pin=${pins[$pin]}
   fi

   local gpio_path=/sys/class/gpio
   local pin_path=$gpio_path/gpio$pin

   case $verb in
       read)
           cat $pin_path/value
       ;;

       write)
           echo $value > $pin_path/value
       ;;

       mode)
           if [ ! -e $pin_path ]; then
               echo $pin > $gpio_path/export
           fi
           echo $value > $pin_path/direction
       ;;

       state)
           if [ -e $pin_path ]; then
               local dir=$(cat $pin_path/direction)
               local val=$(cat $pin_path/value)
               echo "$dir $val"
           fi
       ;;

       clean)
           if [ -e $pin_path ]; then
               echo $pin > $gpio_path/unexport
           fi
       ;;

       *)
           echo "Control the GPIO pins of the tinker board"
           echo "Usage: $0 mode [pin] [in|out]"
           echo "       $0 read [pin]"
           echo "       $0 write [pin] [0|1]"
           echo "       $0 state [pin]"
           echo "       $0 clean [pin]"
           echo "If GPIO_PINS is an environment variable containing"
           echo "a space-delimited list of integers, then up to 17"
           echo "logical pins (0-16) will map to the physical pins"
           echo "specified in the list."
       ;;
   esac
}

# Just invoke our function if the script is called directly
if [ "$BASH_SOURCE" == "$0" ]; then
   gpioTB $@
fi
now.. you have Utility to control the GPIO pins of the tinker board.. 
Can be called as a script or sourced so that the gpioTB function can be called directly..

make copy of gpioTB to ~/kPATH/bin..
Code:
cp -p gpioTB ~/kPATH/bin
..remember to do this every time you modify this file ;-]...

..now some more functions built with gpioTB...

create file.. > nano  bincount
Code:
#!/data/data/com.termux/files/usr/bin/bash
# Include gpio script to access the gpio function directly
source gpioTB
#
# Binary LED counter for Pibrella Outputs E to H
# connected to tinker board...

# GPIO_PINS='0 1 4 7 8 9 10 11 14 15 17 18 21 22 23 24 25'
GPIO_PINS='167 162 163 171'
#pins=17
pins=4
delay=0.25

# Initialize pins
for ((pin = 0; pin < pins; pin++)); do
   gpioTB mode $pin out
   gpioTB write $pin 0
done

# switch all LEDs off and clean up Pins...
shutdown()
{
for ((pin = 0; pin < pins; pin++)); do
   gpioTB write $pin 0
   gpioTB clean $pin
done
exit 0
}

trap shutdown SIGINT

# Loop until CTRL-C is pressed
while true; do
   for ((value = 0; value < 2 ** pins; value++)); do
       remainder=$value
       for((pin = pins - 1; pin >= 0; pin--)); do
           power=$((2 ** pin))
           digit=$((remainder / power))
           remainder=$((remainder % power))
           gpioTB write $pin $digit
       done
       sleep $delay
   done
done
.. this demo function uses Pibrella Outputs E to H to demonstrate a four bit binary counter ;-]...
simply run as root.. from ~/code/pibrella/ 
Code:
tsudo ./bincount

next.. create file > nano chaser
Code:
#!/data/data/com.termux/files/usr/bin/bash
# Include gpio script to access the gpio function directly
source gpioTB
#
# LED chaser for Pibrella Outputs E to H
# connected to tinker board...

#GPIO_PINS='0 1 4 7 8 9 10 11 14 15 17 18 21 22 23 24 25'
GPIO_PINS='167 162 163 171'
pins=4
delay=0.025

# Initialize pins
for ((pin = 0; pin < pins; pin++)); do
   gpioTB mode $pin out
done

# switch all LEDs off and clean up Pins...
shutdown()
{
for ((pin = 0; pin < pins; pin++)); do
   gpioTB write $pin 0
   gpioTB clean $pin
done
exit 0
}

trap shutdown SIGINT

pin=1
step=1

# Loop until CTRL-C is pressed
while true; do
   gpioTB write $pin 1
   sleep $delay
   gpioTB write $pin 0
   if ((pin == 0 || pin == pins - 1)); then
       step=$((-step))
   fi
   pin=$((pin + step))
done
.. this demo function uses Pibrella Outputs E to H to demonstrate a four bit bouncer ]]]].....
simply run as root.. from ~/code/pibrella/ 
Code:
tsudo ./chaser

next.. create file > nano blinkLED
Code:
#!/data/data/com.termux/files/usr/bin/bash
# Include gpio script to access the gpio function directly
source gpioTB
#
# Utility to blinkLED connected to pins of the tinker board
# Can be called as a script or sourced so that the blinkLED
# function can be called directly

function blinkLED()
{
    local pin=$1
    local onTime=$2
     if [ -z "$onTime" ];  # test if onTime is empty...
     then
      local onTime="1"     # set default 1 sec..
     fi
    local offTime=$3
     if [ -z "$offTime" ]; # test if offTime is empty...
     then
      local offTime="1"    # set default 1 sec..
     fi
    #
    local ON="1"
    local OFF="0"
    #
    # Utility function to turn all lights off
    allLightsOff()
     {
      gpioTB write $pin $OFF
     }
    #
    # Ctrl-C handler for clean shutdown
   shutdown()
    {
     allLightsOff
     gpioTB clean $pin
     exit 0
    }
   #
   trap shutdown SIGINT
   #
   #
   gpioTB mode $pin out
   while true;
    do
     gpioTB write $pin $ON
     sleep $onTime
     gpioTB write $pin $OFF
     sleep $offTime
    done
}

# Just invoke our function if the script is called directly
if [ "$BASH_SOURCE" == "$0" ]; then
    blinkLED $@
fi
.. when using this blinkLED funcition.. you have to pass it the PIN#, onTime, offTime..
.. if noTime given.. then default time of 1 second... ;-]..
to flash green LED @ 1 Hz.. run as root...
Code:
tsudo ./blinkLED 17 1 1
or
tsudo ./blinkLED 17

create file > nano buzzer
Code:
#!/data/data/com.termux/files/usr/bin/bash
# Include gpio script to access the gpio function directly
source gpioTB
#
# Utility to play buzzer tick sound connected to tinker board
# Can be called as a script or sourced so that the buzzer
# function can be called directly

function buzzer()
{
    local pin=$1
    local onTime=$2
     if [ -z "$onTime" ];  # test if onTime is empty...
     then
      local onTime="1"     # set default 1 sec..
     fi
    local offTime=$3
     if [ -z "$offTime" ]; # test if offTime is empty...
     then
      local offTime="1"    # set default 1 sec..
     fi
    #
    local ON="1"
    local OFF="0"
    #
    # Utility function to turn all lights off
    allLightsOff()
     {
      gpioTB write $pin $OFF
     }
    #
    # Ctrl-C handler for clean shutdown
   shutdown()
    {
     allLightsOff
     gpioTB clean $pin
     exit 0
    }
   #
   trap shutdown SIGINT
   #
   #
   gpioTB mode $pin out
   while true;
    do
     gpioTB write $pin $ON
     sleep $onTime
     gpioTB write $pin $OFF
     sleep $offTime
    done
}

# Just invoke our function if the script is called directly
if [ "$BASH_SOURCE" == "$0" ]; then
    buzzer $@
fi
.. this is essentially the same as the blinkLED function... to play 1 Hz buzz Tick sound .. 
run as root...
Code:
tsudo ./buzzer 184 1 1
or
tsudo ./buzzer 184

so... that's all of the Pibrella Outputs now working under SYSfs...

but for the Inputs..... hmmmm....

it's a real head-banger [[[[..... trying to get any input pin / button working under TinkerOS_Android 7 Nougat V14.1.2.50...
Pibrella's Input button @ pin 254... value always reads High... "1"...   no matter if button is pressed or not.. 
you can get value to "0" by setting active_low True / "1".. using
Code:
echo 1 > /sys/class/gpio/gpio$pin/active_low
 
..even tried to set edge to both.. Sysfs interface and interrupt.. to enable  interrupt on falling edge & on the rising edge.. 
Via sysfs interface, you can request a change of state interrupt processor...
Code:
echo "both" > /sys/class/gpio/gpio$pin/edge
then.... pressing like mad]]]]]... 

& checking.. > cat /proc/interrupts
Code:
bash:4.4][root]@~/code/pibrella:# cat /proc/interrupts 
           CPU0       CPU1       CPU2       CPU3       
 16:          0          0          0          0       GIC  29 Edge      arch_timer
 17:  120557488  156226735  148947449   17680391       GIC  30 Edge      arch_timer
 20:          0          0          0          0       GIC  98 Level     rk_timer
 25:          0          0          0          0       GIC  34 Level     ff250000.dma-controller
 26:          0          0          0          0       GIC  35 Level     ff250000.dma-controller
 27:       1089          0          0          0       GIC  32 Level     ff600000.dma-controller
 28:          0          0          0          0       GIC  33 Level     ff600000.dma-controller
 29:    4341646          0          0          0       GIC  64 Level     dw-mci
 30:       2448          0          0          0       GIC  65 Level     dw-mci
 31:          4          0          0          0       GIC  67 Level     dw-mci
 32:     528811          0          0          0       GIC  68 Level     ff100000.saradc
 34:    6252390          0          0          0       GIC  92 Level     ff650000.i2c
 35:          3          0          0          0       GIC  94 Level     ff140000.i2c
 36:       1056          0          0          0       GIC  95 Level     ff150000.i2c
 37:          9          0          0          0       GIC  96 Level     ff160000.i2c
 38:      25704          0          0          0       GIC  87 Level     serial
 43:       7011          0          0          0       GIC  69 Level     rockchip_thermal
 44:     367990          0          0          0       GIC  59 Level     eth0
 45:          0          0          0          0       GIC  60 Level     eth0
 46:        309          0          0          0       GIC  56 Level     ehci_hcd:usb2
 48:  470537364          0          0          0       GIC  57 Level     ff540000.usb, dwc2_hsotg:usb1
 49:          8          0          0          0       GIC  55 Level     dwc_otg, dwc_otg_pcd, dwc_otg_hcd:usb3
 50:        351          0          0          0       GIC  93 Level     ff660000.i2c
 53:          0          0          0          0       GIC  49 Level     ff900000.iep
 54:          0          0          0          0       GIC  46 Level     MarvinIrq
 55:          0          0          0          0       GIC  50 Level     rga
 56:          0          0          0          0       GIC  47 Level     ff930000.vop
 57:          0          0          0          0       GIC  48 Level     ff940000.vop
 59:          0          0          0          0       GIC 135 Level     ff980000.hdmi, dw-hdmi-cec
 60:          0          0          0          0       GIC  41 Level     ff9a0000.vpu-service
 61:          0          0          0          0       GIC  42 Level     ff9a0000.vpu-service
 63:          0          0          0          0       GIC  44 Level     ff9c0000.hevc-service
 65:    6983865          0          0          0       GIC  38 Level     ffa30000.gpu
 66:          1          0          0          0       GIC  39 Level     ffa30000.gpu
 67:    7137095          0          0          0       GIC  40 Level     ffa30000.gpu
 82:          0          0          0          0     gpio0   4 Level     rk808
 83:          0          0          0          0     gpio0   5 Edge      power
237:          1          0          0          0     gpio4  31 Edge      bt_default_wake_host_irq
306:          0          0          0          0     gpio7   4 Edge      Headphone detection
340:          0          0          0          0     gpio8   6 Edge      gpiolib
366:          0          0          0          0       GIC 187 Edge      debug-signal
367:          0          0          0          0       GIC 125 Level     otg_id
368:          0          0          0          0       GIC 126 Level     otg_bvalid
IPI0:          0          0          0          0  CPU wakeup interrupts
IPI1:          0          0          0          0  Timer broadcast interrupts
IPI2:   35499388   37782435   35985141   25453958  Rescheduling interrupts
IPI3:       6089       6853         30         19  Function call interrupts
IPI4:          0          0          0          0  CPU stop interrupts
IPI5:          0          0          0          0  IRQ work interrupts
IPI6:          0          0          0          0  completion interrupts
Err:          0
bash:4.4][root]@~/code/pibrella:# 

& watch -n 1 cat /sys/kernel/debug/gpio
Code:
Every 1s: cat /sys/kernel/debug/gpio                                                                                                                           2018-10-27 12:52:01

GPIOs 0-23, platform/pinctrl, gpio0:
gpio-3   (                    |?                   ) out hi    
gpio-5   (                    |power               ) in  hi    
gpio-6   (                    |vcc_phy             ) out hi    
gpio-12  (                    |otg_drv_gpio        ) out lo    
gpio-14  (                    |vcc_host            ) out hi    

GPIOs 24-55, platform/pinctrl, gpio1:
gpio-48  (                    |?                   ) out lo    
gpio-49  (                    |?                   ) out lo    

GPIOs 56-87, platform/pinctrl, gpio2:

GPIOs 88-119, platform/pinctrl, gpio3:

GPIOs 120-151, platform/pinctrl, gpio4:
gpio-127 (                    |mdio-reset          ) out hi    
gpio-139 (                    |bt_default_rts      ) out lo    
gpio-146 (                    |bt_default_wake     ) out hi    
gpio-147 (                    |reset               ) out hi    
gpio-148 (                    |reset               ) out hi    
gpio-149 (                    |bt_default_reset    ) out hi    
gpio-151 (                    |bt_default_wake_host) out hi    

GPIOs 152-183, platform/pinctrl, gpio5:

GPIOs 184-215, platform/pinctrl, gpio6:

GPIOs 216-247, platform/pinctrl, gpio7:
gpio-218 (                    |enable              ) out hi    
gpio-220 (                    |Headphone detection ) in  hi    
gpio-227 (                    |vcc_sd              ) out hi    
gpio-229 (                    |camsys_gpio         ) out hi    

GPIOs 248-263, platform/pinctrl, gpio8:
gpio-254 (                    |sysfs               ) in  hi IRQ
^C
bash:4.4][root]@~/code/pibrella:#

so... I've almost given up on finding any inputs on the Pibrella that will work with the tinker board.. 
have to find a way to disable  spi / i2c / 1wire.. ??? on a raspberry pi there is config menu to do this ]]]...
but on tinker board.. hmmmm... Pibrella  button is on PIN 23 [ASUS 254].. input A  on PIN 21 [ASUS 256] , 
B on PIN 26 [ASUS 251], C on PIN 24 [ASUS 255], D on PIN 19 [ASUS 257]... tbc....

tinkering on ;-].... got  Solderless breadboard.. Tactile pushbutton switch ..several jumper wires and 
went on a hunt for some inputs... luckily.. the first 2 free pins next to the Pibrella.. 
were PIN 33 [ASUS 238] & 34 [Ground]... perfect ;-]]]]]...... 
connected to pin 1 and 2 of the Tactile pushbutton switch on the Solderless breadboard...

.. then create file.. > nano button
Code:
#!/data/data/com.termux/files/usr/bin/bash
# Include gpio script to access the gpio function directly
source gpioTB
#
# turns ON.. Pibrella's Green LED when switch connected
# to PIN 33 [ASUS 238] of tinker board is pressed &
# scrolls message up the screen... Pressed [n] Time...
#
pinLED="17"
pinBUTT="238"
#pinBUTT="254"
delay="0.25"
#
ON="1"
OFF="0"
#
# Initialize pins
gpioTB mode $pinLED out
gpioTB mode $pinBUTT in
#
# Ctrl-C handler for clean shutdown
shutdown()
{
  buttonLED=$OFF
  gpioTB write $pinLED $buttonLED
  # Unexport pins to clean up on exit..
  gpioTB clean $pinLED
  gpioTB clean $pinBUTT
  exit 0
}
#trap shutdown SIGINT
#
#
buttonLED=$OFF
# start loop until Ctrl-C.....
counter="0"
while true;
do
   trap 'shutdown' exit 0
   #trap 'echo bye...' exit 0
   buttonPRESS=`gpioTB read $pinBUTT`
    if [ $buttonPRESS -eq 0 ]; then
      counter=$((counter + 1))
      echo "maybe button is pressed [$counter] Time...;-]..."
       buttonLED=$ON # LED ON
      gpioTB write $pinLED $buttonLED
    fi
       sleep $delay
       buttonLED=$OFF # LED OFF
      gpioTB write $pinLED $buttonLED
done
exit 0
run as root...
Code:
tsudo ./button
sooo. when you run the button function.. all you see on screen.. is a blinking cursor]]]... 
press the Tactile pushbutton switch & the green LED on the Pibrella comes ON ;-]......
with message on screen.. 
Code:
maybe button is pressed [1] Time...;-]...
maybe button is pressed [2] Time...;-]...
maybe button is pressed [3] Time...;-]...
maybe button is pressed [4] Time...;-]...
[_]
..note.. Ctrl-C to Exit.......

well... its a start... now need to get  wiringPi for Android setup.. 
maybe will have more control over tinker board's  GPIO.. 
MANY, Many Thanks to lobo.. has a very helpful write up.. wiringPi for Android..

-------------------------
hope it helps,
k.

next> Termux on TinkerOS Android 7 Nougat with WiringPi for Android setup... tbc.. ;-]..
Reply
#26
Great!
My heartfelt praise for your information work.
Light blue words might be a link. Have you try to click on them? Big Grin
Reply
#27
Termux on TinkerOS Android 7 Nougat with WiringPi for Android setup

following lobo: wiringPi for Android

wiringPi TinkerBoard

wiringPi for TinkerBoard ported to Android.

To compile the library, execute from the jni folder the command:
Code:
"/path/to/your/SDK/ndk-bundle/ndk-build -B"

sooo... it took me some time to figure out that I had to download 
the android tool nkd-build ]]].....   as I'm using a KDE neon 18.04 VM..
download... android-ndk-r18b-linux-x86_64.zip and exteract to ~/temp/android-ndk-r18b/

then create symbolic link to folder in home folder.. 
Code:
ln -s ~/temp/android-ndk-r18b ~/android-ndk
.. this way.. when updating.. don't break any scripts ;-]...

then download the wiringTinker_Android from github.. 
and extract to .. ~/temp/wiringTinker_Android-master

before you compile.. have to modify file > nano ~/temp/wiringTinker_Android-master/jni/Application.mk 
Code:
NDK_TOOLCHAIN_VERSION=clang
#APP_ABI := armeabi
APP_ABI := armeabi-v7a
#APP_PLATFORM := android-21
APP_PLATFORM := android-24

.. and also this file.. > nano +366 ~/temp/wiringTinker_Android-master/jni/gpio/readall.c
.. go to line 366... ;-].. & change the line.
Code:
..
 else if ((model == PI_MODEL_BP) || (model == PI_MODEL_AP) || (model == PI_MODEL_2) || (model == PI_MODEL_ZERO)||(PI_MODEL_TB))
to...
 else if ((model == PI_MODEL_BP) || (model == PI_MODEL_AP) || (model == PI_MODEL_2) || (model == PI_MODEL_ZERO) || (model == PI_MODEL_TB))
..

.. also this file.. > nano +38 ~/temp/android-ndk-r18b/sysroot/usr/include/sys/user.h
.. go to line 38... ;-].. & change the line
Code:
..
#define PAGE_SIZE 4096
to...
#define PAGE_SIZE (4*1024)
..
so that it matches that of ~/temp/wiringTinker_Android-master/jni/wiringPi/wiringPi.c .. line 151 ;-]....

and finally from post [16] of wiringPi for Android thread.. > nano +932 temp/wiringTinker_Android-master/jni/wiringPi/wiringPi.c
.. go to line 932... ;-].. & add the line.
Code:
..
               else if (strcmp (c, "00c0") == 0) { *model = PI_MODEL_TB ; *rev = PI_VERSION_1_2 ; *mem = 3 ; *maker = PI_MAKER_ASUS    ; }
..

now.. To compile the library, execute from the jni folder the command:
Code:
cd ~/temp/wiringTinker_Android-master/jni
~/android-ndk/ndk-build -B
 
with no warnings ;-]....
Code:
k247@KDEneon184:~/temp/wiringTinker_Android-master/jni$ ~/android-ndk/ndk-build -B
[armeabi-v7a] Compile thumb  : gpio <= gpio.c
[armeabi-v7a] Compile thumb  : gpio <= readall.c
[armeabi-v7a] Compile thumb  : gpio <= pins.c
[armeabi-v7a] Compile thumb  : wiringPi <= wiringSerial.c
[armeabi-v7a] Compile thumb  : wiringPi <= wiringPi.c
[armeabi-v7a] Compile thumb  : wiringPi <= wiringTB.c
[armeabi-v7a] Compile thumb  : wiringPi <= wiringShift.c
[armeabi-v7a] Compile thumb  : wiringPi <= piHiPri.c
[armeabi-v7a] Compile thumb  : wiringPi <= piThread.c
[armeabi-v7a] Compile thumb  : wiringPi <= wiringPiSPI.c
[armeabi-v7a] Compile thumb  : wiringPi <= wiringPiI2C.c
[armeabi-v7a] Compile thumb  : wiringPi <= softPwm.c
[armeabi-v7a] Compile thumb  : wiringPi <= softTone.c
[armeabi-v7a] Compile thumb  : wiringPi <= mcp23008.c
[armeabi-v7a] Compile thumb  : wiringPi <= mcp23016.c
[armeabi-v7a] Compile thumb  : wiringPi <= mcp23017.c
[armeabi-v7a] Compile thumb  : wiringPi <= mcp23s08.c
[armeabi-v7a] Compile thumb  : wiringPi <= mcp23s17.c
[armeabi-v7a] Compile thumb  : wiringPi <= sr595.c
[armeabi-v7a] Compile thumb  : wiringPi <= pcf8574.c
[armeabi-v7a] Compile thumb  : wiringPi <= pcf8591.c
[armeabi-v7a] Compile thumb  : wiringPi <= mcp3002.c
[armeabi-v7a] Compile thumb  : wiringPi <= mcp3004.c
[armeabi-v7a] Compile thumb  : wiringPi <= mcp4802.c
[armeabi-v7a] Compile thumb  : wiringPi <= mcp3422.c
[armeabi-v7a] Compile thumb  : wiringPi <= max31855.c
[armeabi-v7a] Compile thumb  : wiringPi <= max5322.c
[armeabi-v7a] Compile thumb  : wiringPi <= sn3218.c
[armeabi-v7a] Compile thumb  : wiringPi <= drcSerial.c
[armeabi-v7a] Compile thumb  : wiringPi <= wpiExtensions.c
[armeabi-v7a] SharedLibrary  : libwiringPi.so
[armeabi-v7a] Compile thumb  : wiringPiDev <= ds1302.c
[armeabi-v7a] Compile thumb  : wiringPiDev <= maxdetect.c
[armeabi-v7a] Compile thumb  : wiringPiDev <= piNes.c
[armeabi-v7a] Compile thumb  : wiringPiDev <= gertboard.c
[armeabi-v7a] Compile thumb  : wiringPiDev <= piFace.c
[armeabi-v7a] Compile thumb  : wiringPiDev <= lcd128x64.c
[armeabi-v7a] Compile thumb  : wiringPiDev <= lcd.c
[armeabi-v7a] Compile thumb  : wiringPiDev <= piGlow.c
[armeabi-v7a] SharedLibrary  : libwiringPiDev.so
[armeabi-v7a] Executable     : gpio
[armeabi-v7a] Install        : gpio => libs/armeabi-v7a/gpio
[armeabi-v7a] Compile thumb  : led <= led.c
[armeabi-v7a] Executable     : led
[armeabi-v7a] Install        : led => libs/armeabi-v7a/led
[armeabi-v7a] Install        : libwiringPi.so => libs/armeabi-v7a/libwiringPi.so
[armeabi-v7a] Install        : libwiringPiDev.so => libs/armeabi-v7a/libwiringPiDev.so
[armeabi-v7a] Compile thumb  : wpi_android <= wpi_android.c
[armeabi-v7a] SharedLibrary  : libwpi_android.so
[armeabi-v7a] Install        : libwpi_android.so => libs/armeabi-v7a/libwpi_android.so
k247@KDEneon184:~/temp/wiringTinker_Android-master/jni$

The libraries need to be installed to the /system/lib/ folder on the TinkerBoard and the gpio binary to the folder /system/bin/:
Code:
adb connect 192.168.1.x
adb root
adb connect 192.168.1.x
adb remount
adb push ../libs/armeabi-v7a/libwiringPi.so /system/lib/
adb push ../libs/armeabi-v7a/libwiringPiDev.so /system/lib/
adb push ../libs/armeabi-v7a/libwpi_android.so /system/lib/
adb push ../libs/armeabi-v7a/gpio /system/bin/
adb push ../libs/armeabi-v7a/led /system/bin/

now.. > adb shell.... to drop into Android root shell and check gpio is working.. ;-]...
Code:
rk3288:/ # gpio
Usage: gpio -v
      gpio -h
      gpio [-g|-1] [-x extension:params] ...
      gpio [-p] <read/write/wb> ...
      gpio <read/write/pwm/mode> ...
      gpio readall/reset
      gpio unexportall/exports
      gpio export/edge/unexport ...
      gpio pwmr <range>
      gpio pwmc <divider>
      gpio load spi/i2c
      gpio unload spi/i2c
      gpio i2cd/i2cdetect

rk3288:/ # 

..run gpio readall
Code:
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 |   IN | 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:/ #

Thank you lobo.... ;-]]]]]]......... 


now I just need to figure out how to use it... 
& if it will run from inside Termux with tsudo.....

well.. gpio readall function works.. but.. gpio read pin#.. just reads 0.. [[[...
might be caused by  Pibrella pins # shared with spi / pwm ??? 

also.. setup.. vncserver for X11 server with i3 tiling window manager,  tbc...


Termux on TinkerOS Android 7 Nougat with WiringPi setup...
hope this helps,
------------------
k.
Reply
#28
Yeah, you're welcome. Thank you also for your work. Seems, that I have to update the source on github...
Install Magisk, if you need root.
Reply
#29
(10-31-2018, 06:49 AM)lobo Wrote: Yeah, you're welcome. Thank you also for your work. Seems, that I have to update the source on github...
Install Magisk, if you need root.

Hi lobo,

will love to install root.. as I'm using Termux ]]]]... 
& I have to figure out how to flash in Linux ;-]..

it takes me a bit of time to re-read instructions over... 

again.. Many many thanks for you write ups ]]]]]...
------------------
k.
Reply
#30
https://tinkerboarding.co.uk/wiki/index....Play_Store
I did everything from guide but at last when I opened play store , it is saying that "couldn't sign in there was a problem communicating with Google servers try again latet "
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)