arduino-cli on Rpi cannot find boards

I need to be able to let an Rpi program an Arduino nano. I must controll the Rpi via an SSH connection. This Rpi will be placed on a difficult to reach spot with an arduino nano plugged in. This nano is likely to need updates.

I am following this url from arduino-cli. but I am dead in the water.

When i run the board list command I see that it can find on on the usb port but it does not recognize it:

pi@raspberrypi:~/Downloads/MyFirstSketch $ arduino-cli board list               Port         Type              Board Name FQBN Core
/dev/ttyAMA0 Serial Port       Unknown
/dev/ttyUSB0 Serial Port (USB) Unknown

I also tried:

pi@raspberrypi:~/.arduino15 $ arduino-cli board listall
Board Name FQBN

But it does not neem to know any board at all.

I have had serial communication with the arduino nano in a processing sketch, so that one is working for sure.

I did every step in the tutorial, I ran the core update command:

pi@raspberrypi:~/Downloads $ arduino-cli core update-index
Downloading missing tool builtin:ctags@5.8-arduino11...
builtin:ctags@5.8-arduino11 downloaded
Installing builtin:ctags@5.8-arduino11...
builtin:ctags@5.8-arduino11 installed
Downloading missing tool builtin:serial-discovery@1.0.0...
builtin:serial-discovery@1.0.0 downloaded
Installing builtin:serial-discovery@1.0.0...
builtin:serial-discovery@1.0.0 installed
Updating index: library_index.json downloaded
Updating index: package_index.json downloaded

I am just trying to let my Rpi compile and program the arduino board using an SSH connection.

Can somebody help me out here? Should I ask elsewhere as well?

Kind regards,

Bas

bask185:
I also tried:

pi@raspberrypi:~/.arduino15 $ arduino-cli board listall

Board Name FQBN



But it does not neem to know any board at all.

I have had serial communication with the arduino nano in a processing sketch, so that one is working for sure.

I did every step in the tutorial, I ran the core update command:

Unlike the Arduino IDE, Arduino CLI does not come with the Arduino AVR Boards core pre-installed (because not everyone uses AVR boards). You need to run this command:

arduino-cli core install arduino:avr

bask185:
When i run the board list command I see that it can find on on the usb port but it does not recognize it:

pi@raspberrypi:~/Downloads/MyFirstSketch $ arduino-cli board list               Port         Type              Board Name FQBN Core

/dev/ttyAMA0 Serial Port      Unknown
/dev/ttyUSB0 Serial Port (USB) Unknown
[/quote]
This will still occur even after you have installed Arduino AVR Boards. The reason is the Nano uses a general purpose USB to TTL serial adapter chip (FTDI FT232RL on the official and clone Nanos, CH340 on the derivative Nanos). The way Arduino CLI identifies boards is via the VID/PID of the chip providing a USB interface. The USB to serial adapter chip on the Nano uses the manufacturer's stock VID/PID, so there is no way for the Arduino CLI to know what device is using that VID/PID (for example, I have multiple non-Arduino consumer electronic devices connected to my computer that use the FT232). So with the Nano you just need to figure out which port it has (you can do this by checking which new port appears after you plug the Nano in to your computer), and use that in your upload command.

All the other official Arduino boards have custom VID/PID, which allows them to be identified by the arduino-cli board list command.

bask185:
Should I ask elsewhere as well?

The Arduino forum is definitely the right place for this type of question. I did move your topic to the "Arduino CLI" forum board, since this is an Arduino CLI-specific question.

Thank you for your help. I now can compile the sketch succesfully but the uploading does not yet work.
I am also thinking to not compile on the rpi but on my W10 host PC instead so I can just transfer the .hex file and call an upload script on the pi. I can SSH in without password so I think that should be more effective.
~~ ~~pi@raspberrypi:~/Documents/software $ arduino-cli compile -b arduino:avr:nano beep Sketch uses 932 bytes (3%) of program storage space. Maximum is 30720 bytes. Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.~~ ~~
But uploading gives me my favourite error :sob: :
~~ ~~pi@raspberrypi:~/Documents/software $ arduino-cli upload -b arduino:avr:nano -p /dev/ttyUSB0 -t beep avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00 avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00 avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00 avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00 avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00 avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00 avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00 avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00 avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00 avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00 Error during Upload: uploading error: exit status 1~~ ~~
There is nothing hooked on the Rx Tx pins, and I see the leds flashing which indicates the atmega receives data and is reset
I member that in the IDE 1.8.12 I had to select Processing: Atmega328P (Old Bootloader). This was completely new to me. May it be that arduino-cli also expects a different bootloader? Is this configurable?
boardname is listed as:
Arduino Nano arduino:avr:nano
I cannot find references to bootloaders with the --help flag.
EDIT:
I found 2 hex files, but as arguement I pass on the folder and not a single hex.
pi@raspberrypi:~/Documents/software $ ls beep
beep.arduino.avr.nano.elf beep.arduino.avr.nano.hex beep.arduino.avr.nano.with_bootloader.hex beep.ino
I tried:
pi@raspberrypi:~/Documents/software $ arduino-cli upload -b arduino:avr:nano -p /dev/ttyUSB0 -t -i beep/beep.arduino.avr.nano.with_bootloader.hex
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
and I did the same with the other hex as well but same results
Why is the upload process failing and how can I fix this?

I had a good idea. I googled it...

I had to add something to the board string:
arduino:avr:nano:cpu=atmega328old

This solves the problem and I can now succesfully load hex file to the program.

Now I just have to configure my W10 PC to produce this same hex so I can compile locally. Safes me alot of file tranfers :smiley:

I hope arduino-cli works with the src subdirectory as welll?

Kind regards,

Bas