-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(esp32_p4_function_ev_board): add example of wifi connection
- Loading branch information
Showing
6 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
bsp/esp32_p4_function_ev_board/examples/wifi_connection/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
28 changes: 28 additions & 0 deletions
28
bsp/esp32_p4_function_ev_board/examples/wifi_connection/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
|
2 changes: 2 additions & 0 deletions
2
bsp/esp32_p4_function_ev_board/examples/wifi_connection/main/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
idf_component_register(SRCS "wifi_example_main.c" | ||
INCLUDE_DIRS ".") |
8 changes: 8 additions & 0 deletions
8
bsp/esp32_p4_function_ev_board/examples/wifi_connection/main/idf_component.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
15 changes: 15 additions & 0 deletions
15
bsp/esp32_p4_function_ev_board/examples/wifi_connection/main/wifi_example_main.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <stdio.h> | ||
#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()); | ||
} |
3 changes: 3 additions & 0 deletions
3
bsp/esp32_p4_function_ev_board/examples/wifi_connection/sdkconfig.defaults
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CONFIG_IDF_TARGET="esp32p4" | ||
CONFIG_EXAMPLE_CONNECT_WIFI=y | ||
CONFIG_SLAVE_IDF_TARGET_ESP32C6=y |