arduinoportethernetyoctointel-galileo

Why I'm getting this message uploading Galileo's sketch in Arduino IDE?


I'm on windows 10 using Arduino IDE to upload a sketch in Galileo Intel's Arduino. Since Arduino runs Linux, the code is somehow changed to "fit" into Linux. I successfully managed to run a bigger Linux image with a SD card noticing sketch persistence when unplug/plug the board. I have successfully managed to upload the blinky demo on Galileo too. Following this tutorial, when I connect a Ethernet cable to the board and my PC, I run this code to give some IP address to it (Is this correct? What this code does actually?):

void setup() {
  system("telnetd -l /bin/sh");
  system("ifconfig eth0 192.168.1.80 netmask 255.255.0.0 up");
  }
void loop() {
  }

With this I got the following messages:

#!/bin/sh

starting download script
# clupload script to invoke lsz 
# Copyright (C) 2014 Intel Corporation
# 
Args to shell: C:\Users\Gabriel\AppData\Roaming\Arduino15\packages\Intel\tools\sketchUploader\1.6.2+1.0/x86/bin C:\Users\Gabriel\AppData\Local\Temp\build4196129373431759811.tmp/descobrir_ip.cpp.elf COM2
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
COM PORT 2
# License as published by the Free Software Foundation; either
Converted COM Port COM2 to tty port /dev/ttyS1
# version 2.1 of the License, or (at your option) any later version.
Sending Command String to move to download if not already in download mode
# 
# 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: COM port to use.

#path contains \ need to change all to /
path_to_exe=$1
fixed_path=${path_to_exe//\\/\/}

#COM ports are not always setup to be addressed via COM for redirect.
#/dev/ttySx are present. Howwever, COMy -> /dev/ttySx where x = y - 1

com_port_arg=$3
com_port_id=${com_port_arg/COM/}
echo "COM PORT" $com_port_id
tty_port_id=/dev/ttyS$((com_port_id-1))
echo "Converted COM Port" $com_port_arg "to tty port" $tty_port_id

Deleting existing sketch on target
echo "Sending Command String to move to download if not already in download mode"
echo "~sketch downloadGalileo" > $tty_port_id
C:\Users\Gabriel\AppData\Roaming\Arduino15\packages\Intel\tools\sketchUploader\1.6.2+1.0/clupload/cluploadGalileo_win.sh: line 42: /dev/ttyS1: Permission denied

#Move the existing sketch on target.
echo "Deleting existing sketch on target"
"$fixed_path/lsz.exe" --escape -c "mv -f /sketch/sketch.elf /sketch/sketch.elf.old" <> $tty_port_id 1>&0
C:\Users\Gabriel\AppData\Roaming\Arduino15\packages\Intel\tools\sketchUploader\1.6.2+1.0/clupload/cluploadGalileo_win.sh: line 46: /dev/ttyS1: Permission denied
# Execute the target download command

#Download the file.
host_file_name=$2
"$fixed_path/lsz.exe" --escape --binary --overwrite $host_file_name <> $tty_port_id 1>&0
C:\Users\Gabriel\AppData\Roaming\Arduino15\packages\Intel\tools\sketchUploader\1.6.2+1.0/clupload/cluploadGalileo_win.sh: line 51: /dev/ttyS1: Permission denied

#mv the downloaded file to /sketch/sketch.elf 
Moving downloaded file to /sketch/sketch.elf on target
target_download_name="${host_file_name##*/}" 
echo "Moving downloaded file to /sketch/sketch.elf on target"
"$fixed_path/lsz.exe" --escape -c "mv $target_download_name /sketch/sketch.elf; chmod +x /sketch/sketch.elf" <> $tty_port_id 1>&0
C:\Users\Gabriel\AppData\Roaming\Arduino15\packages\Intel\tools\sketchUploader\1.6.2+1.0/clupload/cluploadGalileo_win.sh: line 56: /dev/ttyS1: Permission denied
processing.app.SerialException: Erro ao abrir porta serial "COM2".
    at processing.app.Serial.<init>(Serial.java:127)
    at processing.app.Serial.<init>(Serial.java:71)
    at processing.app.SerialMonitor$3.<init>(SerialMonitor.java:93)
    at processing.app.SerialMonitor.open(SerialMonitor.java:93)
    at processing.app.AbstractMonitor.resume(AbstractMonitor.java:220)
    at processing.app.Editor.resumeOrCloseSerialMonitor(Editor.java:2431)
    at processing.app.Editor.access$3200(Editor.java:71)
    at processing.app.Editor$DefaultExportHandler.run(Editor.java:2407)
    at java.lang.Thread.run(Thread.java:745)
Caused by: jssc.SerialPortException: Port name - COM2; Method name - openPort(); Exception type - Port busy.
    at jssc.SerialPort.openPort(SerialPort.java:164)
    at processing.app.Serial.<init>(Serial.java:123)
    ... 8 more
Erro ao abrir porta serial "COM2".

Anyone has any idea on what's happening?


Solution

  • The error is not referring to the network itself.it seems that the port you are using for the sketch upload is already in use. I would say to try using a diferent one.

    About the networking part. The command is to setup a static IP address. If you just want to find your IP address you can print it to the serial monitor

    system("ifconfig eth0 > /dev/ttyGS0");