Go Down

Topic: Finding a FQBN for a device that doesn't come up on board list (Read 942 times) previous topic - next topic

Harley4DaWin

My board is a non genuine arduino NANO.

It does't come up on
Code: [Select]
arduino-cli board list

I have learnt that this is because of:

pert
"This is expected and normal for any board that uses a general purpose USB to serial adapter chip (e.g., FTDI FT232, CH340). The reason is that these chips use a VID/PID provided by the manufacturer, rather than a custom, board-specific ID as is done on the more modern official Arduino boards. This means there is no way to know which board that generic VID/PID is associated with. You'll notice that the Arduino IDE's Tools > Board menu and Tools > Board Info are also unable to identify these boards. This is not a situation where Arduino intentionally didn't provide support for clones and 3rd party compatible boards. The same applies even to the official Arduino Nano (and Diecimila as well, I believe), which uses the FTDI FT232 with its manufacturer-provided VID/PID. There is simply no possible way for these boards to be identified.

It doesn't mean you can't use the boards. It only means that the convenience features like arduino-cli board attach and arduino-cli board list don't work quite as well with these boards. The essential features will still work perfectly well."

My question: Is there any way to find out the boards FQBN? So that I can compile my code with

Code: [Select]
arduino-cli compile -b arduino:avr:uno /home/user/Arduino/MySketch

pert

Hi @Harley4DaWin

As you already discovered, there is no way for the FQBN to be automatically discovered. However, you can simply look up the FQBN of the Nano. You can get a listing of all installed boards with this command:
Code: [Select]
arduino-cli board listall
That may give you a lot of boards, so you can filter it with grep if you like:
Code: [Select]
arduino-cli board listall | grep --ignore-case "nano"

You will now have learned that the FQBN of the Nano is arduino:avr:nano. You will usually just be able to use the FQBN as is. However, some boards have custom board options that allow additional configuration. These custom board options are also set via the FQBN. You can learn about the custom board options of the Nano with this command;
Code: [Select]
arduino-cli board details arduino:avr:nano
which gives this output:
Code: [Select]
Board name:             Arduino Nano                                               
FQBN:                   arduino:avr:nano                                           
Board version:          1.8.3                                                       

Official Arduino board: ✔                                                           

Package name:           arduino                                                     
Package maintainer:     Arduino                                                     
Package URL:            https://downloads.arduino.cc/packages/package_index.json   
Package website:        http://www.arduino.cc/                                     
Package online help:    http://www.arduino.cc/en/Reference/HomePage                 

Platform name:          Arduino AVR Boards                                         
Platform category:      Arduino                                                     
Platform architecture:  avr                                                         
Platform URL:           http://downloads.arduino.cc/cores/avr-1.8.3.tar.bz2         
Platform file name:     avr-1.8.3.tar.bz2                                           
Platform size (bytes):  4941548                                                     
Platform checksum:      SHA-256:de8a9b982477762d3d3e52fc2b682cdd8ff194dc3f1d46f4debdea6a01b33c14

Required tool:          arduino:avr-gcc                                                                             7.3.0-atmel3.6.1-arduino7

Required tool:          arduino:avrdude                                                                             6.3.0-arduino17         

Required tool:          arduino:arduinoOTA                                                                          1.3.0                   

Option:                 Processor                                                                                   cpu                     
                        ATmega328P                                                   ✔                              cpu=atmega328           
                        ATmega328P (Old Bootloader)                                                                 cpu=atmega328old         
                        ATmega168                                                                                   cpu=atmega168           
Programmers:            Id                                                           Name                         
                        arduinoisp                                                   ArduinoISP                   
                        stk500                                                       Atmel STK500 development board
                        parallel                                                     Parallel Programmer           
                        jtag3isp                                                     Atmel JTAGICE3 (ISP mode)     
                        arduinoasisp                                                 Arduino as ISP               
                        usbtinyisp                                                   USBtinyISP                   
                        atmel_ice                                                    Atmel-ICE (AVR)               
                        avrisp                                                       AVR ISP                       
                        arduinoisporg                                                ArduinoISP.org               
                        usbGemma                                                     Arduino Gemma                 
                        buspirate                                                    BusPirate as ISP             
                        jtag3                                                        Atmel JTAGICE3 (JTAG mode)   
                        avrispmkii                                                   AVRISP mkII                   
                        usbasp                                                       USBasp                       
                        arduinoasispatmega32u4                                       Arduino as ISP (ATmega32U4)   

Perhaps a little more information than you needed, but arduino-cli is a tool for advanced users so we need to provide for all use cases.

For your case, the important information is under the "Option" section:
Code: [Select]
Option:                 Processor                                                                                   cpu                     
                        ATmega328P                                                   ✔                              cpu=atmega328           
                        ATmega328P (Old Bootloader)                                                                 cpu=atmega328old         
                        ATmega168                                                                                   cpu=atmega168           

You can see that there is one option. The human friendly name for this option, which you would see under the Arduino IDE's Tools menu when the board was selected, is "Processor". However, the FQBN is the way we identify the board to a machine, and this uses the option ID: cpu.

The cpu option has three possible settings:
  • atmega328
  • atmega328old
  • atmega168

You can see that the default value of this option is "atmega328". In the Arduino IDE, you would set this via the Tools > Processor > ATmega328P menu option. This is the appropriate option to use for official Arduino Nanos purchased in 2018 onward. You don't need to specify the default option via the FQBN, so if you have a modern officail Arduino Nano, you can simply use the FQBN arduino:avr:nano.

Before 2018, Arduino used a different bootloader on their Nano boards. If you have one of these boards with the old bootloader, you need to use the atmega328old option. The option id and value is appended to the base FQBN. So the FQBN to use for the Nano with the old bootloader is arduino:avr:nano:cpu=atmega328old

Clone and derivative Nano boards often have the old bootloader, but some have the new bootloader, and of course the sellers would never bother to tell you which it is. So if you have one of these boards, you'll just need to use trial and error to determine which of the options is appropriate for your board.

Some boards have multiple custom board options. To specify multiple options via the FQBN, just separate them with commas. For example:
Code: [Select]
esp8266:esp8266:generic:xtal=160,baud=57600
It doesn't matter which order the options are in.



In the case of boards with a lot of options, I will often just configure the board as I like in the Arduino IDE and then do a compilation of any sketch with verbose output during compilation enabled in File > Preferences, then just copy/paste the FQBN from the first line of the compilation output.

Go Up