Skip to content

Commit b43daa6

Browse files
committed
feat(cam): add dvp example for ESP32S3-EYE
1 parent 638cde2 commit b43daa6

File tree

14 files changed

+513
-1
lines changed

14 files changed

+513
-1
lines changed

components/esp_driver_cam/dvp/src/esp_cam_ctlr_dvp_gdma.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ esp_err_t esp_cam_ctlr_dvp_dma_init(esp_cam_ctlr_dvp_dma_t *dma, uint32_t burst_
119119

120120
ESP_LOGD(TAG, "alignment_size: %d, dma->desc_count: %d, dma->desc_size: %d", alignment_size, dma->desc_count, dma->desc_size);
121121
dma->desc = heap_caps_aligned_alloc(alignment_size, dma->desc_size, DVP_GDMA_DESC_ALLOC_CAPS);
122+
122123
ESP_GOTO_ON_FALSE(dma->desc, ESP_ERR_NO_MEM, fail1, TAG, "no mem for DVP DMA descriptor");
123124

124125
return ESP_OK;

examples/peripherals/.build-test-rules.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ examples/peripherals/camera/dvp_isp_dsi:
5858
- esp_lcd
5959
- esp_driver_cam
6060

61+
examples/peripherals/camera/dvp_spi_lcd:
62+
disable:
63+
- if: SOC_LCDCAM_CAM_SUPPORTED != 1
64+
disable_test:
65+
- if: IDF_TARGET == "esp32s3"
66+
temporary: true
67+
reason: lack of runners
68+
depends_components:
69+
- esp_lcd
70+
- esp_driver_cam
71+
6172
examples/peripherals/camera/mipi_isp_dsi:
6273
disable:
6374
- if: SOC_MIPI_CSI_SUPPORTED != 1 or SOC_MIPI_DSI_SUPPORTED != 1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
dependencies:
2-
espressif/esp_cam_sensor: "^0.6.1"
2+
espressif/esp_cam_sensor: "^1.1.0"
33
idf:
44
version: ">=5.3.0"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# The following lines of boilerplate have to be in your project's CMakeLists
2+
# in this exact order for cmake to work correctly
3+
cmake_minimum_required(VERSION 3.16)
4+
5+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6+
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
7+
idf_build_set_property(MINIMAL_BUILD ON)
8+
project(dvp_spi_lcd)
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
| Supported Targets | ESP32-P4 | ESP32-S3 |
2+
| ----------------- | -------- | -------- |
3+
4+
5+
# DVP Camera display via LCD example
6+
7+
## Overview
8+
9+
This example demonstrates how to use the esp_driver_cam component to capture DVP camera sensor signals and display it via LCD interface. This example will auto-detect camera sensors via [ESP camera sensor driver](https://components.espressif.com/components/espressif/esp_cam_sensor) and capture camera sensor signals via DVP interface and display it via LCD interface.
10+
11+
## Usage
12+
13+
The subsections below give only absolutely necessary information. For full steps to configure ESP-IDF and use it to build and run projects, see [ESP-IDF Getting Started](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html#get-started).
14+
15+
16+
### Hardware Required
17+
18+
- ESP32S3 devkit with OV2640 camera sensor and ST7789 LCD screen
19+
- or an ESP32S3-EYE dev-kit
20+
21+
You can also connect camera sensors and LCD screens from other vendors to the ESP chip, you can find corresponding camera or LCD drivers from [ESP Component Registry](https://components.espressif.com), or design your own customized drivers.
22+
23+
24+
GND GND
25+
┌────────────────────────────────────────────────┐ ┌─────────────────────────────────────────────────────────┐
26+
│ │ │ │
27+
│ │ │ │
28+
│ │ │ │
29+
│ │ │ │
30+
│ │ │ │
31+
│ │ │ │
32+
│ │ │ │
33+
│ │ │ │
34+
│ ┌───────────────┴─────────────┴──────────────────┐ │
35+
│ │ │ ┌──────────┴───────────┐
36+
│ │ │ LCD MOSI │ │
37+
│ │ ├───────────────────────────┤ │
38+
┌───────────┴─────────┐ │ │ │ │
39+
│ │ │ │ LCD CLK │ │
40+
│ │ │ ├───────────────────────────┤ │
41+
│ │ XCLK │ ESP_CHIP │ │ │
42+
│ DVP Camera ├──────────────────────┤ │ LCD CS │ LCD Screen │
43+
│ │ │ ├───────────────────────────┤ │
44+
│ │ D0~7 │ │ │ │
45+
│ ├──────────────────────┤ │ LCD DC │ │
46+
│ │ │ ├───────────────────────────┤ │
47+
│ │ PCLK │ │ │ │
48+
│ ├──────────────────────┤ │ LCD BACKLIGHT │ │
49+
│ │ │ ├───────────────────────────┤ │
50+
│ │ VSYNC │ │ │ │
51+
│ ├──────────────────────┤ │ │ │
52+
│ │ │ │ │ │
53+
│ │ DE (HREF) │ │ │ │
54+
│ ├──────────────────────┤ │ └──────────────────────┘
55+
│ │ │ │
56+
└───────┬──┬──────────┘ │ │
57+
│ │ I2C SCL │ │
58+
│ └─────────────────────────────────┤ │
59+
│ I2C SDA │ │
60+
└────────────────────────────────────┤ │
61+
└────────────────────────────────────────────────┘
62+
63+
64+
### Set Chip Target
65+
66+
First of all, your target must be supported by both:
67+
68+
- **By your ESP-IDF version**: For the full list of supported targets, run:
69+
```
70+
idf.py --list-targets
71+
```
72+
- **By this example**: For the full list of supported targets, refer to the supported targets table at the top of this README.
73+
74+
After you make sure that your target is supported, go to your example project directory and [set the chip target](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/tools/idf-py.html#select-the-target-chip-set-target):
75+
76+
```
77+
idf.py set-target <target>
78+
```
79+
80+
For example, to set esp32-S3 as the chip target, run:
81+
82+
```
83+
idf.py set-target esp32s3
84+
```
85+
86+
87+
### Configure the Project
88+
89+
For information about Kconfig options, see [Project Configuration](https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/kconfig.html) > _Name of relevant section(s)_.
90+
91+
To conveniently check or modify Kconfig options for this example in a project configuration menu, run:
92+
93+
```
94+
idf.py menuconfig
95+
```
96+
97+
```
98+
Set CONFIG_CAMERA_OV2640 to y
99+
```
100+
101+
Available options for the camera sensor output horizontal/vertical resolution can be seen in ``menuconfig`` > ``Example Configuration``.
102+
103+
104+
### Build and Flash
105+
106+
Execute the following command to build the project, flash it to your development board, and run the monitor tool to view the serial output:
107+
108+
```
109+
idf.py build flash monitor
110+
```
111+
112+
This command can be reduced to `idf.py flash monitor`.
113+
114+
If the above command fails, check the log on the serial monitor which usually provides information on the possible cause of the issue.
115+
116+
To exit the serial monitor, use `Ctrl` + `]`.
117+
118+
119+
## Example Output
120+
121+
If you see the following console output, your example should be running correctly:
122+
123+
```
124+
I (1481) main_task: Calling app_main()
125+
I (278) dvp_spi_lcd: Init SPI bus
126+
I (278) dvp_spi_lcd: New panel IO SPI
127+
I (278) dvp_spi_lcd: New ST7789 panel
128+
I (278) dvp_spi_lcd: Reset and init panel
129+
I (408) dvp_spi_lcd: Turn on display
130+
I (408) dvp_spi_lcd: Screen lit up now!
131+
132+
```
133+
134+
135+
## Reference
136+
137+
- Link to the ESP-IDF feature's API reference, for example [ESP-IDF: Camera Controller Driver](https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/camera_driver.html)
138+
- [ESP-IDF Getting Started](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html#get-started)
139+
- [Project Configuration](https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/kconfig.html) (Kconfig Options)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
idf_component_register(SRCS "dvp_spi_lcd_main.c"
2+
INCLUDE_DIRS "."
3+
REQUIRES esp_mm esp_driver_cam esp_driver_i2c esp_lcd sensor_init
4+
)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
menu "Example Configuration"
2+
3+
choice EXAMPLE_CAM_HRES
4+
bool "Set camera horizontal resolution"
5+
default EXAMPLE_CAM_HRES_240
6+
7+
config EXAMPLE_CAM_HRES_640
8+
bool "640"
9+
config EXAMPLE_CAM_HRES_240
10+
bool "240"
11+
endchoice
12+
13+
config EXAMPLE_CAM_HRES
14+
int
15+
default 640 if EXAMPLE_CAM_HRES_640
16+
default 240 if EXAMPLE_CAM_HRES_240
17+
18+
choice EXAMPLE_CAM_VRES
19+
bool "Set camera vertical resolution"
20+
default EXAMPLE_CAM_VRES_480 if EXAMPLE_CAM_HRES_640
21+
default EXAMPLE_CAM_VRES_240 if EXAMPLE_CAM_HRES_240
22+
23+
config EXAMPLE_CAM_VRES_480
24+
bool "480"
25+
config EXAMPLE_CAM_VRES_240
26+
bool "240"
27+
endchoice
28+
29+
config EXAMPLE_CAM_VRES
30+
int
31+
default 480 if EXAMPLE_CAM_VRES_480
32+
default 240 if EXAMPLE_CAM_VRES_240
33+
endmenu

0 commit comments

Comments
 (0)