Buongiorno a tutti, in questi giorni mi sono interfacciato al mondo raspberry e ho deciso di provare a controllare un arduino nano dal terminale, solo che ho alcuni problemi.
Ovvero che quando provo fare make upload per caricare lo sketch sull'arduino noto che mi da delle informazioni e tra di esse anche il modello del processore del mio arduino nano, ovvero un atmega328p mentre quello segnalato dal raspberry è un atmega168.
Secondo me il problema è solo questo e lo dico per due motivi:
- ho provato a collegare un arduino uno cambiando i parametri all'interno del makefile e funzionava tutto correttamente;
- ho provato a collegare l'arduino nano all'ide di arduino e li funzionava tutto correttamente.
I file che ho creato per poterlo controllare da terminale sono questi:
pi@raspberrypi:~/codice_arduino $ ls
build-nano Makefile prova.ino
pi@raspberrypi:~/codice_arduino $ more Makefile
ARDUINO_DIR = /usr/share/arduino
BOARD_TAG = nano
ARDUINO_PORT = /dev/ttyUSB0
ARDUINO_LIBS =
include /usr/share/arduino/Arduino.mk
pi@raspberrypi:~/codice_arduino $ more prova.ino
#define led 5
void setup(){
pinMode(led, OUTPUT);
}
void loop(){
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
delay(1000);
}
di cui la cartella build-nano si è creata automaticamente dopo che ho fatto make.
il risultato che mi da il make upload è:
pi@raspberrypi:~/codice_arduino $ make upload
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = LINUX
- [USER] ARDUINO_DIR = /usr/share/arduino
- [COMPUTED] ARDMK_DIR = /usr/share/arduino (relative to Common.mk)
- [AUTODETECTED] ARDUINO_VERSION = 105
- [DEFAULT] ARCHITECTURE =
- [DEFAULT] ARDMK_VENDOR = arduino
- [DEFAULT] ARDUINO_SKETCHBOOK =
- [BUNDLED] AVR_TOOLS_DIR = /usr/share/arduino/hardware/tools/avr (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = /usr/share/arduino/libraries (from ARDUINO_DIR)
- [COMPUTED] ARDUINO_VAR_PATH = /usr/share/arduino/hardware/arduino//variants (from ARDUINO_DIR)
- [COMPUTED] BOARDS_TXT = /usr/share/arduino/hardware/arduino//boards.txt (from ARDUINO_DIR)
- [DEFAULT] USER_LIB_PATH = /libraries (in user sketchbook)
- [DEFAULT] PRE_BUILD_HOOK = pre-build-hook.sh
- [USER] BOARD_TAG = nano
- [COMPUTED] CORE = arduino (from build.core)
- [COMPUTED] VARIANT = eightanaloginputs (from build.variant)
- [COMPUTED] OBJDIR = build-nano (from BOARD_TAG)
- [COMPUTED] ARDUINO_CORE_PATH = /usr/share/arduino/hardware/arduino//cores/arduino (from ARDUINO_DIR, BOARD_TAG and boards.txt)
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [DEFAULT] CFLAGS_STD = -std=gnu11 -flto -fno-fat-lto-objects
- [DEFAULT] CXXFLAGS_STD = -std=gnu++11 -fno-threadsafe-statics -flto
- [COMPUTED] DEVICE_PATH = /dev/ttyUSB0 (from MONITOR_PORT)
- [DEFAULT] FORCE_MONITOR_PORT =
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
- [COMPUTED] BOOTLOADER_PARENT = /usr/share/arduino/hardware/arduino//bootloaders (from ARDUINO_DIR)
- [COMPUTED] ARDMK_VERSION = 1.5
- [COMPUTED] CC_VERSION = 5.4.0 (avr-gcc)
-------------------------
mkdir -p build-nano
make reset
make[1]: ingresso nella directory "/home/pi/codice_arduino"
/usr/bin/ard-reset-arduino /dev/ttyUSB0
make[1]: uscita dalla directory "/home/pi/codice_arduino"
make do_upload
make[1]: ingresso nella directory "/home/pi/codice_arduino"
/usr/share/arduino/hardware/tools/avr/../avrdude -q -V -p atmega168 -C /usr/share/arduino/hardware/tools/avr/../avrdude.conf -D -c arduino -b 19200 -P /dev/ttyUSB0 \
-U flash:w:build-nano/codice_arduino.hex:i
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00
avrdude done. Thank you.
make[1]: *** [/usr/share/arduino/Arduino.mk:1462: do_upload] Error 1
make[1]: uscita dalla directory "/home/pi/codice_arduino"
make: *** [/usr/share/arduino/Arduino.mk:1455: upload] Error 2