Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(esp32_p4_function_ev_board): add example of wifi connection #407

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
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,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: "*"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably makes sense to pin at least some version of esp_wifi_remote (and maybe esp_hosted?) here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, do you plan update and set some major version here?

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
Loading