Skip to content
Draft
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# ATK-DNESP32S3-BOX0

Board support for the ALIENTEK ATK-DNESP32S3-BOX0.

This port follows the pin map used by `xiaozhi-esp32/main/boards/atk-dnesp32s3-box0`.
It declares power rails, battery/charging monitor, ST7789 LCD, LEDC backlight,
ES8311 audio input/output, and three GPIO buttons.

TF card support is intentionally not declared because the referenced Xiaozhi
BOX0 board files do not define TF card pins. Add it only after the BOX0
schematic or measured pin map is confirmed.

## Build

```bash
cd application/edge_agent
idf.py set-target esp32s3
idf.py gen-bmgr-config -c ./boards -b atk_dnesp32s3_box0
idf.py build
idf.py merge-bin -o build/atk_dnesp32s3_box0_merged.bin
```

If the active ESP-IDF does not provide `idf.py merge-bin`, use
`esptool.py merge_bin` with the generated build flash arguments.

## Boot checkpoints

- `BOX0 power manager initialized`
- FATFS mounted at `/fatfs`
- Wi-Fi manager starts
- Board manager initializes `display_lcd`, `lcd_brightness`, `audio_dac`, and `audio_adc`

## Hardware smoke test

- The ST7789 backlight turns on and the display shows the Agent UI or a Lua display demo.
- ES8311 playback and microphone input initialize without I2S or codec errors.
- Buttons are readable from Lua with:

```lua
local button = require("button")
local right = button.new(0, 0)
local middle = button.new(4, 0)
local left = button.new(3, 0)
```

- Battery logs show plausible ADC, percentage, and charging state values.
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
version: 1.0.0
# Devices Configuration for ATK-DNESP32S3-BOX0
devices:
- name: box0_power_manager
chip: box0_power
type: custom
version: default
config:
sys_power_gpio: 2
codec_power_gpio: 14
charge_ctrl_gpio: 47
charge_status_gpio: 48
battery_adc_gpio: 1
battery_adc_unit: 0 # ADC_UNIT_1
battery_adc_channel: 0 # ADC_CHANNEL_0 / GPIO1 on ESP32-S3
battery_adc_atten: 3 # ADC_ATTEN_DB_12
sample_period_ms: 300000
low_voltage_adc_threshold: 2877
shutdown_on_low_battery: false

- name: audio_dac
chip: es8311
type: audio_codec
version: default
config:
adc_enabled: false
dac_enabled: true
dac_max_channel: 1
dac_channel_mask: "1"
dac_init_gain: 0
mclk_enabled: true
peripherals:
- name: i2s_audio_out
- name: i2c_master
address: 0x30
frequency: 400000

- name: audio_adc
chip: es8311
type: audio_codec
version: default
config:
adc_enabled: true
dac_enabled: false
adc_max_channel: 1
adc_channel_mask: "1"
adc_channel_labels: ['MIC']
adc_init_gain: 30
mclk_enabled: true
peripherals:
- name: i2s_audio_in
- name: i2c_master
address: 0x30
frequency: 400000

- name: display_lcd
chip: st7789
type: display_lcd
sub_type: spi
version: default
config:
mirror_x: false
mirror_y: false
swap_xy: false
invert_color: true
x_max: 240
y_max: 240
io_spi_config:
cs_gpio_num: 41
dc_gpio_num: 38
spi_mode: 0
pclk_hz: 40000000
lcd_panel_config:
reset_gpio_num: -1
rgb_ele_order: LCD_RGB_ELEMENT_ORDER_RGB
bits_per_pixel: 16
data_endian: LCD_RGB_DATA_ENDIAN_BIG
vendor_config: NULL
peripherals:
- name: spi_display

- name: lcd_brightness
type: ledc_ctrl
version: default
config:
default_percent: 100
peripherals:
- name: ledc_backlight

- name: box0_buttons
chip: gpio_button
type: custom
version: 1.0.0
init_skip: true
config:
right_gpio: 0
middle_gpio: 4
left_gpio: 3
active_level: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
board: atk_dnesp32s3_box0
chip: esp32s3
version: 1.0.0
description: "ATK-DNESP32S3-BOX0"
manufacturer: "ALIENTEK"
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
version: 1.0.0
# Peripherals Configuration for ATK-DNESP32S3-BOX0
peripherals:
- name: i2c_master
type: i2c
role: master
config:
port: 0
pins:
sda: 11
scl: 12

- name: i2s_audio_out
type: i2s
role: master
format: std-out
config: &i2s_audio_config
port: 0
sample_rate_hz: 16000
mclk_multiple: 256
data_bit_width: 16
slot_bit_width: I2S_SLOT_BIT_WIDTH_AUTO
slot_mode: I2S_SLOT_MODE_STEREO
slot_mask: I2S_STD_SLOT_BOTH
ws_width: 16
pins:
mclk: 13
bclk: 5
ws: 10
dout: 9
din: 6

- name: i2s_audio_in
type: i2s
role: master
format: std-in
config: *i2s_audio_config

- name: spi_display
type: spi
role: master
config:
spi_bus_config:
spi_port: SPI2_HOST
data0_io_num: 40
sclk_io_num: 39
max_transfer_sz: 11520

- name: ledc_backlight
type: ledc
role: none
config:
gpio_num: 42
freq_hz: 5000
duty: 1023
duty_resolution: LEDC_TIMER_10_BIT
output_invert: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_SPIRAM=y
CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_SPEED_80M=y
Loading