diff --git a/bsp/esp32_p4_function_ev_board/examples/wifi_connection/CMakeLists.txt b/bsp/esp32_p4_function_ev_board/examples/wifi_connection/CMakeLists.txt new file mode 100644 index 00000000..7d337fbb --- /dev/null +++ b/bsp/esp32_p4_function_ev_board/examples/wifi_connection/CMakeLists.txt @@ -0,0 +1,7 @@ +# The following five lines of boilerplate have to be in your project's +# CMakeLists in this exact order for cmake to work correctly +cmake_minimum_required(VERSION 3.16) + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +set(COMPONENTS main) +project(wifi_connection) diff --git a/bsp/esp32_p4_function_ev_board/examples/wifi_connection/README.md b/bsp/esp32_p4_function_ev_board/examples/wifi_connection/README.md new file mode 100644 index 00000000..c05e9422 --- /dev/null +++ b/bsp/esp32_p4_function_ev_board/examples/wifi_connection/README.md @@ -0,0 +1,28 @@ +# ESP32-P4 Function Evaluation Board Wi-Fi Connection Example + +This example demonstrates how to connect to a Wi-Fi network using the ESP32-P4 Function Evaluation Board, utilizing the on-board ESP32-C6 module for connectivity. + +## How to use example + +### Hardware Required + +This example runs on the ESP32-P4 Function Evaluation Board (v1.1 or later). + +### Configure the project + +Run `idf.py menuconfig` and set the Wi-Fi SSID and password in the Example Configuration menu (`CONFIG_EXAMPLE_WIFI_SSID` and `CONFIG_EXAMPLE_WIFI_PASSWORD`). + +### Build and Flash + +Build the project and flash it to the board, then run monitor tool to view serial output: + +```shell +idf.py flash monitor +``` + +(To exit the serial monitor, type `Ctrl-]`.) + +## Troubleshooting + +If Wi-Fi connection fails, please check that ESP32-C6 module on the ESP32-P4 Function Evaluation Board is flashed with esp-hosted firmware. See [here](https://github.com/espressif/esp-hosted/blob/feature/esp_as_mcu_host/docs/esp32_p4_function_ev_board.md#52-using-esp-prog) for instructions on how to flash the firmware to ESP32-C6. + diff --git a/bsp/esp32_p4_function_ev_board/examples/wifi_connection/main/CMakeLists.txt b/bsp/esp32_p4_function_ev_board/examples/wifi_connection/main/CMakeLists.txt new file mode 100644 index 00000000..fa1d1d0e --- /dev/null +++ b/bsp/esp32_p4_function_ev_board/examples/wifi_connection/main/CMakeLists.txt @@ -0,0 +1,2 @@ +idf_component_register(SRCS "wifi_example_main.c" + INCLUDE_DIRS ".") diff --git a/bsp/esp32_p4_function_ev_board/examples/wifi_connection/main/idf_component.yml b/bsp/esp32_p4_function_ev_board/examples/wifi_connection/main/idf_component.yml new file mode 100644 index 00000000..a5e97595 --- /dev/null +++ b/bsp/esp32_p4_function_ev_board/examples/wifi_connection/main/idf_component.yml @@ -0,0 +1,8 @@ +dependencies: + espressif/esp32_p4_function_ev_board: + version: "*" + override_path: "../../../" + espressif/esp_wifi_remote: + version: "*" + protocol_examples_common: + path: "$IDF_PATH/examples/common_components/protocol_examples_common" diff --git a/bsp/esp32_p4_function_ev_board/examples/wifi_connection/main/wifi_example_main.c b/bsp/esp32_p4_function_ev_board/examples/wifi_connection/main/wifi_example_main.c new file mode 100644 index 00000000..8659bacc --- /dev/null +++ b/bsp/esp32_p4_function_ev_board/examples/wifi_connection/main/wifi_example_main.c @@ -0,0 +1,20 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: CC0-1.0 + */ +#include +#include "esp_log.h" +#include "protocol_examples_common.h" +#include "nvs_flash.h" +#include "esp_netif.h" +#include "esp_event.h" + +void app_main(void) +{ + ESP_ERROR_CHECK(nvs_flash_init()); + ESP_ERROR_CHECK(esp_netif_init()); + ESP_ERROR_CHECK(esp_event_loop_create_default()); + + ESP_ERROR_CHECK(example_connect()); +} diff --git a/bsp/esp32_p4_function_ev_board/examples/wifi_connection/sdkconfig.defaults b/bsp/esp32_p4_function_ev_board/examples/wifi_connection/sdkconfig.defaults new file mode 100644 index 00000000..dca13ddc --- /dev/null +++ b/bsp/esp32_p4_function_ev_board/examples/wifi_connection/sdkconfig.defaults @@ -0,0 +1,11 @@ +CONFIG_IDF_TARGET="esp32p4" +CONFIG_EXAMPLE_CONNECT_WIFI=y +CONFIG_SLAVE_IDF_TARGET_ESP32C6=y +CONFIG_ESP_SDIO_BUS_WIDTH=4 +CONFIG_ESP_SDIO_CLOCK_FREQ_KHZ=40000 +CONFIG_ESP_SDIO_PIN_CMD=19 +CONFIG_ESP_SDIO_PIN_CLK=18 +CONFIG_ESP_SDIO_PIN_D0=14 +CONFIG_ESP_SDIO_PIN_D1=15 +CONFIG_ESP_SDIO_PIN_D2=16 +CONFIG_ESP_SDIO_PIN_D3=17