arduino-cli upload between raspberry and arduino

Hello
I a trying to load a sketch from a raspberry pi zero W to an arduino nano by using the RX/TX of the both device
I have test some tuto to do it but it does not work...

The things that works :

  • Upload a sketch from a linux computer through USB cable => Sketch seem Ok and Arduino works
  • send data between raspberry and arduino with the serial link (pin RX/TX)

my problem :
the command "arduino-cli board list" send
Port Type Board Name FQBN Core
/dev/ttyAMA0 Serial Port Unknown

and of course an "arduino-cli upload" fail...

Any idea to make it works ?

Thanks

Please post the full output from the arduino-cli upload command using the --verbose option.

Hello

below the answer...

arduino-cli upload --verbose -p /dev/ttyAMA0 --fqbn arduino:avr:nano aquaponie-full-time
"/home/dimi/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude" "-C/home/dimi/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega328p -carduino "-P/dev/ttyAMA0" -b115200 -D "-Uflash:w:/home/dimi/Arduino/aquaponie-full-time/build/arduino.avr.nano/aquaponie-full-time.ino.hex:i"

avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "/home/dimi/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
User configuration file is "/home/dimi/.avrduderc"
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/ttyAMA0
Using Programmer : arduino
Overriding Baud Rate : 115200
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.

Error during Upload: uploading error: uploading error: exit status 1

Try quickly pressing and then releasing the reset button on the Nano immediately after starting the command.

Sory but is it not possible :slight_smile:
My arduino has the control of the power supply of the raspberry.
When I try to press the reset button the raspberry reboot...

Then it won't be possible for you to do an upload over serial.

In order to upload to the Arduino Nano board, its bootloader must be activated. The way to activate the bootloader on the Nano is to reset the ATmega328P microcontroller.

I was wondering if it was not a trouble link to the serial bit rate?
My serial between raspberry and arduino works at 9600 baud
and with verbose mode it says "Overriding Baud Rate : 115200"
Is it possible to specifie the baud rate to arduino-cli ?

ewok2:
My serial between raspberry and arduino works at 9600 baud

That is the baud rate that your sketch uses. It has absolutely nothing to do with the baud rate of the upload. That is determined by the bootloader.

ewok2:
and with verbose mode it says “Overriding Baud Rate : 115200”

If you are using an official Arduino Nano board bought since 2018, that is the correct baud rate.

If you are using an older official Arduino Nano, then the correct baud rate is 57600 and you should use the FQBN for the “ATmega328P (Old Bootloader)” version of the Nano board definition: arduino:avr:nano:cpu=atmega328old

arduino-cli upload --verbose -p /dev/ttyAMA0 --fqbn arduino:avr:nano:cpu=atmega328old aquaponie-full-time

ewok2:
Is it possible to specifie the baud rate to arduino-cli ?

As I showed you above, the Arduino Nano board definition has custom options for the two different bootloader versions that were used by the board. It would be absolutely pointless to offer the ability for the user to specify arbitrary upload baud rates because the bootloader uses one specific baud rate. If you use any other baud rate, the upload would simply fail.

But all of this is just a distraction. Your problem is that you are not able to reset the board. If you manage to fix that problem and are still unable to upload then we can do further troubleshooting, but for now it’s pointless.

Thanks for your help!
Indead I was using an old arduino nana with Old bootloader.

I test again with the

arduino:avr:nano:cpu=atmega328old

but it does not works neither...

I have also try to powersupply the raspberry with USB and with the control of the arduino to be able to reset the arduino just after send the command from the raspberry.
It does not work :

arduino-cli upload --verbose -p /dev/ttyAMA0 --fqbn arduino:avr:nano:cpu=atmega328old aquaponie-full-time
"/home/dimi/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude" "-C/home/dimi/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega328p -carduino "-P/dev/ttyAMA0" -b57600 -D "-Uflash:w:/home/dimi/Arduino/aquaponie-full-time/build/arduino.avr.nano/aquaponie-full-time.ino.hex:i"

avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "/home/dimi/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
User configuration file is "/home/dimi/.avrduderc"
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/ttyAMA0
Using Programmer : arduino
Overriding Baud Rate : 57600
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xe0

avrdude done. Thank you.

Error during Upload: uploading error: uploading error: exit status 1

with the above answer.
But it is slightly different. The "attemp x of 10" go very fast, with the initial command it take somes second between the attemp.