Skip to content

Commit

Permalink
feat(esp32_p4_function_ev_board): add example of wifi connection
Browse files Browse the repository at this point in the history
  • Loading branch information
igrr committed Oct 11, 2024
1 parent 363acd4 commit 0b15e99
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 0 deletions.
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 bsp/esp32_p4_function_ev_board/examples/wifi_connection/README.md
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.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
idf_component_register(SRCS "wifi_example_main.c"
INCLUDE_DIRS ".")
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"
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: CC0-1.0
*/
#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());
}
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0b15e99

Please sign in to comment.