Skip to content

Commit ddf28d4

Browse files
walidbadarfabiobaltieri
authored andcommitted
boards: aithinker: Add inital support for esp32_cam
Add board files for Ai-Thinker ESP32-CAM Signed-off-by: Muhammad Waleed Badar <[email protected]>
1 parent 30e31fa commit ddf28d4

16 files changed

+443
-0
lines changed

boards/aithinker/esp32_cam/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (c) 2025 Muhammad Waleed Badar
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config HEAP_MEM_POOL_ADD_SIZE_BOARD
5+
int
6+
default 4096 if BOARD_ESP32_CAM_ESP32_PROCPU
7+
default 256 if BOARD_ESP32_CAM_ESP32_APPCPU
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Ai-Thinker ESP32-CAM board configuration
2+
3+
# Copyright (c) 2025 Muhammad Waleed Badar
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
if BOARD_ESP32_CAM_ESP32_PROCPU
7+
8+
config DISK_DRIVER_SDMMC
9+
default y
10+
11+
config ESP_SPIRAM
12+
default y if !MCUBOOT
13+
14+
choice SPIRAM_TYPE
15+
default SPIRAM_TYPE_ESPPSRAM64
16+
endchoice
17+
18+
endif # BOARD_ESP32_CAM_ESP32_PROCPU
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (c) 2025 Muhammad Waleed Badar
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_ESP32_CAM
5+
select SOC_ESP32_WROVER_E_N4R8
6+
select SOC_ESP32_PROCPU if BOARD_ESP32_CAM_ESP32_PROCPU
7+
select SOC_ESP32_APPCPU if BOARD_ESP32_CAM_ESP32_APPCPU
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
choice BOOTLOADER
5+
default BOOTLOADER_MCUBOOT
6+
endchoice
7+
8+
choice BOOT_SIGNATURE_TYPE
9+
default BOOT_SIGNATURE_TYPE_NONE
10+
endchoice
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if(NOT "${OPENOCD}" MATCHES "^${ESPRESSIF_TOOLCHAIN_PATH}/.*")
5+
set(OPENOCD OPENOCD-NOTFOUND)
6+
endif()
7+
8+
find_program(OPENOCD openocd PATHS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin NO_DEFAULT_PATH)
9+
10+
include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake)
11+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: esp32_cam
3+
full_name: Ai-Thinker ESP32-CAM
4+
vendor: aithinker
5+
socs:
6+
- name: esp32
13.2 KB
Loading
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
.. zephyr:board:: esp32_cam
2+
3+
Overview
4+
********
5+
6+
Ai-Thinker ESP32-CAM is an ESP32-based development board produced by `Ai-Thinker <https://en.ai-thinker.com/>`_.
7+
8+
ESP32-CAM features the following components:
9+
10+
- ESP32S module
11+
- 8MB PSRAM
12+
- 24-pin FPC connector (for OV2640 Sensor)
13+
- MicroSD card slot
14+
- Flash LED
15+
16+
.. note::
17+
18+
ESP32's GPIO4 on the ESP32 is shared between the MicroSD data pin and the onboard flash LED.
19+
20+
For more information, check the datasheet at `ESP32 Datasheet`_ or the technical reference
21+
manual at `ESP32 Technical Reference Manual`_.
22+
23+
Supported Features
24+
******************
25+
26+
.. zephyr:board-supported-hw::
27+
28+
System requirements
29+
*******************
30+
31+
Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command
32+
below to retrieve those files.
33+
34+
.. code-block:: console
35+
36+
west blobs fetch hal_espressif
37+
38+
.. note::
39+
40+
It is recommended running the command above after :file:`west update`.
41+
42+
Programming and Debugging
43+
*************************
44+
45+
.. zephyr:board-supported-runners::
46+
47+
.. include:: ../../../espressif/common/building-flashing.rst
48+
:start-after: espressif-building-flashing
49+
50+
.. include:: ../../../espressif/common/board-variants.rst
51+
:start-after: espressif-board-variants
52+
53+
Applications for the ``esp32_cam`` board can be built and flashed in the usual way
54+
(see :ref:`build_an_application` and :ref:`application_run` for more details);
55+
however, an external FTDI USB to TTL Serial Adapter is required since the board
56+
does not have any on-board debug IC.
57+
58+
The following pins of the Serial Adapter must be connected to the header pins:
59+
60+
* VTref = VCC
61+
* GND = GND
62+
* TXD = U0TXD
63+
* RXD = U0RXD
64+
* Boot = GPIO0 (Must be low at boot)
65+
66+
Debugging
67+
=========
68+
69+
ESP32 support on OpenOCD is available at `OpenOCD ESP32`_.
70+
71+
+------------+-----------+
72+
| ESP32 pin | JTAG pin |
73+
+============+===========+
74+
| 3V3 | VTRef |
75+
+------------+-----------+
76+
| IO14 | TMS |
77+
+------------+-----------+
78+
| IO12 | TDI |
79+
+------------+-----------+
80+
| GND | GND |
81+
+------------+-----------+
82+
| IO13 | TCK |
83+
+------------+-----------+
84+
| IO15 | TDO |
85+
+------------+-----------+
86+
87+
Further documentation can be obtained from the SoC vendor in `JTAG debugging for ESP32`_.
88+
89+
Here is an example for building the :zephyr:code-sample:`hello_world` application.
90+
91+
.. zephyr-app-commands::
92+
:zephyr-app: samples/hello_world
93+
:board: esp32_cam/esp32/procpu
94+
:goals: build flash
95+
96+
References
97+
**********
98+
99+
.. target-notes::
100+
101+
.. _`ESP32-CAM`: https://docs.ai-thinker.com/en/esp32-cam
102+
.. _`ESP32 Datasheet`: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf
103+
.. _`ESP32 Technical Reference Manual`: https://espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf
104+
.. _`JTAG debugging for ESP32`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/jtag-debugging/index.html
105+
.. _`OpenOCD ESP32`: https://github.com/espressif/openocd-esp32/releases
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright (c) 2025 Muhammad Waleed Badar
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/dt-bindings/pinctrl/esp-pinctrl-common.h>
8+
#include <dt-bindings/pinctrl/esp32-pinctrl.h>
9+
#include <zephyr/dt-bindings/pinctrl/esp32-gpio-sigmap.h>
10+
11+
&pinctrl {
12+
uart0_default: uart0_default {
13+
group1 {
14+
pinmux = <UART0_TX_GPIO1>;
15+
output-high;
16+
};
17+
18+
group2 {
19+
pinmux = <UART0_RX_GPIO3>;
20+
bias-pull-up;
21+
};
22+
};
23+
24+
i2c0_default: i2c0_default {
25+
group1 {
26+
pinmux = <I2C0_SDA_GPIO26>,
27+
<I2C0_SCL_GPIO27>;
28+
bias-pull-up;
29+
drive-open-drain;
30+
output-high;
31+
};
32+
};
33+
34+
spim2_default: spim2_default {
35+
group1 {
36+
pinmux = <SPIM2_MISO_GPIO12>,
37+
<SPIM2_SCLK_GPIO14>,
38+
<SPIM2_CSEL_GPIO15>;
39+
};
40+
41+
group2 {
42+
pinmux = <SPIM2_MOSI_GPIO13>;
43+
output-low;
44+
};
45+
};
46+
47+
sdhc0_default: sdhc0_default {
48+
group1 {
49+
pinmux = <SDHC0_CD_GPIO21>;
50+
bias-pull-up;
51+
output-high;
52+
};
53+
};
54+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) 2025 Muhammad Waleed Badar
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/dts-v1/;
7+
8+
#include <espressif/esp32/esp32_appcpu.dtsi>
9+
#include <espressif/partitions_0x1000_amp.dtsi>
10+
11+
/ {
12+
model = "Ai-Thinker ESP32-CAM APPCPU";
13+
compatible = "aithinker,esp32-cam";
14+
15+
chosen {
16+
zephyr,sram = &sram1;
17+
zephyr,ipc_shm = &shm0;
18+
zephyr,ipc = &ipm0;
19+
zephyr,flash = &flash0;
20+
zephyr,code-partition = &slot0_appcpu_partition;
21+
};
22+
};
23+
24+
&ipm0 {
25+
status = "okay";
26+
};
27+
28+
&trng0 {
29+
status = "okay";
30+
};

0 commit comments

Comments
 (0)