Skip to content

Commit fc48c14

Browse files
committed
boards/arduino-nano-esp32: add board definition
1 parent 5136d23 commit fc48c14

File tree

10 files changed

+673
-0
lines changed

10 files changed

+673
-0
lines changed

boards/arduino-nano-esp32/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# SPDX-FileCopyrightText: 2025 Gunar Schorcht
2+
# SPDX-License-Identifier: LGPL-2.1-only
3+
4+
config BOARD
5+
default "arduino-nano-esp32" if BOARD_ARDUINO_NANO_ESP32
6+
7+
config BOARD_ARDUINO_NANO_ESP32
8+
bool
9+
default y
10+
select BOARD_COMMON_ESP32S3
11+
select CPU_MODEL_ESP32S3_R8
12+
13+
source "$(RIOTBOARD)/common/esp32s3/Kconfig"

boards/arduino-nano-esp32/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
MODULE = board
2+
3+
DIRS = $(RIOTBOARD)/common/esp32s3
4+
5+
include $(RIOTBASE)/Makefile.base
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ifneq (,$(filter saul_default,$(USEMODULE)))
2+
USEMODULE += saul_gpio
3+
endif
4+
5+
include $(RIOTBOARD)/common/esp32s3/stdio_esp32s3_default.dep.mk
6+
include $(RIOTBOARD)/common/esp32s3/Makefile.dep
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# the board uses a ESP32-S3 with embedded 8MB QSPI PSRAM and a 16MB QSPI Flash
2+
CPU_MODEL = esp32s3r8
3+
4+
# common board and CPU features
5+
include $(RIOTBOARD)/common/esp32s3/Makefile.features
6+
7+
# peripherals provided by the board
8+
FEATURES_PROVIDED += periph_adc
9+
FEATURES_PROVIDED += periph_i2c
10+
FEATURES_PROVIDED += periph_pwm
11+
FEATURES_PROVIDED += periph_spi
12+
FEATURES_PROVIDED += periph_usbdev
13+
14+
# other features provided by the board
15+
FEATURES_PROVIDED += arduino_analog
16+
FEATURES_PROVIDED += arduino_i2c
17+
FEATURES_PROVIDED += arduino_pins
18+
FEATURES_PROVIDED += arduino_pwm
19+
FEATURES_PROVIDED += arduino_spi
20+
FEATURES_PROVIDED += arduino_uart
21+
22+
FEATURES_PROVIDED += esp_jtag
23+
FEATURES_PROVIDED += highlevel_stdio
24+
FEATURES_PROVIDED += tinyusb_device
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# the board uses a ESP32-S3 with embedded 8MB QSPI PSRAM and a 16MB QSPI Flash
2+
FLASH_SIZE ?= 16
3+
4+
PORT_LINUX ?= /dev/ttyACM0
5+
6+
OPENOCD_CONFIG ?= board/esp32s3-builtin.cfg
7+
8+
include $(RIOTBOARD)/common/esp32s3/Makefile.include

boards/arduino-nano-esp32/doc.md

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2025 Gunar Schorcht
3+
SPDX-License-Identifier: LGPL-2.1-only
4+
-->
5+
6+
@defgroup boards_arduino_nano_esp32 Arduino Nano ESP32
7+
@ingroup boards
8+
@ingroup boards_esp32s3
9+
@brief Support for the Arduino Nano ESP32 board
10+
@author Gunar Schorcht <[email protected]>
11+
12+
\section arduino_nano_esp32 Arduino Nano ESP32
13+
14+
## Table of Contents {#arduino_nano_esp32_toc}
15+
16+
-# [Overview](#arduino_nano_esp32_overview)
17+
-# [Hardware](#arduino_nano_esp32_hardware)
18+
-# [MCU](#arduino_nano_esp32_mcu)
19+
-# [Board Configuration](#arduino_nano_esp32_board_configuration)
20+
-# [Board Pinout](#arduino_nano_esp32_pinout)
21+
-# [Flashing the Device](#arduino_nano_esp32_flashing)
22+
-# [Using STDIO](#arduino_nano_esp32_stdio)
23+
24+
## Overview {#arduino_nano_esp32_overview}
25+
26+
The [Arduino Nano ESP32](https://docs.arduino.cc/hardware/nano-esp32/) is an
27+
ESP32-S3 board in Arduino Nano format that uses the u-Blox NORA-W106 module.
28+
@image html https://store.arduino.cc/cdn/shop/files/ABX00092_00.default_643x483.jpg "Arduino Nano ESP32" width=400px
29+
30+
The main features of the board are:
31+
32+
- ESP32-S3 SoC with 2.4 GHz WiFi 802.11b/g/n and Bluetooth5, BLE
33+
- 8 MByte embedded QSPI RAM
34+
- 16 MByte Flash
35+
- RGB LED with separate colour LEDs
36+
- Native USB and USB Serial JTAG
37+
38+
[Back to table of contents](#arduino_nano_esp32_toc)
39+
40+
## Hardware {#arduino_nano_esp32_hardware}
41+
42+
This section describes
43+
44+
- the [MCU](#arduino_nano_esp32_mcu),
45+
- the default [board configuration](#arduino_nano_esp32_board_configuration),
46+
- the [board pinout](#arduino_nano_esp32_pinout).
47+
48+
[Back to table of contents](#arduino_nano_esp32_toc)
49+
50+
### MCU {#arduino_nano_esp32_mcu}
51+
52+
Most features of the board are provided by the ESP32-S3 SoC. For detailed
53+
information about the ESP32-S3 SoC variant (family) and ESP32x SoCs,
54+
see section \ref esp32_mcu_esp32 "ESP32 SoC Series".
55+
56+
[Back to table of contents](#arduino_nano_esp32_toc)
57+
58+
### Board Configuration {#arduino_nano_esp32_board_configuration}
59+
60+
Arduino Nano ESP32 boards have no special hardware on board with the exception
61+
of an RGB-LED with separate LEDs for each color.
62+
63+
The board configuration provides:
64+
65+
- 8 x ADC channels (4 x ADC channels if module `periph_i2c` is used)
66+
- 1 x SPI
67+
- 1 x I2C
68+
- 1 x UART
69+
- 2 x PWM (4 channels on PWM_DEV(0), 3 RGB LED channels on PWM_DEV(1))
70+
71+
The following table shows the default board configuration, which is sorted
72+
according to the defined functionality of GPIOs. This configuration can be
73+
overridden by \ref esp32_application_specific_configurations
74+
"application-specific configurations".
75+
76+
<center>
77+
Function | GPIOs | Remarks | Configuration
78+
:---------------|:-------|:--------|:----------------------------------
79+
ADC_LINE(0) | GPIO1 | | \ref esp32_adc_channels "ADC Channels"
80+
ADC_LINE(1) | GPIO2 | | \ref esp32_adc_channels "ADC Channels"
81+
ADC_LINE(2) | GPIO3 | | \ref esp32_adc_channels "ADC Channels"
82+
ADC_LINE(3) | GPIO4 | | \ref esp32_adc_channels "ADC Channels"
83+
ADC_LINE(4) | GPIO11 | N/A if `periph_i2c` is used | \ref esp32_adc_channels "ADC Channels"
84+
ADC_LINE(5) | GPIO12 | N/A if `periph_i2c` is used | \ref esp32_adc_channels "ADC Channels"
85+
ADC_LINE(6) | GPIO13 | N/A if `periph_i2c` is used | \ref esp32_adc_channels "ADC Channels"
86+
ADC_LINE(7) | GPIO14 | N/A if `periph_i2c` is used | \ref esp32_adc_channels "ADC Channels"
87+
PWM_DEV(0):0 | GPIO6 | | \ref esp32_pwm_channels "PWM Channels"
88+
PWM_DEV(0):1 | GPIO8 | | \ref esp32_pwm_channels "PWM Channels"
89+
PWM_DEV(0):2 | GPIO9 | | \ref esp32_pwm_channels "PWM Channels"
90+
PWM_DEV(0):3 | GPIO18 | | \ref esp32_pwm_channels "PWM Channels"
91+
PWM_DEV(1):0 | GPIO46 | LED red | \ref esp32_pwm_channels "PWM Channels"
92+
PWM_DEV(1):1 | GPIO0 | LED green | \ref esp32_pwm_channels "PWM Channels"
93+
PWM_DEV(1):2 | GPIO45 | LED blue | \ref esp32_pwm_channels "PWM Channels"
94+
I2C_DEV(0):SCL | GPIO12 | | \ref esp32_i2c_interfaces "I2C Interfaces"
95+
I2C_DEV(0):SDA | GPIO11 | | \ref esp32_i2c_interfaces "I2C Interfaces"
96+
SPI_DEV(0):CLK | GPIO48 | SPI2_HOST (FSPI) is used | \ref esp32_spi_interfaces "SPI Interfaces"
97+
SPI_DEV(0):MISO | GPIO47 | SPI2_HOST (FSPI) is used | \ref esp32_spi_interfaces "SPI Interfaces"
98+
SPI_DEV(0):MOSI | GPIO38 | SPI2_HOST (FSPI) is used | \ref esp32_spi_interfaces "SPI Interfaces"
99+
SPI_DEV(0):CS0 | GPIO21 | SPI2_HOST (FSPI) is used | \ref esp32_spi_interfaces "SPI Interfaces"
100+
UART_DEV(0):TxD | GPIO43 | Console (fixed) | \ref esp32_uart_interfaces "UART interfaces"
101+
UART_DEV(0):RxD | GPIO44 | Console (fixed) | \ref esp32_uart_interfaces "UART interfaces"
102+
</center>
103+
\n
104+
105+
For detailed information about the peripheral configurations of ESP32-S3
106+
boards, see section \ref esp32_peripherals "Common Peripherals".
107+
108+
[Back to table of contents](#arduino_nano_esp32_toc)
109+
110+
### Board Pinout {#arduino_nano_esp32_pinout}
111+
112+
The following figure shows the pinout as configured by board definition.
113+
114+
@image html https://edistechlab.com/wp-content/uploads/2023/11/Pinout_arduino_nano_esp32.png "Arduino Nano ESP32 Pinout" width=600px
115+
116+
An advanced pinout version with front view, back view and some additional
117+
information can be found
118+
[here](https://docs.arduino.cc/resources/pinouts/ABX00083-full-pinout.pdf).
119+
The corresponding board schematic can be found
120+
[here](https://docs.arduino.cc/resources/schematics/ABX00083-schematics.pdf).
121+
122+
[Back to table of contents](#arduino_nano_esp32_toc)
123+
124+
## Flashing the Device {#arduino_nano_esp32_flashing}
125+
126+
Since the board does not have a USB-to-Serial chip, the easiest way to flash
127+
the board is using the USB Serial/JTAG interface. Just connect the board to
128+
your host computer and use the following command:
129+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130+
BOARD=arduino-nano-esp32 make flash ...
131+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132+
133+
@note Usually the make system resets the board before flashing to enable the
134+
USB Serial/JTAG interface. In some special cases this reset does not work so
135+
that the programmer cannot connect to the board and the flashing is aborted
136+
with a timeout:
137+
```
138+
Serial port /dev/ttyACM0
139+
Connecting...
140+
...
141+
serial.serialutil.SerialTimeoutException: Write timeout
142+
```
143+
This can happen for example if the board is not yet flashed with RIOT or the
144+
USB interface is used for another purpose. In this case, restart the board
145+
manually in download mode by pressing and releasing the RESET button while
146+
pulling down the GPIO0 (B1) pin. In download mode, the USB Serial/JTAG
147+
interface is always available.
148+
149+
Alternatively, an external USB-to-Serial adapter can be used. In this case,
150+
the USB-to-Serial adapter has to be connected to TxD (GPIO43) and RxD (GPIO44)
151+
of the UART0 interface. Before RIOT can be flashed, the board has also to be
152+
switched to download mode. To do this, press and release the RESET button
153+
while pulling down the GPIO0 (B1) pin. Once the board is in download mode, use
154+
the following command to flash RIOT:
155+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156+
BOARD=arduino-nano-esp32 make flash ...
157+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
158+
159+
For detailed information about ESP32-S3 as well as configuring and compiling
160+
RIOT for ESP32-S3 boards, see \ref esp32_riot.
161+
162+
[Back to table of contents](#arduino_nano_esp32_toc)
163+
164+
## Using STDIO {#arduino_nano_esp32_stdio}
165+
166+
Since the board does not have a USB-to-Serial chip, the USB Serial/JTAG
167+
interface is used by default for the STDIO (module `stdio_usb_serial_jtag`)
168+
which provides an USB CDC ACM interface.
169+
170+
If the USB port is used by the USBUS stack or the tinyUSB stack, implicitly
171+
the module `stdio_cdc_acm` or `stdio_tinyusb_cdc_acm` is used for the STDIO
172+
via the USB CDC ACM interface.
173+
174+
Alternatively, the UART interface could be used with an external USB-to-Serial
175+
adapter. Simply add `stdio_uart` to the list of used modules for this purpose:
176+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
177+
BOARD=arduino-nano-esp32 USEMODULE=stdio_uart make flash ...
178+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2018 Gunar Schorcht
3+
* SPDX-License-Identifier: LGPL-2.1-only
4+
*/
5+
6+
#pragma once
7+
8+
/**
9+
* @ingroup boards_esp32_esp-wrover-kit
10+
* @{
11+
*
12+
* @file
13+
* @brief Mapping from MCU pins to Arduino pins
14+
*
15+
* @author Gunar Schorcht <[email protected]>
16+
*/
17+
18+
#include "periph/gpio.h"
19+
#include "periph/adc.h"
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
/**
26+
* @name Mapping of MCU pins to Arduino pins
27+
* @{
28+
*/
29+
#define ARDUINO_PIN_0 GPIO44 /**< Arduino pin 0 (RxD) */
30+
#define ARDUINO_PIN_1 GPIO43 /**< Arduino pin 1 (TxD) */
31+
32+
#define ARDUINO_PIN_2 GPIO5 /**< Arduino pin 2 (PWM) */
33+
#define ARDUINO_PIN_3 GPIO6 /**< Arduino pin 3 (PWM) */
34+
#define ARDUINO_PIN_4 GPIO7 /**< Arduino pin 4 (PWM) */
35+
#define ARDUINO_PIN_5 GPIO8 /**< Arduino pin 5 (PWM) */
36+
#define ARDUINO_PIN_6 GPIO9 /**< Arduino pin 6 (PWM) */
37+
#define ARDUINO_PIN_7 GPIO10 /**< Arduino pin 7 (PWM) */
38+
#define ARDUINO_PIN_8 GPIO17 /**< Arduino pin 8 (PWM) */
39+
#define ARDUINO_PIN_9 GPIO18 /**< Arduino pin 9 (PWM) */
40+
41+
#define ARDUINO_PIN_10 GPIO21 /**< Arduino pin 10 (CS0) */
42+
#define ARDUINO_PIN_11 GPIO38 /**< Arduino pin 11 (MOSI) */
43+
#define ARDUINO_PIN_12 GPIO47 /**< Arduino pin 12 (MISO) */
44+
#define ARDUINO_PIN_13 GPIO48 /**< Arduino pin 13 (SCK) */
45+
46+
#define ARDUINO_PIN_14 GPIO46 /**< Arduino pin 14 (LED red) */
47+
#define ARDUINO_PIN_15 GPIO0 /**< Arduino pin 15 (LED green) */
48+
#define ARDUINO_PIN_16 GPIO45 /**< Arduino pin 16 (LED blue) */
49+
50+
#define ARDUINO_PIN_17 GPIO1 /**< Arduino pin 17 (A0) */
51+
#define ARDUINO_PIN_18 GPIO2 /**< Arduino pin 18 (A1) */
52+
#define ARDUINO_PIN_19 GPIO3 /**< Arduino pin 19 (A2) */
53+
#define ARDUINO_PIN_20 GPIO4 /**< Arduino pin 20 (A3) */
54+
#define ARDUINO_PIN_21 GPIO11 /**< Arduino pin 21 (A4 / SDA) */
55+
#define ARDUINO_PIN_22 GPIO12 /**< Arduino pin 22 (A5 / SCL) */
56+
#define ARDUINO_PIN_23 GPIO13 /**< Arduino pin 23 (A6) */
57+
#define ARDUINO_PIN_24 GPIO14 /**< Arduino pin 24 (A7) */
58+
59+
#define ARDUINO_PIN_LAST 24 /**< Last Arduino pin index */
60+
/** @} */
61+
62+
/**
63+
* @name Aliases for analog pins
64+
* @{
65+
*/
66+
#define ARDUINO_PIN_A0 ARDUINO_PIN_17 /**< Arduino pin A0 */
67+
#define ARDUINO_PIN_A1 ARDUINO_PIN_18 /**< Arduino pin A1 */
68+
#define ARDUINO_PIN_A2 ARDUINO_PIN_19 /**< Arduino pin A2 */
69+
#define ARDUINO_PIN_A3 ARDUINO_PIN_20 /**< Arduino pin A3 */
70+
#if !MODULE_PERIPH_I2C
71+
# define ARDUINO_PIN_A4 ARDUINO_PIN_21 /**< Arduino pin A4 */
72+
# define ARDUINO_PIN_A5 ARDUINO_PIN_22 /**< Arduino pin A5 */
73+
# define ARDUINO_PIN_A6 ARDUINO_PIN_23 /**< Arduino pin A6 */
74+
# define ARDUINO_PIN_A7 ARDUINO_PIN_24 /**< Arduino pin A7 */
75+
#endif
76+
/** @} */
77+
78+
/**
79+
* @name Mapping of Arduino analog pins to RIOT ADC lines
80+
* @{
81+
*/
82+
#define ARDUINO_A0 ADC_LINE(0) /**< ADC line for Arduino pin A0 */
83+
#define ARDUINO_A1 ADC_LINE(1) /**< ADC line for Arduino pin A1 */
84+
#define ARDUINO_A2 ADC_LINE(2) /**< ADC line for Arduino pin A2 */
85+
#define ARDUINO_A3 ADC_LINE(3) /**< ADC line for Arduino pin A3 */
86+
#if !MODULE_PERIPH_I2C
87+
# define ARDUINO_A4 ADC_LINE(4) /**< ADC line for Arduino pin A4 */
88+
# define ARDUINO_A5 ADC_LINE(5) /**< ADC line for Arduino pin A5 */
89+
# define ARDUINO_A6 ADC_LINE(6) /**< ADC line for Arduino pin A6 */
90+
# define ARDUINO_A7 ADC_LINE(7) /**< ADC line for Arduino pin A7 */
91+
#endif
92+
93+
#if !MODULE_PERIPH_I2C
94+
# define ARDUINO_ANALOG_PIN_LAST 7 /**< Last Arduino analog pin index */
95+
#else
96+
# define ARDUINO_ANALOG_PIN_LAST 3 /**< Last Arduino analog pin index */
97+
#endif
98+
/** @} */
99+
100+
/**
101+
* @name Mapping of Arduino pins to RIOT PWM dev and channel pairs
102+
* @{
103+
*/
104+
#define ARDUINO_PIN_2_PWM_DEV PWM_DEV(0) /**< PWM device for Arduino pin 2 */
105+
#define ARDUINO_PIN_2_PWM_CHAN 0 /**< PWM channel for Arduino pin 2 */
106+
#define ARDUINO_PIN_3_PWM_DEV PWM_DEV(0) /**< PWM device for Arduino pin 3 */
107+
#define ARDUINO_PIN_3_PWM_CHAN 1 /**< PWM channel for Arduino pin 3 */
108+
#define ARDUINO_PIN_4_PWM_DEV PWM_DEV(0) /**< PWM device for Arduino pin 4 */
109+
#define ARDUINO_PIN_4_PWM_CHAN 2 /**< PWM channel for Arduino pin 4 */
110+
#define ARDUINO_PIN_5_PWM_DEV PWM_DEV(0) /**< PWM device for Arduino pin 5 */
111+
#define ARDUINO_PIN_5_PWM_CHAN 3 /**< PWM channel for Arduino pin 5 */
112+
#define ARDUINO_PIN_6_PWM_DEV PWM_DEV(0) /**< PWM device for Arduino pin 6 */
113+
#define ARDUINO_PIN_6_PWM_CHAN 4 /**< PWM channel for Arduino pin 6 */
114+
#define ARDUINO_PIN_7_PWM_DEV PWM_DEV(0) /**< PWM device for Arduino pin 7 */
115+
#define ARDUINO_PIN_7_PWM_CHAN 5 /**< PWM channel for Arduino pin 7 */
116+
#define ARDUINO_PIN_8_PWM_DEV PWM_DEV(0) /**< PWM device for Arduino pin 8 */
117+
#define ARDUINO_PIN_8_PWM_CHAN 6 /**< PWM channel for Arduino pin 8 */
118+
#define ARDUINO_PIN_9_PWM_DEV PWM_DEV(0) /**< PWM device for Arduino pin 9 */
119+
#define ARDUINO_PIN_9_PWM_CHAN 7 /**< PWM channel for Arduino pin 9 */
120+
#define ARDUINO_PIN_14_PWM_DEV PWM_DEV(1) /**< PWM device for Arduino pin 14 */
121+
#define ARDUINO_PIN_14_PWM_CHAN 0 /**< PWM channel for Arduino pin 14 */
122+
#define ARDUINO_PIN_15_PWM_DEV PWM_DEV(1) /**< PWM device for Arduino pin 15 */
123+
#define ARDUINO_PIN_15_PWM_CHAN 1 /**< PWM channel for Arduino pin 15 */
124+
#define ARDUINO_PIN_16_PWM_DEV PWM_DEV(1) /**< PWM device for Arduino pin 16 */
125+
#define ARDUINO_PIN_16_PWM_CHAN 2 /**< PWM channel for Arduino pin 16 */
126+
/** @} */
127+
128+
#ifdef __cplusplus
129+
}
130+
#endif
131+
132+
/** @} */

0 commit comments

Comments
 (0)