ESP32-P4-WIFI6-POE-ETH

From Waveshare Wiki
Jump to: navigation, search
ESP32-P4-WIFI6-POE-ETH
ESP32-P4-WIFI6-POE-ETH
ESP32-P4-WIFI6-POE-ETH-C
ESP32-P4-WIFI6-POE-ETH-C
ESP32-P4-WIFI6-POE-ETH-D
ESP32-P4-WIFI6-POE-ETH-D
{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

Introduction

The ESP32-P4-WIFI6-POE-ETH is a multimedia development board based on ESP32-P4 and ESP32-C6, and supports Wi-Fi 6 and Bluetooth 5 (LE) wireless connectivity. It features rich Human-Machine interfaces, including MIPI-CSI (with integrated Image Signal Processor), MIPI-DSI, SPI, I2S, I2C, LED PWM, MCPWM, RMT, ADC, UART, TWAI, etc. Additionally, it supports USB OTG 2.0 HS, onboard RJ45 Ethernet port with PoE functionality. The ESP32-P4 adopts a 360MHz dual-core RISC-V processor and supports up to 32MB PSRAM, featuring USB 2.0, MIPI-CSI / DSI, H.264 encoder, and other peripherals, meeting the needs for low-cost, high-performance, and low-power multimedia development. It also integrates a Digital Signature Peripheral and a dedicated Key Management Unit, ensuring secure data and operations. Specifically designed for high-performance and high-security applications, the ESP32-P4-WIFI6-POE-ETH meets the requirements of Human-Machine interaction, efficient edge computing, and IO expansion.

Features

  • Processor
    • Equipped with RISC-V 32-bit dual-core processor (HP system), it features DSP and instruction set expansion, along with floating point unit (FPU), and the main frequency is up to 360MHz
    • Equipped with RISC-V 32-bit single-core processor (LP system), the main frequency is up to 40MHz
    • Equipped with ESP32-C6 WIFI/BT co-processor, expand WIFI 6/Bluetooth 5 and other functions through SDIO
  • Memory
    • 128 KB of high-performance (HP) system read-only memory (ROM)
    • 16 KB of low-power (LP) system read-only memory (ROM)
    • 768 KB of high-performance (HP) L2 memory (L2MEM)
    • 32 KB of low-power (LP) SRAM
    • 8 KB of system tightly coupled memory (TCM)
    • Package with 32 MB PSRAM stacked inside, module integrated with 16MB Nor Flash
  • Peripheral interfaces
    • 2 × 20 header pins onboard, 28 remaining programmable GPIOs, supporting a variety of peripheral devices
    • Onboard Type-A USB 2.0 OTG port, 100Mbps Ethernet port (supports PoE), SDIO3.0 TF card slot, Type-C UART flashing port, convenient for different scenarios
    • Onboard speaker interface, microphone, 3.5mm headphone jack, the Codec chip and power amplifier chip can be used to achieve the ideal audio function requirements
    • Onboard MIPI-CSI high-definition camera port, support full HD 1080P picture acquisition and encoding, integrated image signal processor (ISP) and H264 video encoder, support H.264 & JPEG video encoding (1080P @30fps), convenient for application in computer vision, machine vision and other fields
    • Onboard MIPI-DSI high-definition screen display port, integrated pixel processing accelerator (PPA), 2D graphics acceleration controller (2D DMA), supporting JPEG image decoding (1080P @30fps), providing strong support for high-definition screen display and smooth HMI experience, convenient for application to smart home central control screen, industrial central control screen, vending machine and other scenarios
    • Reserved PoE module interface makes the power supply mode of the development board more flexible, and only one network cable can be connected to the PoE device to enable the ESP32-P4-WIFI6-POE-ETH series to network and power supply

Hardware Description

ESP32-P4-WIFI6-POE-ETH-details-intro.jpg

1. ESP32-P4-Core
Integrated ESP32-P4NRW32, 32MB Nor Flash

2. ESP32-C6-MINI-1U-H8 module
SDIO interface protocol, extends the board with Wi-Fi 6 and Bluetooth 5 (LE), and the external antenna uses IPEX 3rd generation interface

3. Display interface
MIPI-2lane

4. Camera interface
MIPI-2lane

5. 5V power terminal

6. UART (connected to SH1.0 4PIN)
For program flashing and debugging

7. 12C (connected to SH1.0 4PIN)
For external 12C device

8. Power indicator

9. RST button
Reset button

10. BOOT button
Press when powering on or resetting to enter download mode

11. Type-A and Type-C stack design
Type-A is a USB OTG 2.0 High Speed interface, Type-C is a UART interface, which can be used for power supply, program flashing and debugging

12. 100Mbps RJ45 Ethernet port
Supports PoE power supply

13. TF card slot
SDIO3.0 interface protocol

14. ESP32-C6 UART terminal

15. SMD microphone

16. 40PIN header

17. Audio codec chip, power amplifier chip and MX1.25 speaker header
MX1.25 2P connector, supports 8Ω 2W speaker

18. IP101
Network port chip

Pinout Definition

ESP32-P4-WIFI6-POE-ETH-details-inter.png

Dimensions

ESP32-P4-WIFI6-POE-ETH-details-size.jpg

Development Tools

Each of these two development approaches has its own advantages, and developers can choose according to their needs and skill levels. Arduino is suitable for beginners and non-professionals because they are easy to learn and quick to get started. ESP-IDF is a better choice for developers with a professional background or high performance requirements, as it provides more advanced development tools and greater control capabilities for the development of complex projects.

  • Arduino IDE is a open source electronic prototyping platform, convenient and flexible, easy to get started. After a simple learning, you can start to develop quickly. At the same time, Arduino has a large global user community, providing an abundance of open source code, project examples and tutorials, as well as rich library resources, encapsulating complex functions, allowing developers to quickly implement various functions. You can refer to the Arduino to complete the initial setup, and the tutorial also provides relevant demos for reference.
  • ESP-IDF, or full name Espressif IDE, is a professional development framework introduced by Espressif Technology for the ESP series chips. It is developed using the C language, including a compiler, debugger, and flashing tool, etc., and can be developed via the command lines or through an integrated development environment (such as Visual Studio Code with the Espressif IDF plugin). The plugin offers features such as code navigation, project management, and debugging, etc. We recommend using VS Code for development. You can refer to the ESP-IDF (VS Code) development environment setup tutorial for the specific configuration process. The tutorial also provides relevant demos for reference.

Arduino

This chapter introduces setting up the Arduino environment, including the Arduino IDE, management of ESP32 boards, installation of related libraries, program compilation and downloading, as well as testing demos. It aims to help users master the development board and facilitate secondary development. Arduino-flow-04.png

Environment Setup

Download and Install Arduino IDE

  • Click to visit the Arduino official website, select the corresponding system and system bit to download
    ESP32-S3-AMOLED-1.91-Ar-software-01.png
  • Run the installer and install all by default
The environment setup is carried out on the Windows 10 system, Linux and Mac users can access Arduino-esp32 environment setup for reference

Install ESP32 Development Board

  • Before using ESP32-related motherboards with the Arduino IDE, you must first install the software package for the esp32 by Espressif Systems development board
  • According to board installation requirement, it is generally recommended to use Install Online. If online installation fails, use Install Offline.
  • For the installation tutorial, please refer to Arduino board manager tutorial
  • ESP32-P4 required development board installation description
Board name Board installation requirement Version number requirement
esp32 by Espressif Systems "Install Offline" / "Install Online" ≥3.2.0

Install Library

  • When installing Arduino libraries, there are usually two ways to choose from: Install online and Install offline. If the library installation requires offline installation, you must use the provided library file
    For most libraries, users can easily search and install them through the online library manager of the Arduino software. However, some open-source libraries or custom libraries are not synchronized to the Arduino Library Manager, so they cannot be acquired through online searches. In this case, users can only manually install these libraries offline.
  • ESP32-P4 library file is stored in the demo
  • For library installation tutorial, please refer to Arduino library manager tutorial
+ ESP32-P4 library file description
Library Name Description Version Library Installation Requirement
GFX_Library_for_Arduino GFX graphical library for SH8601 v1.6.0 "Install Offline"
lvgl LVGL graphical library v9.3.0 "Install Offline" is recommended
displays I2C driver, screen definition and touch driver —— "Install Offline"
lv_conf.h LVGL configuration file —— "Install Offline"

Run the First Arduino Demo

If you are just getting started with ESP32 and Arduino, and you don't know how to create, compile, flash, and run Arduino ESP32 programs, then please expand and take a look. Hope it can help you!

New Project

  • Run the Arduino IDE and select File -> New Sketch
    ESP32-S3-AMOLED-1.91-Ar-study-01.png
  • Enter the code:
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println("Hello, World!");
  delay(2000);
}
  • Save the project and select File -> Save As.... In the pop-up menu, select the path to save the project, and enter a project name, such as Hello_World, click Save

ESP32-S3-AMOLED-1.91-Ar-study-02.png

Compile and Flash Demos

  • Select the corresponding development board, take the ESP32S3 motherboard as an example:

①. Click to select the dropdown menu option Select Other Board and Port;
②. Search for the required development board model esp32s3 dev module and select;
③. Select COM Port;
④. Save the selection.
ESP32-S3-AMOLED-1.91-Ar-study-03.png

  • If the ESP32S3 mainboard only has a USB port, you need to enable USB CDC, as shown in the following diagram:

ESP32-S3-AMOLED-1.91-Ar-study-04.png

  • Compile and upload the program:

①. Compile the program; ②. Compile and download the program; ③. Download successful.
ESP32-S3-AMOLED-1.91-Ar-study-05.png

  • Open the Serial Monitor window, and the demo will print "Hello World!" every 2 seconds, and the operation is as follows:

ESP32-S3-AMOLED-1.91-Ar-study-06.png

Demo

Demo-flow-01.png

  • ESP32-P4 demos
Demo Basic Description Dependency Library
HelloWorld Demonstrates the basic graphics library function and can also be used to test the basic performance of display screens and the display effect of random text GFX_Library_for_Arduino, displays
Drawing_board Touch drawing dot test GFX_Library_for_Arduino, displays
AsciiTable Prints ASCII characters in rows and columns on the display screen according to the screen size GFX_Library_for_Arduino, displays
GFX_ESPWiFiAnalyzer Draws the WiFi band signal strength on the screen GFX_Library_for_Arduino, displays
LVGLV9_Arduino LVGL demonstration LVGL, GFX_Library_for_Arduino, displays

ESP-IDF

This chapter includes the following two sections, please read as needed:

Configure Development Environment

Note: The following environment settings are applicable to Windows 10/11 systems. For Mac/Linux users, please refer to the official instructions.

1. Download and install Visual Studio Code.

2. In VS Code, open the Extensions view by clicking the Extensions icon Extensions icon.jpg in the VS Code sidebar or using the shortcut (Ctrl+Shift+X). Then, search for the ESP-IDF extension and install it.
VSCode-Install-ESP-IDF-Extension-bedfa138c99f6fdd01224b9760598dc7.jpg

3. After installing the extension, an Espressif icon Label2.jpg will appear in the activity bar on the left side of VS Code. Clicking this icon will display the basic command list for the ESP-IDF extension. Select Configure ESP-IDF extension under Advanced.
VSCode-ESP-IDF-Configuration-1-f76a36e4d79ea5efe954842038dbef5e.jpg

4. Choose Express to enter quick configuration mode:
VSCode-ESP-IDF-Configuration-2-b6a8bbca410498a6be8059f9dda1da2e.jpg

5. Modify the following options as needed:

    • Select download server:
      • Espressif: Use Espressif's China server for faster download speeds.
      • Github: Use the official GitHub release link.
    • ESP-IDF version: The corresponding version is usually selected according to the requirements of the development board, and it is recommended to use the latest official version if there are no special requirements. For ESP32-P4-WIFI6-POE-ETH, it is recommended to use the Espressif IDF version ≥ v5.3.1.
    • ESP-IDF container directory: It is recommended to use the default address, or use a purely English path that does not contain spaces.
    • ESP-IDF tools directory: It is recommended to use the default address, or use a path that is purely in English and does not contain spaces.

VSCode-ESP-IDF-Configuration-3-00ceb43b771ce87a71c76b045b5b7dc9.jpg

6. Click Install to begin installation. You will see a page displaying the installation progress, including the progress status of ESP-IDF download, ESP-IDF tool download and installation, as well as the creation of the Python virtual environment. VSCode-ESP-IDF-Configuration-4-574a10c5fab400f53726a21fc68a0ca2.jpg

7. If installed correctly, you will see a prompt indicating that all settings are configured, and you can then start using the extension. VSCode-ESP-IDF-Configuration-5-3d3a5721b0c8d557f1321d9f72c0994f.jpg

Note: If ESP-IDF installation fails or needs to be reinstalled, you can try deleting the C:\Users\%Username%\esp and C:\Users\%Username%\.espressif folders and then retry.

Demo

The ESP-IDF demo is located in the ESP-IDF directory of the demo package.

Get Started
The best way to learn a language or development environment is to start from the basics. This section will provide a detailed guide on how to create projects, develop from existing projects, and include embedded classic tutorials such as HelloWorld and the usage of common port I2C.

1. Introduction to Basic Structure of ESP-IDF Project

  • Project Structure:
    • Open the ESP-IDF plugin, click New project, select the ESP-IDF demo -- >sample_project -- > click Create
    • Create a new project and open it in the window, you can see the structure of VSCode as follows
├── CMakeLists.txt
├── main
│   ├── CMakeLists.txt
│   └── main.c
└── README.md
  • ESP-IDF Project Details:
    • Component: The components in ESP-IDF are the basic modules for building applications, each component is usually a relatively independent code base or library, which can implement specific functions or services, and can be reused by applications or other components, similar to the definition of libraries in Python development.
      • Component reference: The import of libraries in the Python development environment only requires to "import library name or path", while ESP-IDF is based on the C language, and the importing of libraries is configured and defined through CMakeLists.txt.
      • When we use online components, we usually use idf.py add-dependency <componetsName> to add online components to the project, which generates a idf_component.yml file for managing components.
      • The purpose of CmakeLists.txt: When compiling ESP-IDF, the build tool CMake first reads the content of the top-level CMakeLists.txt in the project directory to read the build rules and identify the content to be compiled. When the required components and demos are imported into the CMakeLists.txt, the compilation tool CMake will import each content that needs to be compiled according to the index. The compilation process is as follows:

ESP32-P4 VSCode ESP-IDF GettingStart 240906 02.jpg

  • Description of Bottom Toolbar of VSCode User Interface:

When opening an ESP-IDF project, the environment will be loaded automatically at the bottom. For the development of ESP32-P4-WIFI6-POE-ETH, the bottom toolbar is very important, as shown in the figure:
ESP32-P4 VSCode ESP-IDF GettingStart 240905 03.jpg

    • ①.ESP-IDF Development Environment Version Manager: When our project requires differentiation of development environment versions, it can be managed by installing different versions of ESP-IDF. When the project uses a specific version, it can be switched to by utilizing it
    • ②.Device flashing COM port: Select to flash the compiled program into the chip
    • ③.Select set-target chip model: Select the corresponding chip model, for example, ESP32-P4-WIFI6-POE-ETH needs to choose esp32p4 as the target chip
    • ④. menuconfig: Click it to modify sdkconfig configuration file
    • ⑤. fullclean button: When the project compilation error or other operations pollute the compiled content, you can clean up all the compiled content by clicking it
    • ⑥.Build project: When a project satisfies the build, click this button to compile
    • ⑦.flash button: When a project build is completed, select the COM port of the corresponding development board, and click this button to flash the compiled firmware to the chip
    • ⑧. monitor enable flashing port monitoring: When a project passes through Build --> Flash, click this button to view the log of output from flashing port and debugging port, so as to observe whether the application works normally
    • ⑨.Build Flash Monitor one-click button: Which is used to continuously execute Build->Flash->Monitor, often referred to as "little flame"

2. HelloWorld Demo
After understanding Description of bottom toolbar of VSCode user interface, the HelloWorld project allows you to quickly get started and understand the basic projects of the ESP32 development environment. It demonstrates how to use ESP-IDF to create a basic application, and covers the ESP32 development process, including compilation, flashing, and monitor debugging steps.

1. After opening the sample project HelloWorld, set the target port and chip type (Note: There is a loading action in the lower right corner when the chip type is selected, indicating that ESP-IDF is executing the command idf.py set-target esp32p4. It needs to pull the architecture package environment corresponding to the chip from the package manager, which may take some time. Please wait patiently. If you perform build or other operations at this time, there will be errors!!!)
2. By using the bottom tool🔥 to build, flash, and monitor with just one click, you can view the terminal output Hello World!
3. Code content analysis
i. There is only one app_main main function in the code, which determines the print content output through conditional judgment, and adds a loop at the end to achieve 10s restart of the chip.
ii. app_main function is the entry point for user applications in the ESP-IDF (Espressif IoT Development Framework) development framework. It is the core function of the ESP-IDF project and is equivalent to the main function in the standard program of the C language. In ESP32 development, app_main function is the first task scheduled by the real-time operating system (FreeRTOS), which is the starting point for the execution of the user's code.

3. I2C Demo
I2C is a commonly used serial communication bus, which can communicate through two cables, one data cable (SDA, Serial Data) and one clock cable (SCL, Serial Clock), and supports multi-master and multi-slave mode. On the ESP32-P4, there are two I2C bus ports. The chip internally uses a GPIO exchange matrix to configure the use of any GPIO pins. This feature allows us to freely use any GPIO as an I2C pin control. Of course, the ESP32-P4 I2C supports both Slave and Master modes. Below, we primarily use the I2C host (Master) mode for ESP32-P4 to start communication, control, send data requests or receive data from the slave devices (which can be sensors from any I2C port). The I2C pins of ESP32-P4-WIFI6-POE-ETH use SCL(GPIO8) and SDA(GPIO7) by default
ESP32-P4-Nano-I2C 240906 01.png

In ESP-IDF, the I2C bus requires the configuration specified by i2c_master_bus_config_t:

  • i2c_master_bus_config_t::clk_source selects the source clock for the I2C bus, using the default I2C clock source (usually the default clock source) is simply set to I2C_CLK_SRC_DEFAULT
  • i2c_master_bus_config_t::i2c_port sets the I2C port used by the controller, as explained above, the ESP32-P4 has two I2C ports. When two different I2C ports need to be enabled simultaneously, this needs to be utilized to distinguish between them
  • i2c_master_bus_config_t::scl_io_num sets the GPIO number of the serial clock bus (SCL), which is 8 on ESP32-P4-WIFI6-POE-ETH
  • i2c_master_bus_config_t::sda_io_num sets the GPIO number for the serial data bus (SDA), which is 7 on the ESP32-P4-WIFI6-POE-ETH
  • i2c_master_bus_config_t::glitch_ignore_cnt sets the Glitch Period for the Master Bus, and if the Glitch Period on the line is smaller than this value, it can be filtered out. Typically, this value is set to 7
  • i2c_master_bus_config_t::enable_internal_pullup enables internal pullups, on the ESP32-P4-WIFI6-POE-ETH, there is already an additional I2C pullup, no need to enable internal pullups

As described above, the I2C configuration is:

   i2c_master_bus_config_t i2c_bus_config = {
       .clk_source = I2C_CLK_SRC_DEFAULT,
       .i2c_port = I2C_NUM_0,
       .scl_io_num = 8,
       .sda_io_num = 7,
       .glitch_ignore_cnt = 7,
       .flags.enable_internal_pullup = false,
   };
  1. Open the i2c_tools the project, select the COM port and chip model, click ⚙️ to enter the settings. This will open a new tab: SDK Configuration editor, also known as menuconfig. Directly search for I2C in the search bar. The content has already been retrieved, and the SCL GPIO Num and SDA GPIO Num in the demo are already corresponding to SCL(GPIO8) and SDA(GPIO7)
  2. Next, you can directly compile, flash, and monitor by clicking 🔥. Upon after completion, you will see the command menu in the terminal. When you execute i2cdetect, all I2C addresses will be printed. If there is a device, a number will be displayed (I2C address 18 device corresponds to the onboard ES8311 Codec audio chip, this chip will be detailed in the I2S section), as shown in the figure:
    ESP32-P4-Nano I2C demo 240906 01.png
  3. The above steps have realized the basics of I2C device communication. In devices that use the I2C communication protocol, it is often necessary to write register configurations to the corresponding address device via the I2C bus to achieve the functionality of the I2C device. In this case, we need to write the initialization program for the I2C device in the program to drive the I2C device. Different I2C devices have different I2C addresses. In development, we can use the i2ctools tool to query the attached I2C address, nd then read the chip manual to query the registers, configuration and other contents to achieve I2C bus communication.

Intermediate

1. Ethernet Demo

Basic Concepts of Ethernet

  • Ethernet is an asynchronous Carrier Sense Multiple Access with Collision Detection (CSMA/CD) protocol or interface. Generally speaking, Ethernet is not suitable for low-power applications. However, thanks to its wide range of deployments, efficient network connectivity, high data rates, and unlimited scalability, almost all wired communication can be carried over Ethernet. Currently, Ethernet is classified based on speed tiers as follows: standard Ethernet (10Mbit/s), fast Ethernet (100Mbit/s), gigabit Ethernet (1000Mbit/s), and faster ten-gigabit Ethernet (10Gbit/s).
  • Ethernet port types include RJ45 port, RJ11 port (telephone jack), etc. The RJ45 interface is the most commonly used Ethernet interface (computer interface), and it is also the ESP32-P4-WIFI6-POE-ETH onboard network port type.
  • ESP32-P4-WIFI6-POE-ETH can be explained by citing a network model:
    ESP32-P4-NANO 241026 02 1.png
    • ESP32-P4-WIFI6-POE-ETH network interface layer: ESP32-P4 is connected to the IP101GRI through the RMII interface, and the RJ45 interface network port is drawn through the network transformer, while the development board is managed by the MAC layer integrated into the ESP32-P4 chip to manage the encapsulation, checksum and MAC address of the data frame.
    • ESP32-P4-WIFI6-POE-ETH network layer and transport layer: Implemented by the ESP32-P4 driving the IP101GRI
    • ESP32-P4-WIFI6-POE-ETH application layer: When a connection is successfully established with the network, ESP32-P4 can implement HTTP requests and use communication servers such as MQTT.


Demo Demonstration
This example demonstrates the basic usage of Ethernet driver and esp_netif. The initialization of the Ethernet driver is included in a separate subcomponent of the project to clearly distinguish between the initialization of the driver and the initialization of the esp_netif. The workflow for this demo is as follows:
ESP32-P4-NANO 241026 01 1.png

1. RMII definition: As mentioned above, the ESP32-P4 chip of ESP32-P4-WIFI6-POE-ETH is connected with the IP101 GRI chip through RMII interface, and the interface is defined as follows:

    • TXD[1:0]: Sending data cable, controlled by GPIO34 and GPIO35
    • RXD[1:0]: Receiving data cable, controlled by GPIO30 and GPIO29
    • TX_EN: Sends an enable signal, controlled by GPIO49
    • CRS_DV: Carrier detection and data valid signals, controlled by GPIO28
    • REF_CLK: Reference clock, controlled by GPIO50, 50MHz generated by a 25 MHz passive crystal oscillator connected outside the PHY through frequency doubling
    • MDIO and MDC: Manage data interface for Ethernet (control and configuration of the PHY) is controlled by GPIO52 and GPIO31
    • RESET: Control IP101GRI reset, controlled by GPIO51

2. Open the ethernetbasic project, select the appropriate COM port and chip model, click on the ⚙️ to enter the settings. This will open a new tab: SDK Configuration editor, also known as menuconfig. Directly search for ETH in the search bar, you will find that the content has already been retrieved, and correspond to the parameters in the following figure:
1500px-ESP32-P4-Nano Intermediate 240906 02.png

3. Next, you can directly compile, flash, and monitor by clicking 🔥. Upon completion, you will see the program start in the terminal. After inserting an Ethernet cable, you can obtain an IP address. Removing the cable will disconnect the action, as shown in the figure:
ESP32-P4-Nano Intermediate 240906 03.png

4. You can see from the router that a device named espressif is connected, and the ESP32-P4-WIFI6-POE-ETH is connected to the network.
ESP32-P4-Nano Intermediate 240906 04.png

2. SDMMC Demo

The ESP32-P4-WIFI6-POE-ETH features a 4-Wire SDIO3.0 card slot for off-chip memory expansion

  • Supported rate modes
    • Default rate (20 MHz)
    • High-speed mode (40 MHz)
  • Configure bus width and frequency

In ESP-IDF, use sdmmc_host_t and sdmmc_slot_config_t settings to configure the default 20MHz communication frequency and 4-wire width communication, as follows:

sdmmc_host_t host = SDMMC_HOST_DEFAULT();
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();

In the design that supports 40 MHz communication, you can adjust the max_freq_khz field in the sdmmc_host_t structure to increase the bus frequency:

sdmmc_host_t host = SDMMC_HOST_DEFAULT();
host.max_freq_khz = SDMMC_FREQ_HIGHSPEED;

The SDMMC 4-wire connection on the ESP32-P4-WIFI6-POE-ETH should be defined as:

sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
slot_config.width = 4;
slot_config.clk = 43;
slot_config.cmd = 44;
slot_config.d0 = 39;
slot_config.d1 = 40;
slot_config.d2 = 41;
slot_config.d3 = 42;
slot_config.flags |= SDMMC_SLOT_FLAG_INTERNAL_PULLUP;
i. Open the sdmmc project, select the COM port and chip model, because the demo project defines the pin as a macro, so you need to configure it, of course, you can also directly fill in the pin value. Click ⚙️ to enter the settings, here a new tab will open: SDK Configuration editor, which is also known as menuconfig. We directly search for sd in the search bar, see that the content has been retrieved at this time, and the demo configuration has been configured, check the default initialization and create the demo file by default:
ESP32-P4-Nano-SDMMC 240906 02.png
ii. Next, insert the prepared TF card, click 🔥 to compile, flash and monitor. After completion, you will see the output of the command menu in the terminal showing the contents of the files in the directory:
ESP32-P4-Nano-SDMMC 240906 03.png

3. WIFI Networking Demo

The ESP32-P4 does not come with WIFI/BT capabilities by itself, whereas the ESP32-P4-WIFI6-POE-ETH extends its WIFI functionality by connecting to an ESP32-C6 module via SDIO. The ESP32-C6 acts as a Slave, supporting the ESP32-P4 as the Host utilizing the WIFI 6/BT 5 features through SDIO via a series of instruction sets. By adding two components, seamless use of esp_wifi is achieved.

// In a WIFI project, add the following two components through the ESP-IDF component management tool
idf.py add-dependency "espressif/esp_wifi_remote"
idf.py add-dependency "espressif/esp_hosted"
  1. Open the wifistation project to add components
    ESP32-P4-Nano-WiFistation 240907 01.png
  2. As shown in the above figure, these are the specific steps to add components
i. Open the ESP-IDF Terminal
ii. Add the required components in Terminal
iii. After successful addition, there will be an additional idf_component.yml in the main folder of the project, which is used to manage project components, as explained in the ESP-IDF Project Catalog section
iv. After opening, it can be seen that two poments espressif/esp_hosted: "*" and espressif/esp_wifi_remote: "*" have been added. They are added to the project as you build it
  1. Next, you can open the settings by clicking on ⚙️. Input "Example" for the search, here you set the ssid and password for the WiFi you want to connect to. Note that ESP32-C6 supports 2.4GHz WiFi-6, so when choosing your target WiFi, make sure the frequency is 2.4GHz. After making the changes, you need to save them, otherwise, there will be an error!
    ESP32-P4-Nano-WiFistation 240907 02.png
  2. Next, you can directly compile, flash, and monitor by clicking 🔥. After completion, you will see the following results on the terminal, at this point the ESP32-P4-WIFI6-POE-ETH has already connected to WIFI and is online:
    ESP32-P4-Nano-WiFistation 240907 03.png

4. I2S Audio Demo

I2S (Inter-IC Sound) is a digital communication protocol for transmitting audio data. I2S is a serial bus interface that is primarily used for digital audio data transmission between audio devices, such as digital audio processors (DSPs), digital-to-analog converters (DACs), analog-to-digital converters (ADCs), and audio codecs.
The ESP32-P4 includes 1 I2S peripheral. By configuring these peripherals, the sample data can be input and output with the help of an I2S driver.

ESP32-P4-WIFI6-POE-ETH board integrates the es8311 Codec chip and the NS4150B power amplifier chip combination. The I2S bus and pin distribution are as follows:

  • MCLK (Master Clock): Master clock signal. The clock is typically provided to the ES8311 by an external device (such as an MCU or DSP), which serves as the clock source for its internal digital audio processing module.
  • SCLK (Serial Clock): Serial clock signal. This signal is typically used for clock synchronization for I2S data transmission and is generated by the master device to indicate the rate at which the data is transferred. The transmission of each bit of each audio sample requires a clock cycle.
  • ASDOUT (Audio Serial Data Output) or DOUT: Audio data output pin. The ES8311 outputs decoded digital audio data to this pin, which is then transmitted to an amplifier chip or other audio device.
  • LRCK (Left/Right Clock) or WS (Word Select): Left and right channel selection signals to indicate whether the current data sample belongs to the left or right channel. Typically in the I2S protocol, one clock cycle represents the left channel data and the other clock cycle represents the right channel data.
  • DSDIN (Digital Serial Data Input) or DIN: Digital audio data input pin. This pin receives audio data from an external audio device or a master. The ES8311 decodes this data and processes the audio signals through an internal digital signal processing module.

ESP32-P4-Nano-i2scodec 240909 05.png

Function pin ESP32-P4-WIFI6-POE-ETH pin
MCLK GPIO13
SCLK GPIO12
ASDOUT GPIO11
LRCK GPIO10
DSDIN GPIO9
PA_Ctrl (Power amplifier chip enable pin, active high) GPIO53

The ESP32-P4-WIFI6-POE-ETH es8311 driver uses ES8311 components. It can be added during usage through the IDF Component Manager.

idf.py add-dependency "espressif/es8311"
  1. Open the i2scodec project to add components
    ESP32-P4-Nano-i2scodec 240909 01.png
i. Open the ESP-IDF Terminal
ii. Add the required components in Terminal
iii. After successful addition, there will be an additional idf_component.yml in the main folder of the project, which is used to manage project components, as explained in the ESP-IDF Project Catalog section
iv. Once opened, you can see that the espressif/es8311 component has been added, and it will be added to the project when you build it
  1. Next, you can open the settings by clicking on ⚙️, search for Example, and adjust the appropriate volume
    ESP32-P4-Nano-i2scodec 240909 02.png
  2. When connected to the speaker, you can directly compile, flash, and monitor by clicking 🔥 on it, and the following result will be viewed in the terminal after completion, at this time, ESP32-P4-WIFI6-POE-ETH is already playing audio
    ESP32-P4-Nano-i2scodec 240909 03.png
  3. When the echo mode is set in the settings, the audio will be recorded by the microphone and output by the speakers
    ESP32-P4-Nano-i2scodec 240909 04.png

5. MIPI-DSI Screen Wake-Up Demo

ESP32-P4-WIFI6-POE-ETH uses the ESP32-P4NRW32 chip with the following new features:

  • MIPI-DSI compliant, using D-PHY v1.1 version, up to 2-lane x 1.5Gbps (total 3Gbps)
  • Supports RGB888, RGB565, YUV422 input
  • Supports RGB888, RGB666, RGB565 output
  • Uses video mode to output video streams, and supports output of fixed image patterns

MIPI-DSI image processing can also be processed using a 2D-DMA controller, which supports PPA and JPEG encoding/decoding peripherals

MIPI-DSI LCD Driving Principle

ESP32-P4-Nano-ETH to WiFi 240925 02.png

Hardware Required

  • 10.1inch display and accessories
  • ESP32-P4-WIFI6-POE-ETH development board

Screen Wake-Up Steps

  1. The screen driver has been packaged as a component, and the component is located at ESP Component Registry
  2. After opening the project, select esp32p4 core, and you can directly click 🔥 to compile, flash, monitor. Upon completion, you can see that the screen has lit up to refresh the color bar:

800px-ESP32-P4-Module-DEV-KIT 250326 01.png

Advanced

1. ETH To WIFI

This example demonstrates how to use the onboard ESP32-C6 on the ESP32-P4-WIFI6-POE-ETH board as a slave to enable the ESP32-P4 to drive the IP101 registration network and achieve WiFi AP functionality through the ESP32-C6

Hardware Required

  • ESP32-P4-WIFI6-POE-ETH Development Board

Running Steps

  • After opening the project, select esp32p4 core, and you can directly click 🔥 to compile, flash, monitor. When you're done, you can connect the internet cable and check the WiFi to surf the Internet.

2. LVGL HMI Human Machine Interaction

This example shows that the ESP32-P4 displays LVGL images through the MIPI DSI interface, which fully demonstrates the powerful image processing capabilities of the ESP32-P4

Hardware Required

  • 10.1inch display and accessories
  • ESP32-P4-WIFI6-POE-ETH Development Board

Screen Wake-Up Steps

  1. The screen driver has been packaged as a component, and the component is located at ESP Component Registry
  2. After opening the project, configure the corresponding parameters through menuconfig Display, select esp32p4 core, and you can directly click 🔥 to compile, flash, monitor. Upon completion, you can view the screen:

400px-ESP32-P4-Module-DEV-KIT 250326 02.png 400px-ESP32-P4-Module-DEV-KIT 250326 03.png 400px-ESP32-P4-Module-DEV-KIT 250326 04.png 400px-ESP32-P4-Module-DEV-KIT 250326 05.png 400px-ESP32-P4-Module-DEV-KIT 250326 06.png 400px-ESP32-P4-Module-DEV-KIT 250326 07.png

Expert Techniques

ESP-Phone

This example is based on ESP_Brookesia and shows an Android-like interface with many different applications. This example uses the board's MIPI-DSI port, MIPI-CSI port, ESP32-C6, TF card, and audio jack. Based on this example, you can create a use case based on ESP_Brookesia to efficiently develop multimedia applications.

Hardware Required

  • 10.1inch display and accessories
  • OV5647 or SC2336 camera and cable
  • 8Ω 2W speaker
  • ESP32-P4-WIFI6-POE-ETH development board

Screen Wake-Up Steps

  1. The screen driver has been packaged as a component, and the component is located at ESP Component Registry
  2. After opening the project, select esp32p4 core, and you can directly click 🔥 to compile, flash, monitor. Upon completion, you can view the screen:

ESP32-P4-Module-DEV-KIT 250326 08.png ESP32-P4-Module-DEV-KIT 250326 09.png ESP32-P4-Module-DEV-KIT 250326 10.png ESP32-P4-Module-DEV-KIT 250326 11.png ESP32-P4-Module-DEV-KIT 250326 12.png ESP32-P4-Module-DEV-KIT 250326 13.png


Resources

Schematic Diagram

Demo

Datasheets

Software


FAQ

 Answer:

The MIPI interface of ESP32-P4 board supports 2-lane, and it has been adapted to a variety of Waveshare screens, such as:

For more compatible MIPI screens, you can refer to the below repository. If you have any specific requirements, you can also submit an issue to describe them, and the engineers will evaluate them as soon as possible ESP32-display-support


 Answer:

2MP. The ESP32-P4 integrates an ISP and an H.264 encoder, which means that the raw data captured by the camera can be processed directly by the ISP and then efficiently compressed into H.264 format by the hardware encoder. And the ESP32-P4 can only support cameras with a maximum of 2 million pixels due to the maximum encoding performance of the H.264 encoder of 1080p@30fps.


 Answer:
  • Open the terminal and enter the command: idf.py menuconfig

企业微信截图 17618960969959.png

  • Enter the SDK interface, you can perform the following key operations:
    • J: Move the cursor down
    • K: Move the cursor up
    • L: Select
    • S: Save configuration
    • ESC: Return to the previous directory
  • Go to Component Config -> Board Support Package(ESP32-P4) -> Display -> Select LCD Type, select Waveshare 5-DSI-TOUCH-A Display, then press S to save the configuration

企业微信截图 17618964411048.png

  • Go to Component config → Wi-Fi Remote → choose slave target, select esp32-c6, then press S to save the configuration

企业微信截图 17618965636862.png

  • Go to main.cpp, modify the position shown in the figure below to 720*1280, save the changes, and recompile and flash.

企业微信截图 17618966648447.png


 Answer:
  • When powering on, pull C6_IO9 low (to put C6 into download mode) , and also put P4 into download mode, so you can flash firmware to C6 via C6_U0RXD and C6_U0TXD


 Answer:

This issue occurs when using the VS Code plugin. In some cases, there is a bug in the ESP-IDF installed by the VS Code plugin. The current solution is to switch to using the IDF tool to execute compilation and flashing.


 Answer:

1. During functionality testing, we have validated several features. Some applications, like using a Cat-4 module for network access or using P4's MIPI-DSI to expand the host screen, are progressing but not yet stable enough to release. Once these functionalities are refined, we will add examples to the wiki.
2. If you have ideas or partially validated application scenarios, feel free to share them with us for feasibility assessment.


 Answer:

1. Due to stability requirements, in order for PlatformIO to support ESP32-P4, it is also necessary for the PlatformIO community to support the Arduino-esp32 SDK V3.1x version
2. During development, we tested MPY firmware for ESP32-P4, which can run some basic commands. However, this is just a preliminary verification; actual interface and peripheral applications are not yet adapted. Once fully adapted and stable, we will release ESP32-P4 usage examples in MicroPython.


Support




Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)