Outils pour utilisateurs

Outils du site


xu4

Différences

Ci-dessous, les différences entre deux révisions de la page.


xu4 [2024/02/09 17:10] (Version actuelle) – créée - modification externe 127.0.0.1
Ligne 1: Ligne 1:
 +====== ODROID-XU4  ======
 +===== pistes =====
  
 +doc en wiki : https://wiki.odroid.com/start
 +
 +Utilisée dans une installation de Dominique Leroy
 +
 +Puredata
 +{{ ::pd-l2ork-2.8.1-20190303-rev.cfef9261-armv7l.deb |}} purr compilé sur odroid XU4
 +
 +autre
 +  * https://magazine.odroid.com/wp-content/uploads/odroid-xu4-user-manual.pdf
 +  * https://obihoernchen.net/1235/odroid-xu4-with-openmediavault/
 +
 +===== Install gpio =====
 +
 +  * https://wiki.odroid.com/common/application_note/gpio/wiringpi
 +  * https://wiki.odroid.com/odroid-xu4/hardware/expansion_connectors#con_11_-_2x6_pins
 +
 +==== Partie C ====
 +
 +<code>
 +git clone https://github.com/hardkernel/wiringPi.git
 +cd wiringPi
 +apt install libtool shtool pkgconf
 +./autogen.sh
 +./configure
 +make
 +make install
 +</code>
 +
 +gpio readall -a pour vérifier
 +<code>
 +gpio readall -a
 + +------+-----+----------+------+---+----+--- Model ODROID-XU3/4 ---+----+---+------+----------+-----+------+
 + | GPIO | wPi |   Name   | Mode | V | DS | PU/PD | Physical | PU/PD | DS | V | Mode |   Name   | wPi | GPIO |
 + +------+-----+----------+------+---+----+-------+----++----+-------+----+---+------+----------+-----+------+
 +      |         3.3V |      |      |        1 || 2  |          |        | 5V                |
 +  209 |   8 | I2C1.SDA | ALT1 | 1 |  0 |   P/U |  3 || 4  |          |        | 5V                |
 +  210 |   9 | I2C1.SCL | ALT1 | 1 |  0 |   P/U |  5 || 6  |          |        | GND(0V)  |          |
 +   18 |   7 | GPIO. 18 |   IN | 0 |  0 |   P/D |  7 || 8  | DSBLD | 0  | 1 | ALT1 | UART0.TX | 15  | 172  |
 +      |      GND(0V) |      |      |        9 || 10 | DSBLD | 0  | 0 | ALT1 | UART0.RX | 16  | 171  |
 +  174 |   0 | GPIO.174 | ALT7 | 1 |  0 |   P/U | 11 || 12 | DSBLD | 0  | 0 | ALT1 | GPIO.173 | 1   | 173  |
 +   21 |   2 | GPIO. 21 |   IN | 0 |  0 |   P/D | 13 || 14 |          |        | GND(0V)  |          |
 +   22 |   3 | GPIO. 22 |   IN | 0 |  0 |   P/D | 15 || 16 | P/D   | 0  | 0 | IN   | GPIO. 19 | 4   | 19   |
 +      |         3.3V |      |      |       | 17 || 18 | P/D   | 0  | 0 | IN   | GPIO. 23 | 5   | 23   |
 +  192 |  12 |     MOSI | ALT1 | 1 |  0 |   P/U | 19 || 20 |          |        | GND(0V)  |          |
 +  191 |  13 |     MISO | ALT1 | 1 |  0 |   P/U | 21 || 22 | P/U   | 1  | 1 | IN   | GPIO. 24 | 6   | 24   |
 +  189 |  14 |     SCLK | ALT1 | 0 |  0 |   P/U | 23 || 24 | P/D   | 0  | 1 | OUT  | CE0      | 10  | 190  |
 +      |      GND(0V) |      |      |       | 25 || 26 | P/D   | 0  | 1 | OUT  | GPIO. 25 | 11  | 25   |
 +  187 |  30 | I2C5.SDA | ALT2 | 1 |  0 |   P/U | 27 || 28 | P/U   | 0  | 1 | ALT2 | I2C5.SCL | 31  | 188  |
 +   28 |  21 | GPIO. 28 |   IN | 0 |  0 |   P/D | 29 || 30 |          |        | GND(0V)  |          |
 +   30 |  22 | GPIO. 30 |   IN | 0 |  0 |   P/D | 31 || 32 | P/D   | 0  | 0 | IN   | GPIO. 29 | 26  | 29   |
 +   31 |  23 | GPIO. 31 |   IN | 0 |  0 |   P/D | 33 || 34 |          |        | GND(0V)  |          |
 +      |  24 | POWER ON |      |      |       | 35 || 36 | P/D   | 0  | 0 | IN   | GPIO. 33 | 27  | 33   |
 +      |  25 |    AIN.0 |      |      |       | 37 || 38 |          |        | 1V8      | 28  |      |
 +      |      GND(0V) |      |      |       | 39 || 40 |          |        | AIN.3    | 29  |      |
 + +------+-----+----------+------+---+----+-------+----++----+-------+----+---+------+----------+-----+------+
 + | GPIO | wPi |   Name   | Mode | V | DS | PU/PD | Physical | PU/PD | DS | V | Mode |   Name   | wPi | GPIO |
 + +------+-----+----------+------+---+----+--- Model ODROID-XU3/4 ---+----+---+------+----------+-----+------+
 +
 +</code>
 +
 +
 +==== Partie python ====
 +
 +<code>
 +apt install python python3 python-pip python3-pip
 +pip install weel
 +pip install odroid-wiringpi
 +</code>
 +dans /usr/local/lib/python2.7/dist-packages/odroid_wiringpi.py on trouve la liste des fonctions
 +
 +<code python>
 +#!/usr/bin/env python
 +# bouton sur 29,31,33 pull-down _>wPi  21,22,23
 +# contact vers 12/PWON 20,22 BOUTON 29/1.8V
 +         
 +import odroid_wiringpi as wpi
 +import time
 +                      
 +wpi.wiringPiSetup()
 +wpi.pinMode(0, 1)
 +                                   
 +while True:
 +  bt1 =  wpi.digitalRead(21)
 +  bt2 =  wpi.digitalRead(22)
 +  bt3 =  wpi.digitalRead(23)
 +  btsw =  wpi.digitalRead(1)
 +  if bt1:
 +    print("bouton 1")
 +  if bt2:
 +    print("bouton 2")
 +  if bt3:
 +    print("bouton 3")
 +
 +  time.sleep(1)
 +</code>
 +
 +===== programmation horaire =====
 +évidement il faut la petite batterie.\\
 +shutdown -P permet de rallumer avec le bouton power
 +sinon shutdown opère un power-off et le bouton est innopérant ??
 +
 +de https://wiki.odroid.com/odroid-xu4/application_note/rtc_wakeup
 +<code c>
 +hwclock -w # pour écrire l'heure
 +hwclock -r && date # pour verifier
 +
 +# rallumer 1 min apres
 +echo 0 | sudo tee /sys/class/rtc/rtc0/wakealarm
 +echo `date '+%s' -d '+ 1 minutes'` | sudo tee /sys/class/rtc/rtc0/wakealarm
 +     
 +# Check if "alarm_IRQ" appears to "yes".
 +cat /proc/driver/rtc
 +    rtc_time : 02:45:30
 +    rtc_date : 2017-09-05
 +    alrm_time : 02:46:28
 +    alrm_date : 2017-09-05
 +    alarm_IRQ : yes
 +    alrm_pending : no
 +    update IRQ enabled : no
 +    periodic IRQ enabled : no
 +    periodic IRQ frequency : 1
 +    max user IRQ frequency : 64
 +    24hr : yes
 +
 +#test
 +poweroff
 +
 +# se rallume 1 minute apres
 +</code>
 +=== programme horaire bash ===
 +<{{ ::proghoraire.tgz |}}
 +<code c>
 +#!/bin/bash
 +ALLUM_MATIN='08:00'
 +ETEIND_MATIN='09:00'
 +ALLUM_SOIR='16:00'
 +ETEIND_SOIR='22:00'
 +
 +DATE_ALLUM_MATIN=`date '+%s' -d $ALLUM_MATIN`
 +DATE_ALLUM_SOIR=`date '+%s' -d $ALLUM_SOIR`
 +DATE_ETEIND_MATIN=`date '+%s' -d $ETEIND_MATIN`
 +DATE_ETEIND_SOIR=`date '+%s' -d $ETEIND_SOIR`
 +DATEHEURE=`date '+%s'`
 +
 +echo "vérification heure"
 +hwclock -w # pour écrire l'heure
 +hwclock -r && date # pour verifier
 +# test si on est dans la tranche avant matin
 +if [ $DATEHEURE -lt $DATE_ALLUM_MATIN ]
 +then
 +        echo "on est dans la tranche avant matin demarrage $ALLUM_MATIN arret $ETEIND_MATIN"
 +        shutdown -P $ETEIND_MATIN
 +        echo 0 | sudo tee /sys/class/rtc/rtc0/wakealarm
 +        echo `date '+%s' -d "$ALLUM_MATIN"` | sudo tee /sys/class/rtc/rtc0/wakealarm
 +# test si on est dans la tranche du matin
 +elif [ $DATEHEURE -gt $DATE_ALLUM_MATIN ] && [ $DATEHEURE -lt $DATE_ETEIND_MATIN ]
 +then
 +        echo "on est dans la tranche matin arret $ETEIND_MATIN demarrage $ALLUM_SOIR"
 +        shutdown -P $ETEIND_MATIN
 +        echo 0 | sudo tee /sys/class/rtc/rtc0/wakealarm
 +        echo `date '+%s' -d "$ALLUM_SOIR"` | sudo tee /sys/class/rtc/rtc0/wakealarm
 +# test si on est entre les 2
 +elif [ $DATEHEURE -gt $DATE_ETEIND_MATIN ] && [ $DATEHEURE -lt $DATE_ALLUM_SOIR ]
 +then
 +        echo "on est entre les 2 soir arret $ETEIND_SOIR demarrage $ALLUM_SOIR"
 +        shutdown -P $ETEIND_SOIR
 +        echo 0 | sudo tee /sys/class/rtc/rtc0/wakealarm
 +        echo `date '+%s' -d "$ALLUM_SOIR"` | sudo tee /sys/class/rtc/rtc0/wakealarm
 +# test si on est dans la tranche du soir
 +elif [ $DATEHEURE -gt $DATE_ALLUM_SOIR ] && [ $DATEHEURE -lt $DATE_ETEIND_SOIR ]
 +then
 +        echo "on est dans la tranche soir arret $ETEIND_SOIR demarrage $ALLUM_MATIN"
 +        shutdown -P $ETEIND_SOIR
 +        echo 0 | sudo tee /sys/class/rtc/rtc0/wakealarm
 +        echo `date '+%s' -d "tomorrow $ALLUM_MATIN"` | sudo tee /sys/class/rtc/rtc0/wakealarm
 +else
 +# sinon fonctionne 2 heures
 +        echo "hors tranche horaire marche 2 heures"
 +        shutdown -P 2:00
 +fi
 +</code>
 +===== mise a jour automatique =====
 +
 +<code c>
 +#!/bin/bash
 +# mise a jour automatique
 +SITE_SOURCE='http://quelquepart/maj.tgz'
 +SCRIPTE='http://surlereseau/script_maj.sh'
 +
 +cd /home/pi
 +rm -rf /home/pi/maj.tgz
 +wget $SITE_SOURCE
 +RET=$?
 +if [ $RET -eq 0 ]
 +then
 +        SUM=`md5sum -b maj.tgz | awk '{ print $1 }'`
 +        if [ "$SUM" != "`cat maj.tgz_sum`" ]
 +        then
 +                echo -n $SUM > maj.tgz_sum
 +                cd Desktop
 +                sudo tar xvf ../maj.tgz
 +                sudo chown pi:pi -R *
 +        fi
 +fi
 +cd /home/pi
 +rm -rf /home/pi/script_maj.sh
 +wget $SCRIPTE
 +RET=$?
 +if [ $RET -eq 0 ] && [ -e script_maj.sh ]
 +then
 +        SUM=`md5sum script_maj.sh | awk '{ print $1 }'`
 +        if [ "$SUM" = "`cat script_maj.sh_sum`" ]
 +        then
 +                exit 0
 +        else
 +                echo -n $SUM > script_maj.sh_sum
 +                cd Desktop
 +                sudo  bash ../script_maj.sh
 +                sudo chown pi:pi -R *
 +        fi
 +fi
 +</code>
 +
 +pour l'aureon dans /etc/modprobe.d/aureon.conf
 + options snd-usb-audio nrpacks=1