venerdì 13 maggio 2016

Intel Edison ed Arduino

La programmazione della parte Arduino Kit legato ad una Intel Edison si effettua mediante l'Arduino IDE.
La prima cosa da fare e' configurare il dispositivo perche' di default non e' inserito nella lista delle schede conosciute dall'IDE


Si procede selezionando il menu Strumenti dalla Arduino IDE/Scheda/Gestore Scheda. Si apre un menu e si cerca e si installa Intel i686 Boards

Per la programmazione si deve usare la microUsb di collegamento seriale OTG (J22) e non la porta J16 (terminale seriale) che puo' essere disconnessa.

A questo punto vengono scaricati i file e l'installazione ....si pianta (almeno sulla mia Centos 7). Per installare la Edison si deve andare nella propria home nella sottocartella (o qualcosa di simile)

/home/linnocenti/.arduino15/packages/Intel/tools/core2-32-poky-linux/1.6.2+1.0/i686

ed editare il file ./install_script.sh alla riga 106 (link originale) da

executable_files=$($SUDO_EXEC find "$native_sysroot" -type f -perm +111 -exec printf "\"%s\" " {} \; )

a
executable_files=$($SUDO_EXEC find "$native_sysroot" -type f -perm /111 -exec printf "\"%s\" " {} \; )


Si deve ovviamente cambiare i permessi dell'utente per poter accedere alla porta seriale con

sudo usermod -a -G tty yourUserName
sudo usermod -a -G dialout yourUserName

Edison e Arduino condividono le seguenti porte
Serial (Arduino)-> /dev/ttySG0 (Edison)
Serial1 (Arduino)-> /dev/ttyMFD1 (Edison) corrisponde ai pin D0 e D1 Rx e Tx di Arduino
Serial2 (Arduino)-> /dev/ttyMDF2 (Edison) messaggi del kernel per debug

Compilando e lanciando l'esempio blink si hanno i seguenti messaggi. Per quanto riguarda i messaggi di errore a questo link viene consigliato di usare la IDE 1.6.0 che risulterebbe piu' stabile
--------------------------------------------------
La scheda Intel:i686:izmir_ec non ha la proprietà 'build.board' definita. La imposto automaticamente a I686_IZMIR_EC
ATTENZIONE: La categoria '' della libreria DallasTemperature non è valida. La imposto a 'Uncategorized'
ATTENZIONE: La categoria '' della libreria EEPROM non è valida. La imposto a 'Uncategorized'
ATTENZIONE: La categoria '' della libreria Ethernet non è valida. La imposto a 'Uncategorized'
ATTENZIONE: La categoria '' della libreria EthernetShield non è valida. La imposto a 'Uncategorized'
ATTENZIONE: La categoria '' della libreria OneWire non è valida. La imposto a 'Uncategorized'
ATTENZIONE: La categoria '' della libreria SD non è valida. La imposto a 'Uncategorized'
ATTENZIONE: La categoria '' della libreria SPI non è valida. La imposto a 'Uncategorized'
ATTENZIONE: La categoria '' della libreria Servo non è valida. La imposto a 'Uncategorized'
ATTENZIONE: La categoria '' della libreria SoftwareServo non è valida. La imposto a 'Uncategorized'
ATTENZIONE: La categoria '' della libreria TimerOne non è valida. La imposto a 'Uncategorized'
ATTENZIONE: La categoria '' della libreria USBHost non è valida. La imposto a 'Uncategorized'
ATTENZIONE: La categoria '' della libreria WiFi non è valida. La imposto a 'Uncategorized'
Attenzione: platform.txt del core 'Arduino i686 Boards' contiene la stringa deprecata recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}" convertita automaticamente in recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{archive_file_path}" "{object_file}". Verifica la disponibilità di un aggiornamento di questo core.

Lo sketch usa 76.331 byte (0%) dello spazio disponibile per i programmi. Il massimo è 10.000.000 byte.
#!/bin/sh

# clupload script to invoke lsz
# Copyright (C) 2014 Intel Corporation
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
starting download script
Args to shell: /home/linnocenti/.arduino15/packages/Intel/tools/sketchUploader/1.6.2+1.0/x86/bin /tmp/buildccb8e9535cf076aa288bd991e81fb898.tmp/Blink.ino.elf /dev/ttyACM0
Serial Port PORT
Using tty Port /dev/ttyACM0
Sending Command String to move to download if not already in download mode
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#

echo "starting download script"
echo "Args to shell:" $*
#
# ARG 1: Path to lsz executable.
# ARG 2: Elf File to download
# ARG 3: TTY port to use.
#
#path may contain \ need to change all to /
path_to_exe=$1
fixed_path=${path_to_exe//\\/\/}
#
tty_port_id=$3
echo "Serial Port PORT" $com_port_id
echo "Using tty Port" $tty_port_id
#
echo "Sending Command String to move to download if not already in download mode"
echo "~sketch downloadEdison" > $tty_port_id
#Give the host time to stop the process and wait for download
sleep 1
#
Deleting existing sketch on target
#Move the existing sketch on target.
echo "Deleting existing sketch on target"
"$fixed_path/lsz" --escape -c "mv -f /sketch/sketch.elf /sketch/sketch.elf.old" < $tty_port_id > $tty_port_id

Transfer incomplete
#
# Execute the target download command
#
#Download the file.
host_file_name=$2
"$fixed_path/lsz" --escape --binary --overwrite $host_file_name < $tty_port_id  > $tty_port_id
Sending: Blink.ino.elf

Bytes Sent:   1024/  75668   BPS:226647   ETA 00:00 
Bytes Sent:   9216/  75668   BPS:1890482  ETA 00:00 
Bytes Sent:  10240/  75668   BPS:2070761  ETA 00:00 
Bytes Sent:  11264/  75668   BPS:2253715  ETA 00:00 
Bytes Sent:  12288/  75668   BPS:2433294  ETA 00:00 
Bytes Sent:  13312/  75668   BPS:2606047  ETA 00:00 
Bytes Sent:  14336/  75668   BPS:2777730  ETA 00:00 
Bytes Sent:  15360/  75668   BPS:2945389  ETA 00:00 
Bytes Sent:  16384/  75668   BPS:3104141  ETA 00:00 
Bytes Sent:  17408/  75668   BPS:3263507  ETA 00:00 
Bytes Sent:  18432/  75668   BPS:3425317  ETA 00:00 
Bytes Sent:  19456/  75668   BPS:3599663  ETA 00:00 
Bytes Sent:  20480/  75668   BPS:3766689  ETA 00:00 
Bytes Sent:  21504/  75668   BPS:3928323  ETA 00:00 
Bytes Sent:  22528/  75668   BPS:4096652  ETA 00:00 
Bytes Sent:  23552/  75668   BPS:4257391  ETA 00:00 
Bytes Sent:  24576/  75668   BPS:4423241  ETA 00:00 
Bytes Sent:  25600/  75668   BPS:3941494  ETA 00:00 
Bytes Sent:  26624/  75668   BPS:4046863  ETA 00:00 
Bytes Sent:  27648/  75668   BPS:4164480  ETA 00:00 
Bytes Sent:  28672/  75668   BPS:4279378  ETA 00:00 
Bytes Sent:  29696/  75668   BPS:4388951  ETA 00:00 
Bytes Sent:  30720/  75668   BPS:4498447  ETA 00:00 
Bytes Sent:  31744/  75668   BPS:4498867  ETA 00:00 
Bytes Sent:  32768/  75668   BPS:4569569  ETA 00:00 
Bytes Sent:  33792/  75668   BPS:4632887  ETA 00:00 
Bytes Sent:  34816/  75668   BPS:4747208  ETA 00:00 
Bytes Sent:  35840/  75668   BPS:4831544  ETA 00:00 
Bytes Sent:  36864/  75668   BPS:4884653  ETA 00:00 
Bytes Sent:  37888/  75668   BPS:4943039  ETA 00:00 
Bytes Sent:  38912/  75668   BPS:4955029  ETA 00:00 
Bytes Sent:  39936/  75668   BPS:5038615  ETA 00:00 
Bytes Sent:  40960/  75668   BPS:5125718  ETA 00:00 
Bytes Sent:  41984/  75668   BPS:5210179  ETA 00:00 
Bytes Sent:  43008/  75668   BPS:5259603  ETA 00:00 
Bytes Sent:  44032/  75668   BPS:5306389  ETA 00:00 
Bytes Sent:  45056/  75668   BPS:5350468  ETA 00:00 
Bytes Sent:  46080/  75668   BPS:5378120  ETA 00:00 
Bytes Sent:  47104/  75668   BPS:5376598  ETA 00:00 
Bytes Sent:  48128/  75668   BPS:5456654  ETA 00:00 
Bytes Sent:  49152/  75668   BPS:5510342  ETA 00:00 
Bytes Sent:  50176/  75668   BPS:5585577  ETA 00:00 
Bytes Sent:  51200/  75668   BPS:5663045  ETA 00:00 
Bytes Sent:  52224/  75668   BPS:5692542  ETA 00:00 
Bytes Sent:  53248/  75668   BPS:5729267  ETA 00:00 
Bytes Sent:  54272/  75668   BPS:5753981  ETA 00:00 
Bytes Sent:  55296/  75668   BPS:5690094  ETA 00:00 
Bytes Sent:  56320/  75668   BPS:5758030  ETA 00:00 
Bytes Sent:  57344/  75668   BPS:5826506  ETA 00:00 
Bytes Sent:  58368/  75668   BPS:5883234  ETA 00:00 
Bytes Sent:  59392/  75668   BPS:5862332  ETA 00:00 
Bytes Sent:  60416/  75668   BPS:5914414  ETA 00:00 
Bytes Sent:  61440/  75668   BPS:5967995  ETA 00:00 
Bytes Sent:  62464/  75668   BPS:5987179  ETA 00:00 
Bytes Sent:  63488/  75668   BPS:5945122  ETA 00:00 
Bytes Sent:  64512/  75668   BPS:6002283  ETA 00:00 
Bytes Sent:  65536/  75668   BPS:6065936  ETA 00:00 
Bytes Sent:  66560/  75668   BPS:6095743  ETA 00:00 
Bytes Sent:  67584/  75668   BPS:6121225  ETA 00:00 
Bytes Sent:  68608/  75668   BPS:6139987  ETA 00:00 
Bytes Sent:  69632/  75668   BPS:6167541  ETA 00:00 
Bytes Sent:  70656/  75668   BPS:6235591  ETA 00:00 
Bytes Sent:  71680/  75668   BPS:6278929  ETA 00:00 
Bytes Sent:  72704/  75668   BPS:6299557  ETA 00:00 
Bytes Sent:  73728/  75668   BPS:6317676  ETA 00:00 
Bytes Sent:  74752/  75668   BPS:6339755  ETA 00:00  Moving downloaded file to /sketch/sketch.elf on target

Bytes Sent:  75668   BPS:3078945                        

Transfer complete
#
#mv the downloaded file to /sketch/sketch.elf
target_download_name="${host_file_name##*/}"
echo "Moving downloaded file to /sketch/sketch.elf on target"
"$fixed_path/lsz" --escape -c "mv $target_download_name /sketch/sketch.elf; chmod +x /sketch/sketch.elf" < $tty_port_id > $tty_port_id

Transfer complete
#
#
Trovata libreria non valida in /home/linnocenti/.arduino15/packages/Intel/hardware/i686/1.6.2+1.0/libraries/Wire: /home/linnocenti/.arduino15/packages/Intel/hardware/i686/1.6.2+1.0/libraries/Wire
Trovata libreria non valida in /home/linnocenti/.arduino15/packages/Intel/hardware/i686/1.6.2+1.0/libraries/Wire: /home/linnocenti/.arduino15/packages/Intel/hardware/i686/1.6.2+1.0/libraries/Wire
--------------------------------------------------

Nessun commento:

Posta un commento

Perche' investire su Unix

 Un libro trovato nel libero scambio alla Coop su cio' che poteva essere e non e' stato...interessante la storia su Unix del primo c...