Skip to content

Commit a9383cb

Browse files
committed
example(camera): added new camera dsi example
1 parent ea010f8 commit a9383cb

File tree

13 files changed

+575
-1
lines changed

13 files changed

+575
-1
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ examples/peripherals/analog_comparator:
2424
- esp_driver_gpio
2525
- esp_driver_ana_cmpr
2626

27+
examples/peripherals/camera/camera_dsi:
28+
disable:
29+
- if: SOC_MIPI_CSI_SUPPORTED != 1 or SOC_MIPI_DSI_SUPPORTED != 1
30+
depends_components:
31+
- esp_lcd
32+
- esp_driver_cam
33+
2734
examples/peripherals/dac:
2835
disable:
2936
- if: SOC_DAC_SUPPORTED != 1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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+
project(camera_dsi)
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
| Supported Targets | ESP32-P4 |
2+
| ----------------- | -------- |
3+
4+
5+
# Camera display via DSI example
6+
7+
## Overview
8+
9+
This example demonstrates how to use the esp_driver_cam component to capture camera sensor signals and display it via DSI 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+
This example requires:
19+
20+
- OV5647 camera sensor with VCM (Voice Coil Motor). The VCM used in this example is DW9714.
21+
- ILI9881C LCD screen
22+
- ESP32P4 devkit
23+
24+
25+
GND GND
26+
┌────────────────────────────────────────────────┐ ┌─────────────────────────────────────────────────────────┐
27+
│ │ │ │
28+
│ │ │ │
29+
│ │ │ │
30+
│ │ │ │
31+
│ │ │ │
32+
│ │ │ │
33+
│ │ │ │
34+
│ │ │ │
35+
│ ┌───────────────┴─────────────┴──────────────────┐ │
36+
│ │ │ ┌──────────┴───────────┐
37+
│ │ │ DSI DATA 1P │ │
38+
│ │ ├───────────────────────────┤ │
39+
┌───────────┴─────────┐ CSI DATA 1P │ │ │ │
40+
│ ├──────────────────────┤ │ DSI DATA 1N │ │
41+
│ │ │ ├───────────────────────────┤ │
42+
│ │ CSI DATA 1N │ ESP32-P4 │ │ │
43+
│ OV5647 ├──────────────────────┤ │ DSI CLK N │ ILI9881C │
44+
│ │ │ ├───────────────────────────┤ │
45+
│ │ CSI CLK N │ │ │ │
46+
│ ├──────────────────────┤ │ DSI CLK P │ │
47+
│ │ │ ├───────────────────────────┤ │
48+
│ │ CSI CLK P │ │ │ │
49+
│ ├──────────────────────┤ │ DSI DATA 0P │ │
50+
│ │ │ ├───────────────────────────┤ │
51+
│ │ CSI DATA 0P │ │ │ │
52+
│ ├──────────────────────┤ │ DSI DATA 0N │ │
53+
│ │ │ ├───────────────────────────┤ │
54+
│ │ CSI DATA 0N │ │ │ │
55+
│ ├──────────────────────┤ │ └──────────────────────┘
56+
│ │ │ │
57+
└───────┬──┬──────────┘ │ │
58+
│ │ I2C SCL │ │
59+
│ └─────────────────────────────────┤ │
60+
│ I2C SDA │ │
61+
└────────────────────────────────────┤ │
62+
└────────────────────────────────────────────────┘
63+
64+
65+
### Set Chip Target
66+
67+
First of all, your target must be supported by both:
68+
69+
- **By your ESP-IDF version**: For the full list of supported targets, run:
70+
```
71+
idf.py --list-targets
72+
```
73+
- **By this example**: For the full list of supported targets, refer to the supported targets table at the top of this README.
74+
75+
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):
76+
77+
```
78+
idf.py set-target <target>
79+
```
80+
81+
For example, to set esp32-P4 as the chip target, run:
82+
83+
```
84+
idf.py set-target esp32p4
85+
```
86+
87+
88+
### Configure the Project
89+
90+
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)_.
91+
92+
To conveniently check or modify Kconfig options for this example in a project configuration menu, run:
93+
94+
```
95+
idf.py menuconfig
96+
```
97+
98+
```
99+
Set CONFIG_CAMERA_OV5647 to y
100+
```
101+
102+
103+
### Build and Flash
104+
105+
Execute the following command to build the project, flash it to your development board, and run the monitor tool to view the serial output:
106+
107+
```
108+
idf.py build flash monitor
109+
```
110+
111+
This command can be reduced to `idf.py flash monitor`.
112+
113+
If the above command fails, check the log on the serial monitor which usually provides information on the possible cause of the issue.
114+
115+
To exit the serial monitor, use `Ctrl` + `]`.
116+
117+
118+
## Example Output
119+
120+
If you see the following console output, your example should be running correctly:
121+
122+
```
123+
I (1085) main_task: Calling app_main()
124+
I (1095) ili9881c: ID1: 0x98, ID2: 0x81, ID3: 0x5c
125+
I (1125) gpio: GPIO[31]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
126+
I (1125) gpio: GPIO[34]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0
127+
I (1295) ov5647: Detected Camera sensor PID=0x5647 with index 0
128+
I (1305) cam_dsi: fmt[0].name:MIPI_2lane_24Minput_RAW8_800x1280_50fps
129+
I (1305) cam_dsi: fmt[1].name:MIPI_2lane_24Minput_RAW8_800x640_50fps
130+
I (1315) cam_dsi: fmt[2].name:MIPI_2lane_24Minput_RAW8_800x800_50fps
131+
I (1355) cam_dsi: Format in use:MIPI_2lane_24Minput_RAW8_800x640_50fps
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 "camera_dsi_main.c" "example_dsi_init.c"
2+
INCLUDE_DIRS "."
3+
REQUIRES esp_mm esp_driver_isp esp_driver_cam esp_driver_i2c esp_lcd
4+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
menu "Example Configuration"
2+
config EXAMPLE_USED_LDO_CHAN_ID
3+
int "example used LDO channel ID"
4+
default 3
5+
help
6+
Example used LDO channel ID, you may check datasheet to know more details.
7+
8+
config EXAMPLE_USED_LDO_VOLTAGE_MV
9+
int "example used LDO voltage in mV"
10+
default 2500
11+
range 0 3300
12+
help
13+
Example used LDO voltage, in mV
14+
15+
choice EXAMPLE_MIPI_CSI_VRES
16+
bool "Set MIPI CSI verticol resolution"
17+
default EXAMPLE_MIPI_CSI_VRES_640
18+
19+
config EXAMPLE_MIPI_CSI_VRES_640
20+
bool "640"
21+
config EXAMPLE_MIPI_CSI_VRES_1280
22+
bool "1280"
23+
endchoice
24+
25+
endmenu

0 commit comments

Comments
 (0)