Arduino-cli and esp32 Nano Pin Numberig

Hello,

trying to program an Arduino ESP32 Nano with arduino-cli and have problems with an library.
In the IDE 2.3.3 it is possible to switch in the tools menu to Pin Numbering: By GPIO number,
this solves my problem.
How can I achieve this with arduino-cli?

Hi @arno64. When using Arduino CLI, custom board options like the "Pin Numbering" option of the Nano ESP32 board are set via --board-options flags added to the arduino-cli commands.

The format of the flag is like this:

--board-options "<menu ID>=<option ID>"

(where <menu ID> and <option ID> are placeholders for the custom board options menu and menu option you are setting)

You can learn all the available menu IDs and option IDs for a given board by running the following arduino-cli command:

arduino-cli board details --fqbn <FQBN>

(where <FQBN> is replaced by the fully qualified board name of the board you are using)

For example:

$ arduino-cli board details --fqbn arduino:esp32:nano_nora
Board name:                Arduino Nano ESP32
FQBN:                      arduino:esp32:nano_nora
Board version:             2.0.18-arduino.5

Official Arduino board:    ✔

Identification properties: pid=0x0070
                           vid=0x2341

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

Platform name:             Arduino ESP32 Boards
Platform category:         Arduino
Platform architecture:     esp32
Platform URL:              https://downloads.arduino.cc/cores/staging/esp32-v2.0.17-arduino.5.zip
Platform file name:        esp32-v2.0.17-arduino.5.zip
Platform size (bytes):     88321110
Platform checksum:         SHA-256:03596062ab1745bf7847d09900e2aebfc1f49cf123d47ba8a57d652e110cda5c

Required tool: arduino:dfu-util                       0.11.0-arduino5
Required tool: esp32:esptool_py                       4.5.1
Required tool: esp32:mklittlefs                       3.0.0-gnu12-dc7f933
Required tool: esp32:mkspiffs                         0.2.3
Required tool: esp32:openocd-esp32                    v0.12.0-esp32-20230921
Required tool: esp32:s3-gcc                           2021r2-p5
Required tool: esp32:xtensa-esp-elf-gdb               11.2_20220823

Option:        USB Mode                                                      USBMode
               Normal mode (TinyUSB)                  ✔                      USBMode=default
               Debug mode (Hardware CDC)                                     USBMode=hwcdc
Option:        Partition Scheme                                              PartitionScheme
               With FAT partition (default)           ✔                      PartitionScheme=default
               With SPIFFS partition (advanced)                              PartitionScheme=spiffs
Option:        Pin Numbering                                                 PinNumbers
               By Arduino pin (default)               ✔                      PinNumbers=default
               By GPIO number (legacy)                                       PinNumbers=byGPIONumber
Programmers:   ID                                     Name
               esptool                                Esptool

Here we can see that the ID for the "Pin Numbering" menu is PinNumbers and the ID for the "By GPIO number (legacy)" option is byGPIONumber.

So, if you wanted to compile a sketch with this custom board option, you would use the following command:

arduino-cli compile --fqbn arduino:esp32:nano_nora --board-options "PinNumbers=byGPIONumber"

You can add multiple --board-options flags to an arduino-cli command if you want to set multiple custom board options menus.


1 Like

Thank you so much ptillisch, this was very helpful. I was not able to find this information by
myself.. sorry..
Everything is running now. I`m happy..

1 Like

You are welcome. I'm glad it is working now.

Regards, Per