Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 160 additions & 0 deletions application/edge_agent/boards/guition/jc1060p470/board_devices.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
version: 1.0.0
# Devices Configuration
devices:
- name: audio_dac
chip: es8311 # Codec chip (ES8311)
type: audio_codec
version: default
config:
# DAC Configuration (for audio output)
dac_enabled: true
dac_max_channel: 1 # ES8311 support 1 DAC channel (default right channel, REG:0x09 - SDP_IN_SEL)
dac_channel_mask: "1" # Enable left channel
mclk_enabled: true # MCLK pin (GPIO13) is wired to ES8311; tell driver to use external MCLK

peripherals:
- name: gpio_pa_control
gain: 6
active_level: 1

# I2S interface for audio output
- name: i2s_audio_out

# I2C interface for codec control
- name: i2c_master
address: 0x30
frequency: 400000

- name: audio_adc
chip: es8311 # Codec chip (ES8311)
type: audio_codec
version: default
config:
# ADC Configuration (for audio input)
adc_enabled: true
adc_max_channel: 2 # ES8311 support 1 ADC channel and 1 DAC echo channel, default:ADCL + DACR, refer 8311 datasheet REG44 `ADCDAT_SEL`
adc_channel_mask: "11" # Enable both left and right channels
adc_channel_labels: [RE, FC] # DAC reference and ADC microphone
mclk_enabled: true # MCLK pin (GPIO13) is wired to ES8311; required for stable ADC sampling clock

# Peripheral configuration
peripherals:
# I2S interface for audio input
- name: i2s_audio_in

# I2C interface for codec control
- name: i2c_master
address: 0x30
frequency: 400000

- name: fs_sdcard
type: fs_fat
sub_type: sdmmc
version: default
config:
sub_config:
# Use SDMMC slot 0
slot: SDMMC_HOST_SLOT_0
frequency: SDMMC_FREQ_HIGHSPEED
bus_width: 4
# If using slot 0, the pin must be configured as 0, the IO pins actually used are configured by the SDMMC driver
# For more details, please check https://github.com/espressif/esp-idf/blob/v5.5.1/components/esp_driver_sdmmc/src/sdmmc_host.c#L668
pins:
clk: 0
cmd: 0
d0: 0
d1: 0
d2: 0
d3: 0
d4: 0
d5: 0
d6: 0
d7: 0
ldo_chan_id: 4 # Use LDO_VO4 to power SDMMC IO

# DSI Display Device
- name: display_lcd
chip: jd9165
type: display_lcd
sub_type: dsi
dependencies:
espressif/esp_lcd_jd9165: "^2.0.2"
config:
reset_gpio_num: 0
rgb_ele_order: LCD_RGB_ELEMENT_ORDER_RGB
data_endian: LCD_RGB_DATA_ENDIAN_LITTLE
bits_per_pixel: 24
reset_active_high: 0
dbi_config:
virtual_channel: 0
lcd_cmd_bits: 8
lcd_param_bits: 8
dpi_config:
virtual_channel: 0
dpi_clk_src: MIPI_DSI_DPI_CLK_SRC_DEFAULT
dpi_clock_freq_mhz: 52
pixel_format: LCD_COLOR_PIXEL_FORMAT_RGB565
in_color_format: LCD_COLOR_FMT_RGB565
out_color_format: LCD_COLOR_FMT_RGB565
num_fbs: 1
flags:
use_dma2d: false
disable_lp: false
video_timing:
h_size: 1024
v_size: 600
hsync_back_porch : 136
hsync_pulse_width : 24
hsync_front_porch : 160
vsync_back_porch : 21
vsync_pulse_width : 2
vsync_front_porch : 12
peripherals:
- name: ldo_mipi
- name: dsi_display

# Touch Panel Configuration
- name: lcd_touch
chip: gt911
type: lcd_touch_i2c
version: default
dependencies:
esp_lcd_touch:
version: "*"
require: public
espressif/esp_lcd_touch_gt911: "*"
config:
# esp_lcd_panel_io_i2c_config_t fields for touch communication
io_i2c_config:
dev_addr: [0x5D, 0x14] # GT911 I2C address (ESP_LCD_TOUCH_IO_I2C_GT911_ADDRESS)
lcd_cmd_bits: 16 # Bit-width of LCD command
peripherals:
- name: i2c_master # I2C peripheral for touch communication

# esp_lcd_touch_config_t fields for touch configuration
touch_config:
x_max: 1024 # Maximum X coordinate (BSP_LCD_H_RES)
y_max: 600 # Maximum Y coordinate (BSP_LCD_V_RES)
flags:
mirror_x: true
mirror_y: true

- name: lcd_brightness
type: ledc_ctrl
version: default
peripherals:
- name: ledc_backlight

# - name: camera
# type: camera
# version: default
# sub_type: "csi" # The bus type: csi
# config:
# csi_config:
# reset_io: -1
# pwdn_io: -1
# dont_init_ldo: true # Using periph_ldo to manager this peripheral
# peripherals:
# - name: "i2c_master"
# frequency: 100000
# - name: ldo_mipi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
board: jc1060p470c_i_w_y
chip: esp32p4
description: "JC1060P470C_I_W_Y"
manufacturer: "GUITION"
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
version: 1.0.0
# Peripherals Configuration for JC1060P470C_I_W_Y
peripherals:
# I2C Configuration
- name: i2c_master
type: i2c
role: master
config:
port: 0
pins:
sda: 7
scl: 8

# I2S configuration for full-duplex audio with ES8311
- name: i2s_audio_out
type: i2s
format: "std-out"
role: master
config: &i2s_config
port: 0
sample_rate_hz: 48000
clk_src: "I2S_CLK_SRC_DEFAULT"
mclk_multiple: 256
data_bit_width: 16
slot_mode: "I2S_SLOT_MODE_STEREO"
slot_mask: "I2S_STD_SLOT_BOTH"
ws_width: 16
pins:
mclk: 13
bclk: 12
ws: 10
dout: 9
din: 48

# I2S configuration for full-duplex audio with ES8311
- name: i2s_audio_in
type: i2s
format: "std-in"
role: master
config: *i2s_config

# PA CONTROL
- name: gpio_pa_control
type: gpio
role: io
config:
pin: 11
mode: GPIO_MODE_OUTPUT
pull_up: true
default_level: 0

# LDO Configuration for MIPI Power Supply, need to be initialized before MIPI.
- name: ldo_mipi
type: ldo
config:
chan_id: 3 # On the P4 function board, VO3_LDO is used to power mipi.
voltage_mv: 2500 # For MIPI, the operating voltage needs to be set to 2.5V.
adjustable: 1
owned_by_hw: 0

# DSI Configuration
- name: dsi_display
type: dsi
config:
bus_id: 0
data_lanes: 2
phy_clk_src: 0
lane_bit_rate_mbps: 750

# Backlight Control
- name: ledc_backlight
type: ledc
version: default
config:
gpio_num: 23
speed_mode: LEDC_LOW_SPEED_MODE
channel: 1
timer_sel: 1
duty: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_SPIRAM=y
CONFIG_SPIRAM_MODE_HEX=y
CONFIG_SPIRAM_SPEED_200M=y

#
# Camera Sensor Configuration
#
# CONFIG_CAMERA_SC2336=y
# CONFIG_CAMERA_SC2336_AUTO_DETECT_MIPI_INTERFACE_SENSOR=y
# CONFIG_CAMERA_SC2336_MIPI_RAW8_1280X720_30FPS=y
# CONFIG_CAMERA_SC2336_MIPI_IF_FORMAT_INDEX_DEFAULT=9
# CONFIG_CAMERA_SC2336_DVP_RAW10_1280X720_30FPS=y
# CONFIG_CAMERA_SC2336_DVP_IF_FORMAT_INDEX_DEFAULT=0
# CONFIG_CAMERA_SC2336_ABSOLUTE_GAIN_LIMIT=66016
# CONFIG_CAMERA_SC2336_DIG_GAIN_PRIORITY=y
# CONFIG_CAMERA_SC2336_DEFAULT_IPA_JSON_CONFIGURATION_FILE=y
# CONFIG_ESP_VIDEO_ENABLE_ISP_PIPELINE_CONTROLLER=y

CONFIG_ESP32P4_SELECTS_REV_LESS_V3=y
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
CONFIG_ESP_CONSOLE_SECONDARY_NONE=y
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED=y
CONFIG_ESP_CONSOLE_UART_NUM=-1
118 changes: 118 additions & 0 deletions application/edge_agent/boards/guition/jc1060p470/setup_device.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include "esp_log.h"
#include "dev_display_lcd.h"
#include "esp_lcd_jd9165.h"
#include "esp_lcd_touch_gt911.h"

static const char *TAG = "P4_FUNCTION_EV_SETUP_DEVICE";

static const jd9165_lcd_init_cmd_t lcd_cmd[] = {
// {cmd, { data }, data_size, delay_ms}
{0x30, (uint8_t[]){0x00}, 1, 0},
{0xF7, (uint8_t[]){0x49,0x61,0x02,0x00}, 4, 0},
{0x30, (uint8_t[]){0x01}, 1, 0},
{0x04, (uint8_t[]){0x0C}, 1, 0},
{0x05, (uint8_t[]){0x00}, 1, 0},
{0x06, (uint8_t[]){0x00}, 1, 0},
{0x0B, (uint8_t[]){0x11}, 1, 0},
{0x17, (uint8_t[]){0x00}, 1, 0},
{0x20, (uint8_t[]){0x04}, 1, 0},
{0x1F, (uint8_t[]){0x05}, 1, 0},
{0x23, (uint8_t[]){0x00}, 1, 0},
{0x25, (uint8_t[]){0x19}, 1, 0},
{0x28, (uint8_t[]){0x18}, 1, 0},
{0x29, (uint8_t[]){0x04}, 1, 0},
{0x2A, (uint8_t[]){0x01}, 1, 0},
{0x2B, (uint8_t[]){0x04}, 1, 0},
{0x2C, (uint8_t[]){0x01}, 1, 0},
{0x30, (uint8_t[]){0x02}, 1, 0},
{0x01, (uint8_t[]){0x22}, 1, 0},
{0x03, (uint8_t[]){0x12}, 1, 0},
{0x04, (uint8_t[]){0x00}, 1, 0},
{0x05, (uint8_t[]){0x64}, 1, 0},
{0x0A, (uint8_t[]){0x08}, 1, 0},
{0x0B, (uint8_t[]){0x0A,0x1A,0x0B,0x0D,0x0D,0x11,0x10,0x06,0x08,0x1F,0x1D}, 11, 0},
{0x0C, (uint8_t[]){0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D}, 11, 0},
{0x0D, (uint8_t[]){0x16,0x1B,0x0B,0x0D,0x0D,0x11,0x10,0x07,0x09,0x1E,0x1C}, 11, 0},
{0x0E, (uint8_t[]){0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D}, 11, 0},
{0x0F, (uint8_t[]){0x16,0x1B,0x0D,0x0B,0x0D,0x11,0x10,0x1C,0x1E,0x09,0x07}, 11, 0},
{0x10, (uint8_t[]){0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D}, 11, 0},
{0x11, (uint8_t[]){0x0A,0x1A,0x0D,0x0B,0x0D,0x11,0x10,0x1D,0x1F,0x08,0x06}, 11, 0},
{0x12, (uint8_t[]){0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D,0x0D}, 11, 0},
{0x14, (uint8_t[]){0x00,0x00,0x11,0x11}, 4, 0},
{0x18, (uint8_t[]){0x99}, 1, 0},
{0x30, (uint8_t[]){0x06}, 1, 0},
{0x12, (uint8_t[]){0x36,0x2C,0x2E,0x3C,0x38,0x35,0x35,0x32,0x2E,0x1D,0x2B,0x21,0x16,0x29}, 14, 0},
{0x13, (uint8_t[]){0x36,0x2C,0x2E,0x3C,0x38,0x35,0x35,0x32,0x2E,0x1D,0x2B,0x21,0x16,0x29}, 14, 0},

// {0x30, (uint8_t[]){0x08}, 1, 0},
// {0x05, (uint8_t[]){0x01}, 1, 0},
// {0x0C, (uint8_t[]){0x1A}, 1, 0},
// {0x0D, (uint8_t[]){0x0E}, 1, 0},

// {0x30, (uint8_t[]){0x07}, 1, 0},
// {0x01, (uint8_t[]){0x04}, 1, 0},

{0x30, (uint8_t[]){0x0A}, 1, 0},
{0x02, (uint8_t[]){0x4F}, 1, 0},
{0x0B, (uint8_t[]){0x40}, 1, 0},
{0x12, (uint8_t[]){0x3E}, 1, 0},
{0x13, (uint8_t[]){0x78}, 1, 0},
{0x30, (uint8_t[]){0x0D}, 1, 0},
{0x0D, (uint8_t[]){0x04}, 1, 0},
{0x10, (uint8_t[]){0x0C}, 1, 0},
{0x11, (uint8_t[]){0x0C}, 1, 0},
{0x12, (uint8_t[]){0x0C}, 1, 0},
{0x13, (uint8_t[]){0x0C}, 1, 0},
{0x30, (uint8_t[]){0x00}, 1, 0},

{0X3A, (uint8_t[]){0x55}, 1, 0},
{0x11, (uint8_t[]){0x00}, 1, 120},
{0x29, (uint8_t[]){0x00}, 1, 20},
};
esp_err_t lcd_dsi_panel_factory_entry_t(esp_lcd_dsi_bus_handle_t dsi_handle, dev_display_lcd_config_t *lcd_cfg, dev_display_lcd_handles_t *lcd_handles)
{
jd9165_vendor_config_t vendor_config = {
.init_cmds = lcd_cmd,
.init_cmds_size = sizeof(lcd_cmd) / sizeof(jd9165_lcd_init_cmd_t),
.mipi_config = {
.dsi_bus = dsi_handle,
.dpi_config = &lcd_cfg->sub_cfg.dsi.dpi_config,
},
};

esp_lcd_panel_dev_config_t lcd_dev_config = {
.reset_gpio_num = lcd_cfg->sub_cfg.dsi.reset_gpio_num,
.rgb_ele_order = lcd_cfg->rgb_ele_order,
.bits_per_pixel = lcd_cfg->bits_per_pixel,
.data_endian = lcd_cfg->data_endian,
.flags = {
.reset_active_high = lcd_cfg->sub_cfg.dsi.reset_active_high,
},
.vendor_config = &vendor_config,
};

esp_err_t ret = esp_lcd_new_panel_jd9165(lcd_handles->io_handle, &lcd_dev_config, &lcd_handles->panel_handle);
if (ret != ESP_OK) {
ESP_LOGE(TAG, "Failed to create jd9165 panel: %s", esp_err_to_name(ret));
return ESP_FAIL;
}

return ESP_OK;
}

esp_err_t lcd_touch_factory_entry_t(esp_lcd_panel_io_handle_t io, const esp_lcd_touch_config_t *touch_dev_config, esp_lcd_touch_handle_t *ret_touch)
{
esp_err_t ret = esp_lcd_touch_new_i2c_gt911(io, touch_dev_config, ret_touch);
if (ret != ESP_OK) {
ESP_LOGE("lcd_touch_factory_entry_t", "Failed to create gt911 touch driver: %s", esp_err_to_name(ret));
return ret;
}

return ESP_OK;
}
Loading