Compare commits
36 Commits
d4d5b500dd
...
f8ada804bb
Author | SHA1 | Date | |
---|---|---|---|
|
f8ada804bb | ||
|
a9d0f22193 | ||
|
e499576efd | ||
|
8498af6bd4 | ||
|
0ab74e5c5d | ||
|
d1c0cc5e3d | ||
|
c689d2ab9e | ||
|
1558b05d1c | ||
|
eaba2427aa | ||
|
d98ba8b570 | ||
|
2b39e1c625 | ||
|
d07bdc70b6 | ||
|
834ae1c002 | ||
|
147bc3b889 | ||
|
b145507fff | ||
|
df497dde7a | ||
|
a7a18f4632 | ||
|
9d1a374e01 | ||
|
fd916b39ef | ||
|
7c2922a7d5 | ||
|
dd8185bdf1 | ||
|
9f0e5aec6c | ||
|
5b4f8a6e50 | ||
|
d1c8a1d1c2 | ||
|
2146569780 | ||
|
ed01a2a32d | ||
|
1091defe43 | ||
|
de8df121e6 | ||
|
6912d661d9 | ||
|
a0eb182f45 | ||
|
64b1fe94e8 | ||
|
818644cf5a | ||
|
d783018e82 | ||
|
78c572bbc3 | ||
|
5c42c794d3 | ||
|
c829a82ff1 |
@ -307,27 +307,27 @@ test_build_system_cmake:
|
||||
variables:
|
||||
SHELL_TEST_SCRIPT: test_build_system_cmake.sh
|
||||
|
||||
test_build_system_cmake_macos:
|
||||
extends:
|
||||
- .test_build_system_template
|
||||
- .before_script_macos
|
||||
- .rules:build:macos
|
||||
tags:
|
||||
- macos_shell
|
||||
variables:
|
||||
SHELL_TEST_SCRIPT: test_build_system_cmake.sh
|
||||
script:
|
||||
- ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
|
||||
- rm -rf test_build_system
|
||||
- mkdir test_build_system
|
||||
- cd test_build_system
|
||||
# copy-paste the script from .test_build_system_template
|
||||
# since `ESP_IDF_TEMPLATE_GIT` is a group variable and has higher precedence than job variable
|
||||
# export here to override the group variable
|
||||
#
|
||||
# Clone the template app from github for macos runners
|
||||
- export ESP_IDF_TEMPLATE_GIT="https://github.com/espressif/esp-idf-template.git"
|
||||
- ${IDF_PATH}/tools/ci/${SHELL_TEST_SCRIPT}
|
||||
#test_build_system_cmake_macos:
|
||||
# extends:
|
||||
# - .test_build_system_template
|
||||
# - .before_script_macos
|
||||
# - .rules:build:macos
|
||||
# tags:
|
||||
# - macos_shell
|
||||
# variables:
|
||||
# SHELL_TEST_SCRIPT: test_build_system_cmake.sh
|
||||
# script:
|
||||
# - ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
|
||||
# - rm -rf test_build_system
|
||||
# - mkdir test_build_system
|
||||
# - cd test_build_system
|
||||
# # copy-paste the script from .test_build_system_template
|
||||
# # since `ESP_IDF_TEMPLATE_GIT` is a group variable and has higher precedence than job variable
|
||||
# # export here to override the group variable
|
||||
# #
|
||||
# # Clone the template app from github for macos runners
|
||||
# - export ESP_IDF_TEMPLATE_GIT="https://github.com/espressif/esp-idf-template.git"
|
||||
# - ${IDF_PATH}/tools/ci/${SHELL_TEST_SCRIPT}
|
||||
|
||||
build_docker:
|
||||
extends:
|
||||
|
@ -28,6 +28,10 @@ if(NOT BOOTLOADER_BUILD)
|
||||
list(APPEND compile_options "-O2")
|
||||
endif()
|
||||
|
||||
if(CONFIG_COMPILER_STACK_MIRROR)
|
||||
list(APPEND compile_options "-finstrument-functions")
|
||||
endif()
|
||||
|
||||
else() # BOOTLOADER_BUILD
|
||||
|
||||
if(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE)
|
||||
|
16
Kconfig
@ -384,6 +384,22 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
||||
help
|
||||
Stack smashing protection.
|
||||
|
||||
config COMPILER_STACK_MIRROR
|
||||
prompt "Enable Stack Mirror"
|
||||
bool
|
||||
default "n"
|
||||
help
|
||||
Make corrupted backtraces much less likely by creating a dupliate copy of stack return
|
||||
addresses in heap memory. Requires about 100 bytes of memory per thread.
|
||||
|
||||
config COMPILER_STACK_MIRROR_DEPTH
|
||||
prompt "Stack Mirror Depth"
|
||||
int
|
||||
default 26
|
||||
depends on COMPILER_STACK_MIRROR
|
||||
help
|
||||
The maximum depth of the stack mirror. 4 bytes are needed per depth.
|
||||
|
||||
config COMPILER_WARN_WRITE_STRINGS
|
||||
bool "Enable -Wwrite-strings warning flag"
|
||||
default "n"
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 45e328053591081abcd387ec2eecc8add43f4b15
|
||||
Subproject commit a4d7731a95db8a6cfb98e5068b6757c32ecfaa2a
|
@ -2363,6 +2363,7 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
||||
//register connection parameter update callback
|
||||
void btc_gap_callback_init(void)
|
||||
{
|
||||
BTM_BleRegiseterPktLengthChangeCallback(btc_set_pkt_length_callback);
|
||||
BTM_BleRegiseterConnParamCallback(btc_update_conn_param_callback);
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
BTM_BleGapRegisterCallback(btc_ble_5_gap_callback);
|
||||
|
@ -70,7 +70,7 @@ static tBTM_BLE_VSC_CB *cmn_ble_gap_vsc_cb_ptr;
|
||||
static tBTM_BLE_CTRL_FEATURES_CBACK *p_ctrl_le_feature_rd_cmpl_cback = NULL;
|
||||
#endif
|
||||
|
||||
tBTM_CallbackFunc conn_param_update_cb;
|
||||
tBTM_CallbackFunc conn_callback_func;
|
||||
/*******************************************************************************
|
||||
** Local functions
|
||||
*******************************************************************************/
|
||||
@ -309,7 +309,21 @@ void btm_ble_sem_free(void)
|
||||
*******************************************************************************/
|
||||
void BTM_BleRegiseterConnParamCallback(tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb)
|
||||
{
|
||||
conn_param_update_cb.update_conn_param_cb = update_conn_param_cb;
|
||||
conn_callback_func.update_conn_param_cb = update_conn_param_cb;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleRegiseterPktLengthChangeCallback
|
||||
**
|
||||
** Description Registers a callback function for packet length changes.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTM_BleRegiseterPktLengthChangeCallback(tBTM_SET_PKT_DATA_LENGTH_CBACK *ptk_len_chane_cb)
|
||||
{
|
||||
conn_callback_func.set_pkt_data_length_cb = ptk_len_chane_cb;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -959,9 +959,11 @@ typedef struct {
|
||||
typedef struct{
|
||||
//connection parameters update callback
|
||||
tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb;
|
||||
// setting packet data length callback
|
||||
tBTM_SET_PKT_DATA_LENGTH_CBACK *set_pkt_data_length_cb;
|
||||
}tBTM_CallbackFunc;
|
||||
|
||||
extern tBTM_CallbackFunc conn_param_update_cb;
|
||||
extern tBTM_CallbackFunc conn_callback_func;
|
||||
/* security action for L2CAP COC channels */
|
||||
#define BTM_SEC_OK 1
|
||||
#define BTM_SEC_ENCRYPT 2 /* encrypt the link with current key */
|
||||
|
@ -1466,7 +1466,6 @@ static void btu_hcif_command_status_evt(uint8_t status, BT_HDR *command, void *c
|
||||
hack->context = context;
|
||||
|
||||
event->event = BTU_POST_TO_TASK_NO_GOOD_HORRIBLE_HACK;
|
||||
|
||||
if (btu_task_post(SIG_BTU_HCI_MSG, event, OSI_THREAD_MAX_TIMEOUT) == false) {
|
||||
osi_free(event);
|
||||
}
|
||||
|
@ -1365,6 +1365,7 @@ extern "C" {
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTM_BleRegiseterConnParamCallback(tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb);
|
||||
void BTM_BleRegiseterPktLengthChangeCallback(tBTM_SET_PKT_DATA_LENGTH_CBACK *ptk_len_chane_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
@ -175,14 +175,14 @@ BOOLEAN L2CA_UpdateBleConnParams (BD_ADDR rem_bda, UINT16 min_int, UINT16 max_in
|
||||
L2CAP_TRACE_ERROR("There are two connection parameter requests that are being updated, please try later ");
|
||||
}
|
||||
|
||||
if ((need_cb == TRUE) && (conn_param_update_cb.update_conn_param_cb != NULL)) {
|
||||
if ((need_cb == TRUE) && (conn_callback_func.update_conn_param_cb != NULL)) {
|
||||
tBTM_LE_UPDATE_CONN_PRAMS update_param;
|
||||
update_param.max_conn_int = max_int;
|
||||
update_param.min_conn_int = min_int;
|
||||
update_param.conn_int = p_lcb->current_used_conn_interval;
|
||||
update_param.slave_latency = p_lcb->current_used_conn_latency;
|
||||
update_param.supervision_tout = p_lcb->current_used_conn_timeout;
|
||||
(conn_param_update_cb.update_conn_param_cb)(status, p_lcb->remote_bd_addr, &update_param);
|
||||
(conn_callback_func.update_conn_param_cb)(status, p_lcb->remote_bd_addr, &update_param);
|
||||
return (status == HCI_SUCCESS);
|
||||
}
|
||||
|
||||
@ -287,7 +287,7 @@ UINT8 L2CA_GetBleConnRole (BD_ADDR bd_addr)
|
||||
**
|
||||
** Function l2cble_notify_le_connection
|
||||
**
|
||||
** Description This function notifiy the l2cap connection to the app layer
|
||||
** Description This function notify the l2cap connection to the app layer
|
||||
**
|
||||
** Returns none
|
||||
**
|
||||
@ -647,7 +647,7 @@ void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status, UINT16 conn_in
|
||||
p_lcb->conn_update_mask &= ~L2C_BLE_UPDATE_PARAM_FULL;
|
||||
btu_stop_timer(&p_lcb->upda_con_timer);
|
||||
|
||||
if (conn_param_update_cb.update_conn_param_cb != NULL) {
|
||||
if (conn_callback_func.update_conn_param_cb != NULL) {
|
||||
l2c_send_update_conn_params_cb(p_lcb, status);
|
||||
}
|
||||
|
||||
@ -686,7 +686,7 @@ void l2cble_get_conn_param_format_err_from_contoller (UINT8 status, UINT16 handl
|
||||
|
||||
btu_stop_timer (&p_lcb->upda_con_timer);
|
||||
|
||||
if (conn_param_update_cb.update_conn_param_cb != NULL) {
|
||||
if (conn_callback_func.update_conn_param_cb != NULL) {
|
||||
l2c_send_update_conn_params_cb(p_lcb, status);
|
||||
}
|
||||
if ((p_lcb->conn_update_mask & L2C_BLE_UPDATE_PARAM_FULL) != 0){
|
||||
@ -868,7 +868,7 @@ void l2cble_process_sig_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
|
||||
**
|
||||
** Function l2cble_init_direct_conn
|
||||
**
|
||||
** Description This function is to initate a direct connection
|
||||
** Description This function is to initiate a direct connection
|
||||
**
|
||||
** Returns TRUE connection initiated, FALSE otherwise.
|
||||
**
|
||||
@ -894,7 +894,7 @@ BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb)
|
||||
|
||||
/* There can be only one BLE connection request outstanding at a time */
|
||||
if (p_dev_rec == NULL) {
|
||||
L2CAP_TRACE_WARNING ("unknown device, can not initate connection");
|
||||
L2CAP_TRACE_WARNING ("unknown device, can not initiate connection");
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
@ -947,7 +947,7 @@ BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb)
|
||||
|
||||
if (!btm_ble_topology_check(BTM_BLE_STATE_INIT)) {
|
||||
l2cu_release_lcb (p_lcb);
|
||||
L2CAP_TRACE_ERROR("initate direct connection fail, topology limitation");
|
||||
L2CAP_TRACE_ERROR("initiate direct connection fail, topology limitation");
|
||||
return FALSE;
|
||||
}
|
||||
uint32_t link_timeout = L2CAP_BLE_LINK_CONNECT_TOUT;
|
||||
@ -981,7 +981,7 @@ BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb)
|
||||
BLE_CE_LEN_MIN, /* UINT16 min_len */
|
||||
BLE_CE_LEN_MIN)) { /* UINT16 max_len */
|
||||
l2cu_release_lcb (p_lcb);
|
||||
L2CAP_TRACE_ERROR("initate direct connection fail, no resources");
|
||||
L2CAP_TRACE_ERROR("initiate direct connection fail, no resources");
|
||||
return (FALSE);
|
||||
} else {
|
||||
p_lcb->link_state = LST_CONNECTING;
|
||||
@ -1033,7 +1033,7 @@ BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb)
|
||||
btm_ble_set_conn_st (BLE_DIR_CONN);
|
||||
if(!btsnd_hcic_ble_create_ext_conn(&aux_conn)) {
|
||||
l2cu_release_lcb (p_lcb);
|
||||
L2CAP_TRACE_ERROR("initate Aux connection failed, no resources");
|
||||
L2CAP_TRACE_ERROR("initiate Aux connection failed, no resources");
|
||||
}
|
||||
#else
|
||||
L2CAP_TRACE_ERROR("BLE 5.0 not support!\n");
|
||||
@ -1324,15 +1324,18 @@ void l2cble_process_data_length_change_event(UINT16 handle, UINT16 tx_data_len,
|
||||
if(p_acl) {
|
||||
p_acl->data_length_params = data_length_params;
|
||||
if (p_acl->p_set_pkt_data_cback) {
|
||||
// Only when the corresponding API is called will the callback be registered
|
||||
(*p_acl->p_set_pkt_data_cback)(BTM_SUCCESS, &data_length_params);
|
||||
} else {
|
||||
// If the callback is not registered,using global callback
|
||||
(*conn_callback_func.set_pkt_data_length_cb)(BTM_SUCCESS, &data_length_params);
|
||||
}
|
||||
|
||||
p_acl->data_len_updating = false;
|
||||
if(p_acl->data_len_waiting) {
|
||||
p_acl->data_len_waiting = false;
|
||||
p_acl->p_set_pkt_data_cback = p_acl->p_set_data_len_cback_waiting;
|
||||
p_acl->p_set_data_len_cback_waiting = NULL;
|
||||
// if value is same, triger callback directly
|
||||
// if value is same, trigger callback directly
|
||||
if(p_acl->tx_len_waiting == p_acl->data_length_params.tx_len) {
|
||||
if(p_acl->p_set_pkt_data_cback) {
|
||||
(*p_acl->p_set_pkt_data_cback)(BTM_SUCCESS, &p_acl->data_length_params);
|
||||
@ -1396,7 +1399,7 @@ void l2cble_set_fixed_channel_tx_data_length(BD_ADDR remote_bda, UINT16 fix_cid,
|
||||
*******************************************************************************/
|
||||
void l2c_send_update_conn_params_cb(tL2C_LCB *p_lcb, UINT8 status)
|
||||
{
|
||||
if(conn_param_update_cb.update_conn_param_cb != NULL){
|
||||
if(conn_callback_func.update_conn_param_cb != NULL){
|
||||
tBTM_LE_UPDATE_CONN_PRAMS update_param;
|
||||
//if myself update the connection parameters
|
||||
if (p_lcb->updating_param_flag){
|
||||
@ -1412,7 +1415,7 @@ void l2c_send_update_conn_params_cb(tL2C_LCB *p_lcb, UINT8 status)
|
||||
update_param.slave_latency = p_lcb->current_used_conn_latency;
|
||||
update_param.supervision_tout = p_lcb->current_used_conn_timeout;
|
||||
|
||||
(conn_param_update_cb.update_conn_param_cb)(status, p_lcb->remote_bd_addr, &update_param);
|
||||
(conn_callback_func.update_conn_param_cb)(status, p_lcb->remote_bd_addr, &update_param);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit b8499910c5bbe87665646728654a1ae762681f3d
|
||||
Subproject commit b00a5d642658aebc96a7565d8a9c4a09f8125752
|
@ -23,7 +23,7 @@ extern "C" {
|
||||
/** Minor version number (x.X.x) */
|
||||
#define ESP_IDF_VERSION_MINOR 4
|
||||
/** Patch version number (x.x.X) */
|
||||
#define ESP_IDF_VERSION_PATCH 7
|
||||
#define ESP_IDF_VERSION_PATCH 8
|
||||
|
||||
/**
|
||||
* Macro to convert IDF version number into an integer
|
||||
|
@ -64,6 +64,7 @@ static inline void __attribute__((always_inline)) spinlock_initialize(spinlock_t
|
||||
* @param lock - target spinlock object
|
||||
* @param timeout - cycles to wait, passing SPINLOCK_WAIT_FOREVER blocs indefinitely
|
||||
*/
|
||||
|
||||
static inline bool __attribute__((always_inline)) spinlock_acquire(spinlock_t *lock, int32_t timeout)
|
||||
{
|
||||
#if !CONFIG_FREERTOS_UNICORE && !BOOTLOADER_BUILD
|
||||
|
@ -20,6 +20,7 @@ else()
|
||||
"startup.c"
|
||||
"system_time.c"
|
||||
"stack_check.c"
|
||||
"stack_mirror.c"
|
||||
"task_wdt.c"
|
||||
"ubsan.c"
|
||||
"xt_wdt.c"
|
||||
|
10
components/esp_system/include/esp_private/stack_mirror.h
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
void stack_mirror_enable();
|
||||
void stack_mirror_print_backtrace(bool panic);
|
||||
#endif
|
@ -22,6 +22,7 @@
|
||||
#include "soc/soc_memory_layout.h"
|
||||
#include "soc/cpu.h"
|
||||
#include "esp_private/panic_internal.h"
|
||||
#include "esp_private/stack_mirror.h"
|
||||
|
||||
#include "xtensa/xtensa_context.h"
|
||||
|
||||
@ -94,6 +95,9 @@ esp_err_t IRAM_ATTR esp_backtrace_print_from_frame(int depth, const esp_backtrac
|
||||
esp_err_t ret = ESP_OK;
|
||||
if (corrupted) {
|
||||
print_str(" |<-CORRUPTED", panic);
|
||||
#ifndef CONFIG_COMPILER_STACK_MIRROR
|
||||
print_str("\r\nTurn on Stack Mirroring to avoid corruption", panic);
|
||||
#endif
|
||||
ret = ESP_FAIL;
|
||||
} else if (stk_frame.next_pc != 0) { //Backtrace continues
|
||||
print_str(" |<-CONTINUES", panic);
|
||||
@ -107,5 +111,12 @@ esp_err_t IRAM_ATTR esp_backtrace_print(int depth)
|
||||
//Initialize stk_frame with first frame of stack
|
||||
esp_backtrace_frame_t start = { 0 };
|
||||
esp_backtrace_get_start(&(start.pc), &(start.sp), &(start.next_pc));
|
||||
return esp_backtrace_print_from_frame(depth, &start, false);
|
||||
esp_err_t err = esp_backtrace_print_from_frame(depth, &start, false);
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
if (err != ESP_OK) {
|
||||
stack_mirror_print_backtrace(false);
|
||||
}
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "esp_debug_helpers.h"
|
||||
|
||||
#include "esp_private/panic_internal.h"
|
||||
#include "esp_private/stack_mirror.h"
|
||||
#include "esp_private/panic_reason.h"
|
||||
#include "soc/soc.h"
|
||||
|
||||
@ -467,5 +468,9 @@ void panic_print_backtrace(const void *f, int core)
|
||||
{
|
||||
XtExcFrame *xt_frame = (XtExcFrame *) f;
|
||||
esp_backtrace_frame_t frame = {.pc = xt_frame->pc, .sp = xt_frame->a1, .next_pc = xt_frame->a0, .exc_frame = xt_frame};
|
||||
esp_backtrace_print_from_frame(100, &frame, true);
|
||||
if (esp_backtrace_print_from_frame(100, &frame, true) != ESP_OK) {
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
stack_mirror_print_backtrace(true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
128
components/esp_system/stack_mirror.c
Normal file
@ -0,0 +1,128 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_private/panic_internal.h"
|
||||
#include "soc/soc_memory_types.h"
|
||||
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
|
||||
#define STACK_MIRROR_MAGIC 139871234
|
||||
|
||||
/* __cyg_profile_func_enter - gcc inserts a call to this function at the start of every function
|
||||
* __cyg_profile_func_exit - gcc inserts a call to this function at the end of every function
|
||||
* no_instrument_function - This tells GCC to not insert instrumentation calls (would cause an infinite loop) */
|
||||
void IRAM_ATTR __cyg_profile_func_enter(void *func, void *caller) __attribute__((no_instrument_function));
|
||||
void IRAM_ATTR __cyg_profile_func_exit(void *func, void *caller) __attribute__((no_instrument_function));
|
||||
static void IRAM_ATTR print_str(const char* str, bool panic) __attribute__((no_instrument_function));
|
||||
static void IRAM_ATTR print_entry(uint32_t pc, bool panic) __attribute__((no_instrument_function));
|
||||
|
||||
static uint32_t enabled;
|
||||
|
||||
static void IRAM_ATTR print_str(const char* str, bool panic)
|
||||
{
|
||||
if (panic) {
|
||||
panic_print_str(str);
|
||||
} else {
|
||||
esp_rom_printf(str);
|
||||
}
|
||||
}
|
||||
|
||||
static void IRAM_ATTR print_entry(uint32_t pc, bool panic)
|
||||
{
|
||||
if (panic) {
|
||||
panic_print_str(" 0x");
|
||||
panic_print_hex(pc);
|
||||
} else {
|
||||
esp_rom_printf(" 0x%08X", pc);
|
||||
}
|
||||
}
|
||||
|
||||
extern void xt_unhandled_exception(XtExcFrame *frame);
|
||||
|
||||
void IRAM_ATTR __cyg_profile_func_enter(void *func, void *callsite)
|
||||
{
|
||||
if (enabled == STACK_MIRROR_MAGIC) {
|
||||
esp_stack_mirror_t *m = pvTaskGetStackMirrorPointer();
|
||||
if (func == xt_unhandled_exception) {
|
||||
// dont add to the stack trace after we already hit panic.
|
||||
m->panicing = true;
|
||||
}
|
||||
if (!m->panicing) {
|
||||
if (m->depth < CONFIG_COMPILER_STACK_MIRROR_DEPTH) {
|
||||
m->backtrace[m->depth] = (uint32_t) func;
|
||||
}
|
||||
m->depth++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IRAM_ATTR __cyg_profile_func_exit(void *func, void *callsite)
|
||||
{
|
||||
if (enabled == STACK_MIRROR_MAGIC) {
|
||||
esp_stack_mirror_t *m = pvTaskGetStackMirrorPointer();
|
||||
if (!m->panicing && m->depth > 0) {
|
||||
m->depth--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IRAM_ATTR stack_mirror_print_backtrace(bool panic)
|
||||
{
|
||||
esp_stack_mirror_t *m = pvTaskGetStackMirrorPointer();
|
||||
|
||||
print_str("\r\nBacktrace (Mirror):", panic);
|
||||
|
||||
if (m == NULL) {
|
||||
|
||||
print_str("\r\nNot Set", panic);
|
||||
|
||||
} else if (esp_ptr_internal(m) == false) {
|
||||
|
||||
print_str("\r\nInvalid Ptr", panic);
|
||||
|
||||
} else if (m->depth == 0) {
|
||||
|
||||
print_str("\r\nEmpty", panic);
|
||||
|
||||
} else {
|
||||
|
||||
uint32_t depth = m->depth;
|
||||
|
||||
if (depth >= CONFIG_COMPILER_STACK_MIRROR_DEPTH) {
|
||||
print_str("\r\nBACKTRACE INCOMPLETE", panic);
|
||||
depth = CONFIG_COMPILER_STACK_MIRROR_DEPTH;
|
||||
}
|
||||
|
||||
for (int i = depth - 1; i >= 0; i--) {
|
||||
|
||||
uint32_t pc = m->backtrace[i];
|
||||
|
||||
print_entry(pc, panic);
|
||||
|
||||
bool corrupted = !esp_ptr_executable((void *)esp_cpu_process_stack_pc(pc));
|
||||
|
||||
if (corrupted) {
|
||||
print_str(" |<-CORRUPTED", panic);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print_str("\r\n\r\n", panic);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void stack_mirror_enable()
|
||||
{
|
||||
enabled = STACK_MIRROR_MAGIC;
|
||||
}
|
||||
|
||||
#endif // CONFIG_COMPILER_STACK_MIRROR
|
@ -1237,6 +1237,26 @@ esp_err_t esp_wifi_ftm_end_session(void);
|
||||
*/
|
||||
esp_err_t esp_wifi_ftm_resp_set_offset(int16_t offset_cm);
|
||||
|
||||
/**
|
||||
* @brief Get FTM measurements report copied into a user provided buffer.
|
||||
*
|
||||
* @attention 1. To get the FTM report, user first needs to allocate a buffer of size
|
||||
* (sizeof(wifi_ftm_report_entry_t) * num_entries) where the API will fill up to num_entries
|
||||
* valid FTM measurements in the buffer. Total number of entries can be found in the event
|
||||
* WIFI_EVENT_FTM_REPORT as ftm_report_num_entries
|
||||
* @attention 2. The internal FTM report is freed upon use of this API which means the API can only be used
|
||||
* once afer every FTM session initiated
|
||||
* @attention 3. Passing the buffer as NULL merely frees the FTM report
|
||||
*
|
||||
* @param report Pointer to the buffer for receiving the FTM report
|
||||
* @param num_entries Number of FTM report entries to be filled in the report
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: succeed
|
||||
* - others: failed
|
||||
*/
|
||||
esp_err_t esp_wifi_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries);
|
||||
|
||||
/**
|
||||
* @brief Enable or disable 11b rate of specified interface
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -582,7 +582,9 @@ typedef struct {
|
||||
uint8_t resp_mac[6]; /**< MAC address of the FTM Responder */
|
||||
uint8_t channel; /**< Primary channel of the FTM Responder */
|
||||
uint8_t frm_count; /**< No. of FTM frames requested in terms of 4 or 8 bursts (allowed values - 0(No pref), 16, 24, 32, 64) */
|
||||
uint16_t burst_period; /**< Requested time period between consecutive FTM bursts in 100's of milliseconds (0 - No pref) */
|
||||
uint16_t burst_period; /**< Requested period between FTM bursts in 100's of milliseconds (allowed values 0(No pref) - 100) */
|
||||
bool use_get_report_api; /**< True - Using esp_wifi_ftm_get_report to get FTM report, False - Using ftm_report_data from
|
||||
WIFI_EVENT_FTM_REPORT to get FTM report */
|
||||
} wifi_ftm_initiator_cfg_t;
|
||||
|
||||
/**
|
||||
@ -757,6 +759,8 @@ typedef enum {
|
||||
FTM_STATUS_CONF_REJECTED, /**< Peer rejected FTM configuration in FTM Request */
|
||||
FTM_STATUS_NO_RESPONSE, /**< Peer did not respond to FTM Requests */
|
||||
FTM_STATUS_FAIL, /**< Unknown error during FTM exchange */
|
||||
FTM_STATUS_NO_VALID_MSMT, /**< FTM session did not result in any valid measurements */
|
||||
FTM_STATUS_USER_TERM, /**< User triggered termination */
|
||||
} wifi_ftm_status_t;
|
||||
|
||||
/** Argument structure for */
|
||||
@ -777,7 +781,8 @@ typedef struct {
|
||||
uint32_t rtt_raw; /**< Raw average Round-Trip-Time with peer in Nano-Seconds */
|
||||
uint32_t rtt_est; /**< Estimated Round-Trip-Time with peer in Nano-Seconds */
|
||||
uint32_t dist_est; /**< Estimated one-way distance in Centi-Meters */
|
||||
wifi_ftm_report_entry_t *ftm_report_data; /**< Pointer to FTM Report with multiple entries, should be freed after use */
|
||||
wifi_ftm_report_entry_t *ftm_report_data; /**< Pointer to FTM Report, should be freed after use. Note: Highly recommended
|
||||
to use API esp_wifi_ftm_get_report to get the report instead of using this */
|
||||
uint8_t ftm_report_num_entries; /**< Number of entries in the FTM Report data */
|
||||
} wifi_event_ftm_report_t;
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit bf71ef7b29d94eef917388c5daa7bdd05ee6f9fc
|
||||
Subproject commit cfa077793e6d7ad04eef237770458ec2c5e1712c
|
@ -173,8 +173,10 @@ menu "FreeRTOS"
|
||||
FreeRTOS has the ability to store per-thread pointers in the task
|
||||
control block. This controls the number of pointers available.
|
||||
|
||||
This value must be at least 1. Index 0 is reserved for use by the pthreads API
|
||||
thread-local-storage. Other indexes can be used for any desired purpose.
|
||||
This value must be at least 1. Index 0 is reserved for use by the pthreads API thread-local-storage.
|
||||
|
||||
Other indexes can be used for any desired purpose.
|
||||
|
||||
|
||||
choice FREERTOS_ASSERT
|
||||
prompt "FreeRTOS assertions"
|
||||
|
@ -1254,6 +1254,12 @@ typedef struct xSTATIC_TCB
|
||||
#if ( configUSE_POSIX_ERRNO == 1 )
|
||||
int iDummy22;
|
||||
#endif
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
uint32_t uDummy23;
|
||||
uint32_t uDummy24;
|
||||
uint32_t uDummy25[CONFIG_COMPILER_STACK_MIRROR_DEPTH];
|
||||
#endif
|
||||
|
||||
} StaticTask_t;
|
||||
|
||||
/*
|
||||
|
@ -1818,6 +1818,16 @@ configSTACK_DEPTH_TYPE uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) PRIVIL
|
||||
*/
|
||||
uint8_t* pxTaskGetStackStart( TaskHandle_t xTask) PRIVILEGED_FUNCTION;
|
||||
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
typedef struct {
|
||||
uint32_t panicing;
|
||||
uint32_t depth;
|
||||
uint32_t backtrace[CONFIG_COMPILER_STACK_MIRROR_DEPTH];
|
||||
} esp_stack_mirror_t;
|
||||
|
||||
esp_stack_mirror_t *pvTaskGetStackMirrorPointer();
|
||||
#endif // CONFIG_COMPILER_STACK_MIRROR
|
||||
|
||||
/* When using trace macros it is sometimes necessary to include task.h before
|
||||
* FreeRTOS.h. When this is done TaskHookFunction_t will not yet have been defined,
|
||||
* so the following two prototypes will cause a compilation error. This can be
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "esp_task.h"
|
||||
#include "esp_private/crosscore_int.h"
|
||||
#include "esp_private/startup_internal.h" /* Required by g_spiram_ok. [refactor-todo] for g_spiram_ok */
|
||||
#include "esp_private/stack_mirror.h"
|
||||
#include "esp_log.h"
|
||||
#include "soc/soc_memory_types.h"
|
||||
#include "soc/dport_access.h"
|
||||
@ -138,6 +139,11 @@ static void main_task(void* args)
|
||||
}
|
||||
#endif
|
||||
|
||||
// Todo: this could be initialized sooner, but not sure where exactly...
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
stack_mirror_enable();
|
||||
#endif
|
||||
|
||||
app_main();
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
@ -558,6 +558,9 @@ static inline void __attribute__((always_inline)) uxPortCompareSetExtram(volatil
|
||||
|
||||
// --------------------- Interrupts ------------------------
|
||||
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
IRAM_ATTR __attribute__((no_instrument_function))
|
||||
#endif
|
||||
static inline UBaseType_t __attribute__((always_inline)) xPortSetInterruptMaskFromISR(void)
|
||||
{
|
||||
UBaseType_t prev_int_level = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL);
|
||||
@ -565,6 +568,9 @@ static inline UBaseType_t __attribute__((always_inline)) xPortSetInterruptMaskFr
|
||||
return prev_int_level;
|
||||
}
|
||||
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
IRAM_ATTR __attribute__((no_instrument_function))
|
||||
#endif
|
||||
static inline void __attribute__((always_inline)) vPortClearInterruptMaskFromISR(UBaseType_t prev_level)
|
||||
{
|
||||
portbenchmarkINTERRUPT_RESTORE(prev_level);
|
||||
@ -629,6 +635,9 @@ static inline bool IRAM_ATTR xPortCanYield(void)
|
||||
|
||||
// ----------------------- System --------------------------
|
||||
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
__attribute__((no_instrument_function))
|
||||
#endif
|
||||
static inline BaseType_t IRAM_ATTR xPortGetCoreID(void)
|
||||
{
|
||||
return (uint32_t) cpu_hal_get_core_id();
|
||||
|
@ -270,6 +270,7 @@
|
||||
#define taskEVENT_LIST_ITEM_VALUE_IN_USE 0x80000000UL
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Task control block. A task control block (TCB) is allocated for each task,
|
||||
* and stores task state information, including a pointer to the task's context
|
||||
@ -356,6 +357,11 @@ typedef struct tskTaskControlBlock /* The old naming convention is used to
|
||||
#if ( configUSE_POSIX_ERRNO == 1 )
|
||||
int iTaskErrno;
|
||||
#endif
|
||||
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
esp_stack_mirror_t stackMirror;
|
||||
#endif
|
||||
|
||||
} tskTCB;
|
||||
|
||||
/* The old tskTCB name is maintained above then typedefed to the new TCB_t name
|
||||
@ -996,6 +1002,11 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
||||
}
|
||||
#endif /* portSTACK_GROWTH */
|
||||
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
pxNewTCB->stackMirror.panicing = false;
|
||||
pxNewTCB->stackMirror.depth = 0;
|
||||
#endif
|
||||
|
||||
/* Store the task name in the TCB. */
|
||||
if( pcName != NULL )
|
||||
{
|
||||
@ -4209,6 +4220,16 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
IRAM_ATTR __attribute__((no_instrument_function))
|
||||
esp_stack_mirror_t * pvTaskGetStackMirrorPointer()
|
||||
{
|
||||
TCB_t *pxTCB = xTaskGetCurrentTaskHandle();
|
||||
return &pxTCB->stackMirror;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 )
|
||||
|
||||
#if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS )
|
||||
@ -4758,6 +4779,9 @@ static void prvResetNextTaskUnblockTime( void )
|
||||
|
||||
#if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) || (configNUM_CORES > 1) )
|
||||
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
IRAM_ATTR __attribute__((no_instrument_function))
|
||||
#endif
|
||||
TaskHandle_t xTaskGetCurrentTaskHandle( void )
|
||||
{
|
||||
TaskHandle_t xReturn;
|
||||
|
@ -29,6 +29,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
IRAM_ATTR __attribute__((no_instrument_function))
|
||||
#endif
|
||||
static inline uint32_t IRAM_ATTR cpu_ll_get_core_id(void)
|
||||
{
|
||||
uint32_t id;
|
||||
|
@ -28,6 +28,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if CONFIG_COMPILER_STACK_MIRROR
|
||||
__attribute__((no_instrument_function))
|
||||
#endif
|
||||
static inline uint32_t IRAM_ATTR cpu_ll_get_core_id(void)
|
||||
{
|
||||
uint32_t id;
|
||||
|
@ -331,7 +331,8 @@ esp_err_t esp_vfs_unregister_with_id(esp_vfs_id_t vfs_id);
|
||||
|
||||
/**
|
||||
* Special function for registering another file descriptor for a VFS registered
|
||||
* by esp_vfs_register_with_id.
|
||||
* by esp_vfs_register_with_id. This function should only be used to register
|
||||
* permanent file descriptors (socket fd) that are not removed after being closed.
|
||||
*
|
||||
* @param vfs_id VFS identificator returned by esp_vfs_register_with_id.
|
||||
* @param fd The registered file descriptor will be written to this address.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -104,7 +104,11 @@ int console_fcntl(int fd, int cmd, int arg)
|
||||
|
||||
int console_fsync(int fd)
|
||||
{
|
||||
return get_vfs_for_index(primary_vfs_index)->vfs.fsync(vfs_console.fd_primary);
|
||||
const int ret_val = get_vfs_for_index(primary_vfs_index)->vfs.fsync(vfs_console.fd_primary);
|
||||
#if CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG
|
||||
(void)get_vfs_for_index(secondary_vfs_index)->vfs.fsync(vfs_console.fd_secondary);
|
||||
#endif
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_VFS_SUPPORT_DIR
|
||||
|
@ -224,13 +224,13 @@ static void wpa_sta_disconnected_cb(uint8_t reason_code)
|
||||
case WIFI_REASON_ASSOC_FAIL:
|
||||
case WIFI_REASON_CONNECTION_FAIL:
|
||||
case WIFI_REASON_HANDSHAKE_TIMEOUT:
|
||||
esp_wpa3_free_sae_data();
|
||||
wpa_sta_clear_curr_pmksa();
|
||||
wpa_sm_notify_disassoc(&gWpaSm);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
esp_wpa3_free_sae_data();
|
||||
supplicant_sta_disconn_handler();
|
||||
}
|
||||
|
||||
|
BIN
docs/_static/esp32-c3-devkitc-02-v1-pinout.png
vendored
Before Width: | Height: | Size: 318 KiB After Width: | Height: | Size: 273 KiB |
Before Width: | Height: | Size: 311 KiB |
BIN
docs/_static/esp32-s2-devkitm-1-v1-block-diagram.png
vendored
Before Width: | Height: | Size: 72 KiB |
BIN
docs/_static/esp32-s2-devkitm-1-v1-isometric.png
vendored
Before Width: | Height: | Size: 208 KiB |
BIN
docs/_static/esp32-s2-devkitm-1-v1-pin-layout.png
vendored
Before Width: | Height: | Size: 385 KiB |
Before Width: | Height: | Size: 295 KiB |
BIN
docs/_static/esp32-s2-devkitm-1u-v1-isometric.png
vendored
Before Width: | Height: | Size: 161 KiB |
@ -118,7 +118,7 @@ If you have one of {IDF_TARGET_NAME} development boards listed below, you can cl
|
||||
:maxdepth: 1
|
||||
|
||||
ESP32-S2-Saola-1 <../hw-reference/esp32s2/user-guide-saola-1-v1.2>
|
||||
ESP32-S2-DevKitM-1(U) <../hw-reference/esp32s2/user-guide-devkitm-1-v1>
|
||||
ESP32-S2-DevKitM-1 <https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s2/esp32-s2-devkitm-1/index.html>
|
||||
ESP32-S2-DevKitC-1 <../hw-reference/esp32s2/user-guide-s2-devkitc-1>
|
||||
ESP32-S2-Kaluga-Kit <../hw-reference/esp32s2/user-guide-esp32-s2-kaluga-1-kit>
|
||||
|
||||
|
@ -68,7 +68,6 @@ The key components of the board are described in a counter-clockwise direction.
|
||||
* - RGB LED
|
||||
- Addressable RGB LED, driven by GPIO8.
|
||||
|
||||
|
||||
Start Application Development
|
||||
-----------------------------
|
||||
|
||||
@ -100,7 +99,6 @@ If you order a few samples, each ESP32-C3-DevKitC-02 comes in an individual pack
|
||||
|
||||
For retail orders, please go to https://www.espressif.com/en/company/contact/buy-a-sample.
|
||||
|
||||
|
||||
Wholesale Orders
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
@ -180,8 +178,8 @@ No. Name Type [1]_ Function
|
||||
9 RX I/O/T GPIO20, U0RXD
|
||||
10 TX I/O/T GPIO21, U0TXD
|
||||
11 G G Ground
|
||||
12 18 I/O/T GPIO18
|
||||
13 19 I/O/T GPIO19
|
||||
12 18 I/O/T GPIO18, USB_D-
|
||||
13 19 I/O/T GPIO19, USB_D+
|
||||
14 G G Ground
|
||||
15 G G Ground
|
||||
=== ==== ========== ====================================
|
||||
@ -193,7 +191,7 @@ Pin Layout
|
||||
^^^^^^^^^^^
|
||||
.. figure:: ../../../_static/esp32-c3-devkitc-02-v1-pinout.png
|
||||
:align: center
|
||||
:scale: 100%
|
||||
:scale: 45%
|
||||
:alt: ESP32-C3-DevKitC-02 (click to enlarge)
|
||||
:figclass: align-center
|
||||
|
||||
@ -216,7 +214,6 @@ Related Documents
|
||||
|
||||
For further design documentation for the board, please contact us at `sales@espressif.com <sales@espressif.com>`_.
|
||||
|
||||
|
||||
.. _ESP32-C3 Datasheet: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf
|
||||
.. _ESP32-C3-WROOM-02 Datasheet: https://www.espressif.com/sites/default/files/documentation/esp32-c3-wroom-02_datasheet_en.pdf
|
||||
.. _ESP32-C3-DevKitC-02 Schematic: https://dl.espressif.com/dl/schematics/SCH_ESP32-C3-DEVKITC-02_V1_1_20210126A.pdf
|
||||
|
@ -1,250 +0,0 @@
|
||||
=====================
|
||||
ESP32-S2-DevKitM-1(U)
|
||||
=====================
|
||||
|
||||
:link_to_translation:`zh_CN:[中文]`
|
||||
|
||||
This user guide provides information on Espressif's small-sized development board ESP32-S2-DevKitM-1(U).
|
||||
|
||||
ESP32-S2-DevKitM-1(U) is a general-purpose development board based on `ESP32-S2FH4 <https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf>`__ chip, which falls into ESP32-S2 chip series. With a rich peripheral set and optimized pinout, this board allows rapid prototyping.
|
||||
|
||||
ESP32-S2-DevKitM-1 is embedded with `ESP32-S2-MINI-1 <https://www.espressif.com/sites/default/files/documentation/esp32-s2-mini-1_esp32-s2-mini-1u_datasheet_en.pdf>`__ module (on-board PCB antenna), while ESP32-S2-DevKitM-1U with `ESP32-S2-MINI-1U <https://www.espressif.com/sites/default/files/documentation/esp32-s2-mini-1_esp32-s2-mini-1u_datasheet_en.pdf>`__ module (external antenna connector).
|
||||
|
||||
+----------------------+-----------------------+
|
||||
| |ESP32-S2-DevKitM-1| | |ESP32-S2-DevKitM-1U| |
|
||||
+----------------------+-----------------------+
|
||||
| ESP32-S2-DevKitM-1 | ESP32-S2-DevKitM-1U |
|
||||
+----------------------+-----------------------+
|
||||
|
||||
.. |ESP32-S2-DevKitM-1| image:: ../../../_static/esp32-s2-devkitm-1-v1-isometric.png
|
||||
|
||||
.. |ESP32-S2-DevKitM-1U| image:: ../../../_static/esp32-s2-devkitm-1u-v1-isometric.png
|
||||
|
||||
The document consists of the following major sections:
|
||||
|
||||
- `Getting started`_: Provides an overview of the ESP32-S2-DevKitM-1(U) and hardware/software setup instructions to get started.
|
||||
- `Hardware reference`_: Provides more detailed information about the ESP32-S2-DevKitM-1(U)'s hardware.
|
||||
- `Hardware Revision Details`_: Revision history, known issues, and links to user guides for previous versions (if any) of ESP32-S2-DevKitM-1(U).
|
||||
- `Related Documents`_: Gives links to related documentation.
|
||||
|
||||
Getting Started
|
||||
===============
|
||||
|
||||
This section describes how to get started with ESP32-S2-DevKitM-1(U). It begins with a few introductory sections about the ESP32-S2-DevKitM-1(U), then Section `Start Application Development`_ provides instructions on how to get the ESP32-S2-DevKitM-1(U) ready and flash firmware into it.
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
ESP32-S2-DevKitM-1(U) is entry-level development board equipped with either ESP32-S2-MINI-1 or ESP32-S2-MINI-1U module. Most of the I/O pins on the module are broken out to the pin headers on both sides for easy interfacing. Developers can either connect peripherals with jumper wires or mount ESP32-S2-DevKitM-1(U) on a breadboard.
|
||||
|
||||
Contents and Packaging
|
||||
----------------------
|
||||
|
||||
Retail orders
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
If you order a few samples, each ESP32-S2-DevKitM-1(U) comes in an individual package in either antistatic bag or any packaging depending on your retailer.
|
||||
|
||||
For retail orders, please go to https://www.espressif.com/en/company/contact/buy-a-sample.
|
||||
|
||||
|
||||
Wholesale Orders
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
If you order in bulk, the boards come in large cardboard boxes.
|
||||
|
||||
For wholesale orders, please go to https://www.espressif.com/en/contact-us/sales-questions.
|
||||
|
||||
Description of Components
|
||||
-------------------------
|
||||
|
||||
.. _user-guide-devkitm-1-v1-board-front:
|
||||
|
||||
.. figure:: ../../../_static/esp32-s2-devkitm-1-v1-annotated-photo.png
|
||||
:align: center
|
||||
:alt: ESP32-S2-DevKitM-1 - front
|
||||
:figclass: align-center
|
||||
|
||||
ESP32-S2-DevKitM-1 - front
|
||||
|
||||
.. figure:: ../../../_static/esp32-s2-devkitm-1u-v1-annotated-photo.png
|
||||
:align: center
|
||||
:alt: ESP32-S2-DevKitM-1U - front
|
||||
:figclass: align-center
|
||||
|
||||
ESP32-S2-DevKitM-1U - front
|
||||
|
||||
The key components of the board are described in a clockwise direction.
|
||||
|
||||
.. list-table::
|
||||
:widths: 30 70
|
||||
:header-rows: 1
|
||||
|
||||
* - Key Component
|
||||
- Description
|
||||
* - ESP32-S2-MINI-1 or ESP32-S2-MINI-1U
|
||||
- ESP32-S2-MINI-1 and ESP32-S2-MINI-1U are two powerful, generic Wi-Fi MCU modules that integrate ESP32-S2FH4 chip. ESP32-S2-MINI-1 comes with a PCB antenna, and ESP32-S2-MINI-1U with an external antenna connector. They both feature a 4 MB external SPI flash.
|
||||
* - Pin Headers
|
||||
- All available GPIO pins (except for the SPI bus for flash) are broken out to the pin headers on the board. Users can program ESP32-S2FH4 chip to enable multiple functions such as SPI, I2S, UART, I2C, touch sensors, PWM etc. For details, please see :ref:`user-guide-devkitm-1-v1-header-blocks`.
|
||||
* - 3.3 V Power On LED
|
||||
- Turns on when the USB power is connected to the board.
|
||||
* - USB to UART Bridge
|
||||
- Single USB-UART bridge chip provides transfer rates up to 3 Mbps.
|
||||
* - Reset Button
|
||||
- Reset button.
|
||||
* - Micro-USB Port
|
||||
- USB interface. Power supply for the board as well as the communication interface between a computer and the ESP32-S2FH4 chip.
|
||||
* - Boot Button
|
||||
- Download button. Holding down **Boot** and then pressing **Reset** initiates Firmware Download mode for downloading firmware through the serial port.
|
||||
* - RGB LED
|
||||
- Addressable RGB LED, driven by GPIO18.
|
||||
* - 5 V to 3.3 V LDO
|
||||
- Power regulator that converts a 5 V supply into a 3.3 V output.
|
||||
* - External Antenna Connector
|
||||
- On **ESP32-S2-MINI-1U** module only. For connector dimensions, please refer to Section External Antenna Connector Dimensions in `ESP32-S2-MINI-1 & ESP32-S2-MINI-1U Datasheet <https://www.espressif.com/sites/default/files/documentation/esp32-s2-mini-1_esp32-s2-mini-1u_datasheet_en.pdf>`_.
|
||||
|
||||
Start Application Development
|
||||
-----------------------------
|
||||
|
||||
Before powering up your ESP32-S2-DevKitM-1(U), please make sure that it is in good condition with no obvious signs of damage.
|
||||
|
||||
Required Hardware
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
- ESP32-S2-DevKitM-1(U)
|
||||
|
||||
+ For ESP32-S2-DevKitM-1U, an antenna is also required.
|
||||
|
||||
- USB 2.0 cable (Standard-A to Micro-B)
|
||||
- Computer running Windows, Linux, or macOS
|
||||
|
||||
.. note::
|
||||
|
||||
Be sure to use an appropriate USB cable. Some cables are for charging only and do not provide the needed data lines nor work for programming the boards.
|
||||
|
||||
Software Setup
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
Please proceed to :doc:`../../get-started/index`, where Section :ref:`get-started-step-by-step` will quickly help you set up the development environment and then flash an application example into your ESP32-S2-DevKitM-1(U).
|
||||
|
||||
.. note::
|
||||
|
||||
ESP32-S2 series of chips only is only supported in ESP-IDF master or version v4.2 and higher.
|
||||
|
||||
Hardware Reference
|
||||
==================
|
||||
|
||||
Block Diagram
|
||||
-------------
|
||||
|
||||
A block diagram below shows the components of ESP32-S2-DevKitM-1 and their interconnections.
|
||||
|
||||
.. figure:: ../../../_static/esp32-s2-devkitm-1-v1-block-diagram.png
|
||||
:align: center
|
||||
:scale: 70%
|
||||
:alt: ESP32-S2-DevKitM-1(U) (click to enlarge)
|
||||
:figclass: align-center
|
||||
|
||||
ESP32-S2-DevKitM-1(U) (click to enlarge)
|
||||
|
||||
Power Supply Options
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
There are three mutually exclusive ways to provide power to the board:
|
||||
|
||||
- Micro-USB Port, default power supply
|
||||
- 5V and GND pin headers
|
||||
- 3V3 and GND pin headers
|
||||
|
||||
It is recommended to use the first option: Micro-USB Port.
|
||||
|
||||
.. _user-guide-devkitm-1-v1-header-blocks:
|
||||
|
||||
Header Block
|
||||
------------
|
||||
|
||||
The two tables below provide the **Name** and **Function** of the pin headers on both sides of the board (J1 and J3). The pin header names are shown in :ref:`user-guide-devkitm-1-v1-board-front`. The numbering is the same as in the `ESP32-S2-DevKitM-1(U) Schematics <https://dl.espressif.com/dl/schematics/ESP32-S2-DevKitM-1_V1_Schematics.pdf>`_ (PDF).
|
||||
|
||||
J1
|
||||
^^^
|
||||
=== ==== ========== =============================================================
|
||||
No. Name Type [#]_ Function
|
||||
=== ==== ========== =============================================================
|
||||
1 3V3 P 3.3 V power supply
|
||||
2 0 I/O/T RTC_GPIO0, GPIO0
|
||||
3 1 I/O/T RTC_GPIO1, GPIO1, TOUCH1, ADC1_CH0
|
||||
4 2 I/O/T RTC_GPIO2, GPIO2, TOUCH2, ADC1_CH1
|
||||
5 3 I/O/T RTC_GPIO3, GPIO3, TOUCH3, ADC1_CH2
|
||||
6 4 I/O/T RTC_GPIO4, GPIO4, TOUCH4, ADC1_CH3
|
||||
7 5 I/O/T RTC_GPIO5, GPIO5, TOUCH5, ADC1_CH4
|
||||
8 6 I/O/T RTC_GPIO6, GPIO6, TOUCH6, ADC1_CH5
|
||||
9 7 I/O/T RTC_GPIO7, GPIO7, TOUCH7, ADC1_CH6
|
||||
10 8 I/O/T RTC_GPIO8, GPIO8, TOUCH8, ADC1_CH7
|
||||
11 9 I/O/T RTC_GPIO9, GPIO9, TOUCH9, ADC1_CH8, FSPIHD
|
||||
12 10 I/O/T RTC_GPIO10, GPIO10, TOUCH10, ADC1_CH9, FSPICS0, FSPIIO4
|
||||
13 11 I/O/T RTC_GPIO11, GPIO11, TOUCH11, ADC2_CH0, FSPID, FSPIIO5
|
||||
14 12 I/O/T RTC_GPIO12, GPIO12, TOUCH12, ADC2_CH1, FSPICLK, FSPIIO6
|
||||
15 13 I/O/T RTC_GPIO13, GPIO13, TOUCH13, ADC2_CH2, FSPIQ, FSPIIO7
|
||||
16 14 I/O/T RTC_GPIO14, GPIO14, TOUCH14, ADC2_CH3, FSPIWP, FSPIDQS
|
||||
17 15 I/O/T RTC_GPIO15, GPIO15, U0RTS, ADC2_CH4, XTAL_32K_P
|
||||
18 16 I/O/T RTC_GPIO16, GPIO16, U0CTS, ADC2_CH5, XTAL_32K_N
|
||||
19 17 I/O/T RTC_GPIO17, GPIO17, U1TXD, ADC2_CH6, DAC_1
|
||||
20 5V P 5 V power supply
|
||||
21 G G Ground
|
||||
=== ==== ========== =============================================================
|
||||
|
||||
J3
|
||||
^^^
|
||||
=== ==== ===== ========================================================
|
||||
No. Name Type Function
|
||||
=== ==== ===== ========================================================
|
||||
1 G G Ground
|
||||
2 RST I CHIP_PU
|
||||
3 46 I GPIO46
|
||||
4 45 I/O/T GPIO45
|
||||
5 RX I/O/T U0RXD, GPIO44, CLK_OUT2
|
||||
6 TX I/O/T U0TXD, GPIO43, CLK_OUT1
|
||||
7 42 I/O/T MTMS, GPIO42
|
||||
8 41 I/O/T MTDI, GPIO41, CLK_OUT1
|
||||
9 40 I/O/T MTDO, GPIO40, CLK_OUT2
|
||||
10 39 I/O/T MTCK, GPIO39, CLK_OUT3
|
||||
11 38 I/O/T GPIO38, FSPIWP
|
||||
12 37 I/O/T SPIDQS, GPIO37, FSPIQ
|
||||
13 36 I/O/T SPIIO7, GPIO36, FSPICLK
|
||||
14 35 I/O/T SPIIO6, GPIO35, FSPID
|
||||
15 34 I/O/T SPIIO5, GPIO34, FSPICS0
|
||||
16 33 I/O/T SPIIO4, GPIO33, FSPIHD
|
||||
17 26 I/O/T SPICS1, GPIO26
|
||||
18 21 I/O/T RTC_GPIO21, GPIO21
|
||||
19 20 I/O/T RTC_GPIO20, GPIO20, U1CTS, ADC2_CH9, CLK_OUT1, USB_D+
|
||||
20 19 I/O/T RTC_GPIO19, GPIO19, U1RTS, ADC2_CH8, CLK_OUT2, USB_D-
|
||||
21 18 I/O/T RTC_GPIO18, GPIO18, U1RXD, ADC2_CH7, DAC_2, CLK_OUT3, RGB LED
|
||||
=== ==== ===== ========================================================
|
||||
|
||||
.. [#] P: Power supply; I: Input; O: Output; T: High impedance.
|
||||
|
||||
Pin Layout
|
||||
^^^^^^^^^^^
|
||||
.. figure:: ../../../_static/esp32-s2-devkitm-1-v1-pin-layout.png
|
||||
:align: center
|
||||
:scale: 15%
|
||||
:alt: ESP32-S2-DevKitM-1(U) (click to enlarge)
|
||||
:figclass: align-center
|
||||
|
||||
ESP32-S2-DevKitM-1(U) Pin Layout (click to enlarge)
|
||||
|
||||
Hardware Revision Details
|
||||
=========================
|
||||
|
||||
This is the first revision of this board released.
|
||||
|
||||
Related Documents
|
||||
=================
|
||||
* `ESP32-S2-DevKitM-1(U) Schematics <https://dl.espressif.com/dl/schematics/ESP32-S2-DevKitM-1_V1_Schematics.pdf>`_ (PDF)
|
||||
* `ESP32-S2-DevKitM-1(U) PCB Layout <https://dl.espressif.com/dl/schematics/ESP32-S2-DevKitM-1_V1_PCB_Layout.pdf>`_ (PDF)
|
||||
* `ESP32-S2-DevKitM-1(U) Dimensions <https://dl.espressif.com/dl/schematics/ESP32-S2-DevKitM-1_V1_Dimensions.pdf>`_ (PDF)
|
||||
* `ESP32-S2 Series Datasheet <https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf>`_ (PDF)
|
||||
* `ESP32-S2-MINI-1 & ESP32-S2-MINI-1U Datasheet <https://www.espressif.com/sites/default/files/documentation/esp32-s2-mini-1_esp32-s2-mini-1u_datasheet_en.pdf>`_ (PDF)
|
||||
* `ESP Product Selector <https://products.espressif.com/#/product-selector?names=>`_
|
||||
|
||||
For other design documentation for the board, please contact us at `sales@espressif.com <sales@espressif.com>`_.
|
@ -1538,7 +1538,7 @@ Wi-Fi 安全性
|
||||
- 从关联请求获取隐藏网络的 SSID。
|
||||
- 强制 client 从合法 AP 中 (de)authentication,并关联到流氓 AP,发起中间人攻击。
|
||||
|
||||
PMF 通过对单播管理帧进行加密,并检查广播管理帧的完整性,阻止上述攻击。其中包括 (de)authentication、(dis)association 和强奸的管理帧。PMF 同样提供“安全关联” (SA) 拆解机制,阻止欺骗 association/authentication frame 断开已连接的 client。
|
||||
PMF 通过对单播管理帧进行加密,并检查广播管理帧的完整性,阻止上述攻击。其中包括 (de)authentication、(dis)association 和强健的管理帧。PMF 同样提供“安全关联” (SA) 拆解机制,阻止欺骗 association/authentication frame 断开已连接的 client。
|
||||
|
||||
关于PMF,{IDF_TARGET_NAME} 支持以下三种操作模式。
|
||||
|
||||
|
@ -118,7 +118,7 @@
|
||||
:maxdepth: 1
|
||||
|
||||
ESP32-S2-Saola-1 <../hw-reference/esp32s2/user-guide-saola-1-v1.2>
|
||||
ESP32-S2-DevKitM-1(U) <../hw-reference/esp32s2/user-guide-devkitm-1-v1>
|
||||
ESP32-S2-DevKitM-1 <https://docs.espressif.com/projects/esp-dev-kits/zh_CN/latest/esp32s2/esp32-s2-devkitm-1/index.html>
|
||||
ESP32-S2-DevKitC-1 <../hw-reference/esp32s2/user-guide-s2-devkitc-1>
|
||||
ESP32-S2-Kaluga-Kit <../hw-reference/esp32s2/user-guide-esp32-s2-kaluga-1-kit>
|
||||
|
||||
|
@ -178,22 +178,20 @@ J3
|
||||
9 RX I/O/T GPIO20, U0RXD
|
||||
10 TX I/O/T GPIO21, U0TXD
|
||||
11 G G 接地
|
||||
12 18 I/O/T GPIO18
|
||||
13 19 I/O/T GPIO19
|
||||
12 18 I/O/T GPIO18, USB_D-
|
||||
13 19 I/O/T GPIO19, USB_D+
|
||||
14 G G 接地
|
||||
15 G G 接地
|
||||
==== ==== ========== ================================
|
||||
|
||||
|
||||
.. [1] P:电源;I:输入;O:输出;T:可设置为高阻。
|
||||
.. [2] GPIO2、GPIO8、GPIO9 为 ESP32-C3 芯片的 Strapping 管脚。在芯片上电和系统复位过程中,Strapping 管脚根据管脚的二进制电压值控制芯片功能。Strapping 管脚的具体描述和应用,请参考 `ESP32-C3 技术规格书`_ 的 Strapping 管脚章节。
|
||||
|
||||
|
||||
管脚布局
|
||||
^^^^^^^^
|
||||
.. figure:: ../../../_static/esp32-c3-devkitc-02-v1-pinout.png
|
||||
:align: center
|
||||
:scale: 100%
|
||||
:scale: 50%
|
||||
:alt: ESP32-C3-DevKitC-02 管脚布局(点击放大)
|
||||
:figclass: align-center
|
||||
|
||||
@ -219,4 +217,3 @@ J3
|
||||
.. _ESP32-C3 技术规格书: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_cn.pdf
|
||||
.. _ESP32-C3-WROOM-02 规格书: https://www.espressif.com/sites/default/files/documentation/esp32-c3-wroom-02_datasheet_cn.pdf
|
||||
.. _ESP32-C3-DevKitC-02 原理图: https://dl.espressif.com/dl/schematics/SCH_ESP32-C3-DEVKITC-02_V1_1_20210126A.pdf
|
||||
|
||||
|
@ -180,8 +180,8 @@ J3
|
||||
10 IO5 I/O/T GPIO5, ADC2_CH0, FSPIWP, MTDI
|
||||
11 IO4 I/O/T GPIO4, ADC1_CH4, FSPIHD, MTMS
|
||||
12 GND G 接地
|
||||
13 IO18 I/O/T GPIO18
|
||||
14 IO19 I/O/T GPIO19
|
||||
13 IO18 I/O/T GPIO18, USB_D-
|
||||
14 IO19 I/O/T GPIO19, USB_D+
|
||||
15 GND G 接地
|
||||
==== ==== ========== ================================
|
||||
|
||||
|
@ -1,250 +0,0 @@
|
||||
=====================
|
||||
ESP32-S2-DevKitM-1(U)
|
||||
=====================
|
||||
|
||||
:link_to_translation:`en: [English]`
|
||||
|
||||
本指南介绍了乐鑫的小型开发板 ESP32-S2-DevKitM-1(U)。
|
||||
|
||||
ESP32-S2-DevKitM-1(U) 是一款基于 `ESP32-S2FH4 <https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_cn.pdf>`__ 芯片(ESP32-S2 系列)的通用型开发板。该款开发板具有丰富的外设和优化的引脚布局,令产品开发更快捷。
|
||||
|
||||
ESP32-S2-DevKitM-1 搭载的是 `ESP32-S2-MINI-1 <https://www.espressif.com/sites/default/files/documentation/esp32-s2-mini-1_esp32-s2-mini-1u_datasheet_cn.pdf>`__ 模组 (PCB 板载天线),ESP32-S2-DevKitM-1U 搭载的是 `ESP32-S2-MINI-1U <https://www.espressif.com/sites/default/files/documentation/esp32-s2-mini-1_esp32-s2-mini-1u_datasheet_cn.pdf>`__ 模组 (外部天线连接器)。
|
||||
|
||||
+----------------------+-----------------------+
|
||||
| |ESP32-S2-DevKitM-1| | |ESP32-S2-DevKitM-1U| |
|
||||
+----------------------+-----------------------+
|
||||
| ESP32-S2-DevKitM-1 | ESP32-S2-DevKitM-1U |
|
||||
+----------------------+-----------------------+
|
||||
|
||||
.. |ESP32-S2-DevKitM-1| image:: ../../../_static/esp32-s2-devkitm-1-v1-isometric.png
|
||||
|
||||
.. |ESP32-S2-DevKitM-1U| image:: ../../../_static/esp32-s2-devkitm-1u-v1-isometric.png
|
||||
|
||||
本指南包括如下内容:
|
||||
|
||||
- `入门指南`_: 简要介绍了 ESP32-S2-DevKitM-1(U) 和硬件、软件设置指南。
|
||||
- `硬件参考`_: 详细介绍了 ESP32-S2-DevKitM-1(U) 的硬件。
|
||||
- `硬件版本`_:介绍硬件历史版本和已知问题,并提供链接至历史版本开发板的入门指南(如有)。
|
||||
- `相关文档`_: 列出了相关文档的链接。
|
||||
|
||||
入门指南
|
||||
========
|
||||
|
||||
本节介绍了如何快速上手 ESP32-S2-DevKitM-1(U)。开头部分介绍了 ESP32-S2-DevKitM-1(U),`开始开发应用`_ 小节介绍了怎样在 ESP32-S2-DevKitM-1(U) 上烧录固件及相关准备工作。
|
||||
|
||||
概述
|
||||
----
|
||||
|
||||
ESP32-S2-DevKitM-1(U) 是乐鑫一款搭载 ESP32-S2-MINI-1 或 ESP32-S2-MINI-1U 模组的入门级开发板。板上模组大部分管脚均已引出至两侧排针,开发人员可根据实际需求,轻松通过跳线连接多种外围设备,同时也可将开发板插在面包板上使用。
|
||||
|
||||
|
||||
内含组件和包装
|
||||
--------------
|
||||
|
||||
零售订单
|
||||
^^^^^^^^
|
||||
|
||||
如购买样品,每个 ESP32-S2-DevKitM-1(U) 开发板将以防静电袋或零售商选择的其他方式包装。
|
||||
|
||||
零售订单请前往 https://www.espressif.com/zh-hans/company/contact/buy-a-sample。
|
||||
|
||||
批量订单
|
||||
^^^^^^^^
|
||||
|
||||
如批量购买,ESP32-S2-DevKitM-1(U) 开发板将以大纸板箱包装。
|
||||
|
||||
批量订单请前往 https://www.espressif.com/zh-hans/contact-us/sales-questions。
|
||||
|
||||
组件介绍
|
||||
--------
|
||||
|
||||
.. _user-guide-devkitm-1-v1-board-front:
|
||||
|
||||
.. figure:: ../../../_static/esp32-s2-devkitm-1-v1-annotated-photo.png
|
||||
:align: center
|
||||
:alt: ESP32-S2-DevKitM-1 - 正面
|
||||
:figclass: align-center
|
||||
|
||||
ESP32-S2-DevKitM-1 - 正面
|
||||
|
||||
.. figure:: ../../../_static/esp32-s2-devkitm-1u-v1-annotated-photo.png
|
||||
:align: center
|
||||
:alt: ESP32-S2-DevKitM-1U - 正面
|
||||
:figclass: align-center
|
||||
|
||||
ESP32-S2-DevKitM-1U - 正面
|
||||
|
||||
以下按照顺时针的顺序依次介绍开发板上的主要组件。
|
||||
|
||||
.. list-table::
|
||||
:widths: 30 70
|
||||
:header-rows: 1
|
||||
|
||||
* - 主要组件
|
||||
- 介绍
|
||||
* - ESP32-S2-MINI-1 或 ESP32-S2-MINI-1U
|
||||
- ESP32-S2-MINI-1 和 ESP32-S2-MINI-1U 是集成 ESP32-S2FH4 的通用型 Wi-Fi MCU 模组,ESP32-S2-MINI-1 采用 PCB 板载天线,ESP32-S2-MINI-1U 采用外部天线连接器。两款模组均配置了 4 MB SPI flash。
|
||||
* - Pin Headers(排针)
|
||||
- 所有可用 GPIO 管脚(除 flash 的 SPI 总线)均已引出至开发板的排针。用户可对 ESP32-S2FH4 芯片编程,使能 SPI、I2S、UART、I2C、触摸传感器、PWM 等多种功能。请查看 :ref:`user-guide-devkitm-1-v1-header-blocks` 获取更多信息。
|
||||
* - 3.3 V Power On LED(3.3 V 电源指示灯)
|
||||
- 开发板连接 USB 电源后,该指示灯亮起。
|
||||
* - USB-to-UART Bridge(USB 转 UART 桥接器)
|
||||
- 单芯片 USB 至 UART 桥接器,可提供高达 3 Mbps 的传输速率。
|
||||
* - Reset Button(Reset 键)
|
||||
- 复位按键。
|
||||
* - Micro-USB(Micro-USB 接口)
|
||||
- USB 接口。可用作开发板的供电电源或 PC 和 ESP32-S2FH4 芯片的通信接口。
|
||||
* - Boot Button(Boot 键)
|
||||
- 下载按键。按住 **Boot** 键的同时按一下 **Reset** 键进入“固件下载”模式,通过串口下载固件。
|
||||
* - RGB LED
|
||||
- 可寻址 RGB 发光二极管,由 GPIO18 驱动。
|
||||
* - 5 V to 3.3 V LDO(5 V 转 3.3 V LDO)
|
||||
- 电源转换器,输入 5 V,输出 3.3 V。
|
||||
* - External Antenna Connector(外部天线连接器)
|
||||
- 仅 **ESP32-S2-MINI-1U** 模组带有外部天线连接器。连接器尺寸,请参考 `《ESP32-S2-MINI-1 & ESP32-S2-MINI-1U 技术规格书》 <https://www.espressif.com/sites/default/files/documentation/esp32-s2-mini-1_esp32-s2-mini-1u_datasheet_cn.pdf>`_ 的外部天线连接器尺寸章节。
|
||||
|
||||
开始开发应用
|
||||
------------
|
||||
|
||||
通电前,请确保 ESP32-S2-DevKitM-1(U) 完好无损。
|
||||
|
||||
必备硬件
|
||||
^^^^^^^^
|
||||
|
||||
- ESP32-S2-DevKitM-1(U)
|
||||
|
||||
+ 如使用 ESP32-S2-DevKitM-1U,还需准备天线
|
||||
|
||||
- USB 2.0 数据线(标准 A 型转 Micro-B 型)
|
||||
- 电脑 (Windows、Linux 或 macOS)
|
||||
|
||||
.. 注解::
|
||||
|
||||
请确保使用适当的 USB 数据线。部分数据线仅可用于充电,无法用于数据传输和编程。
|
||||
|
||||
软件设置
|
||||
^^^^^^^^
|
||||
|
||||
请前往 :doc:`../../get-started/index`,在 :ref:`get-started-step-by-step` 一节查看如何快速设置开发环境,将应用程序烧录至 ESP32-S2-DevKitM-1(U)。
|
||||
|
||||
.. 注解::
|
||||
|
||||
ESP32-S2 系列芯片仅支持 ESP-IDF master 分支或 v4.2 以上版本。
|
||||
|
||||
硬件参考
|
||||
========
|
||||
|
||||
功能框图
|
||||
--------
|
||||
|
||||
ESP32-S2-DevKitM-1(U) 的主要组件和连接方式如下图所示。
|
||||
|
||||
.. figure:: ../../../_static/esp32-s2-devkitm-1-v1-block-diagram.png
|
||||
:align: center
|
||||
:scale: 70%
|
||||
:alt: ESP32-S2-DevKitM-1(U) (点击放大)
|
||||
:figclass: align-center
|
||||
|
||||
ESP32-S2-DevKitM-1(U) (点击放大)
|
||||
|
||||
电源选项
|
||||
^^^^^^^^
|
||||
|
||||
您可从以下三种供电方式中任选其一给 ESP32-S2-DevKitM-1(U) 供电:
|
||||
|
||||
- Micro-USB 接口供电(默认)
|
||||
- 5V 和 GND 排针供电
|
||||
- 3V3 和 GND 排针供电
|
||||
|
||||
建议选择第一种供电方式:Micro-USB 接口供电。
|
||||
|
||||
.. _user-guide-devkitm-1-v1-header-blocks:
|
||||
|
||||
排针
|
||||
----
|
||||
|
||||
下表列出了开发板两侧排针(J1 和 J3)的 **名称** 和 **功能**,排针的名称如图 :ref:`user-guide-devkitm-1-v1-board-front` 所示,排针的序号与 `ESP32-S2-DevKitM-1(U) 原理图 <https://dl.espressif.com/dl/schematics/ESP32-S2-DevKitM-1_V1_Schematics.pdf>`_ (PDF)一致。
|
||||
|
||||
J1
|
||||
^^^
|
||||
==== ==== ========= =========================================================================
|
||||
序号 名称 类型 [#]_ 功能
|
||||
==== ==== ========= =========================================================================
|
||||
1 3V3 P 3.3 V 电源
|
||||
2 0 I/O/T RTC_GPIO0, GPIO0
|
||||
3 1 I/O/T RTC_GPIO1, GPIO1, TOUCH1, ADC1_CH0
|
||||
4 2 I/O/T RTC_GPIO2, GPIO2, TOUCH2, ADC1_CH1
|
||||
5 3 I/O/T RTC_GPIO3, GPIO3, TOUCH3, ADC1_CH2
|
||||
6 4 I/O/T RTC_GPIO4, GPIO4, TOUCH4, ADC1_CH3
|
||||
7 5 I/O/T RTC_GPIO5, GPIO5, TOUCH5, ADC1_CH4
|
||||
8 6 I/O/T RTC_GPIO6, GPIO6, TOUCH6, ADC1_CH5
|
||||
9 7 I/O/T RTC_GPIO7, GPIO7, TOUCH7, ADC1_CH6
|
||||
10 8 I/O/T RTC_GPIO8, GPIO8, TOUCH8, ADC1_CH7
|
||||
11 9 I/O/T RTC_GPIO9, GPIO9, TOUCH9, ADC1_CH8, FSPIHD
|
||||
12 10 I/O/T RTC_GPIO10, GPIO10, TOUCH10, ADC1_CH9, FSPICS0, FSPIIO4
|
||||
13 11 I/O/T RTC_GPIO11, GPIO11, TOUCH11, ADC2_CH0, FSPID, FSPIIO5
|
||||
14 12 I/O/T RTC_GPIO12, GPIO12, TOUCH12, ADC2_CH1, FSPICLK, FSPIIO6
|
||||
15 13 I/O/T RTC_GPIO13, GPIO13, TOUCH13, ADC2_CH2, FSPIQ, FSPIIO7
|
||||
16 14 I/O/T RTC_GPIO14, GPIO14, TOUCH14, ADC2_CH3, FSPIWP, FSPIDQS
|
||||
17 15 I/O/T RTC_GPIO15, GPIO15, U0RTS, ADC2_CH4, XTAL_32K_P
|
||||
18 16 I/O/T RTC_GPIO16, GPIO16, U0CTS, ADC2_CH5, XTAL_32K_N
|
||||
19 17 I/O/T RTC_GPIO17, GPIO17, U1TXD, ADC2_CH6, DAC_1
|
||||
20 5V P 5 V 电源
|
||||
21 G G 接地
|
||||
==== ==== ========= =========================================================================
|
||||
|
||||
J3
|
||||
^^^
|
||||
==== ==== ===== ========================================================
|
||||
序号 名称 类型 功能
|
||||
==== ==== ===== ========================================================
|
||||
1 G G 接地
|
||||
2 RST I CHIP_PU
|
||||
3 46 I GPIO46
|
||||
4 45 I/O/T GPIO45
|
||||
5 RX I/O/T U0RXD, GPIO44, CLK_OUT2
|
||||
6 TX I/O/T U0TXD, GPIO43, CLK_OUT1
|
||||
7 42 I/O/T MTMS, GPIO42
|
||||
8 41 I/O/T MTDI, GPIO41, CLK_OUT1
|
||||
9 40 I/O/T MTDO, GPIO40, CLK_OUT2
|
||||
10 39 I/O/T MTCK, GPIO39, CLK_OUT3
|
||||
11 38 I/O/T GPIO38, FSPIWP
|
||||
12 37 I/O/T SPIDQS, GPIO37, FSPIQ
|
||||
13 36 I/O/T SPIIO7, GPIO36, FSPICLK
|
||||
14 35 I/O/T SPIIO6, GPIO35, FSPID
|
||||
15 34 I/O/T SPIIO5, GPIO34, FSPICS0
|
||||
16 33 I/O/T SPIIO4, GPIO33, FSPIHD
|
||||
17 26 I/O/T SPICS1, GPIO26
|
||||
18 21 I/O/T RTC_GPIO21, GPIO21
|
||||
19 20 I/O/T RTC_GPIO20, GPIO20, U1CTS, ADC2_CH9, CLK_OUT1, USB_D+
|
||||
20 19 I/O/T RTC_GPIO19, GPIO19, U1RTS, ADC2_CH8, CLK_OUT2, USB_D-
|
||||
21 18 I/O/T RTC_GPIO18, GPIO18, U1RXD, ADC2_CH7, DAC_2, CLK_OUT3, RGB LED
|
||||
==== ==== ===== ========================================================
|
||||
|
||||
.. [#] P:电源;I:输入;O:输出;T:可设置为高阻。
|
||||
|
||||
管脚布局
|
||||
^^^^^^^^
|
||||
.. figure:: ../../../_static/esp32-s2-devkitm-1-v1-pin-layout.png
|
||||
:align: center
|
||||
:scale: 15%
|
||||
:alt: ESP32-S2-DevKitM-1(U) 管脚布局(点击放大)
|
||||
:figclass: align-center
|
||||
|
||||
ESP32-S2-DevKitM-1(U) 管脚布局(点击放大)
|
||||
|
||||
硬件版本
|
||||
==========
|
||||
|
||||
无历史版本。
|
||||
|
||||
相关文档
|
||||
========
|
||||
* `ESP32-S2-DevKitM-1(U) 原理图 <https://dl.espressif.com/dl/schematics/ESP32-S2-DevKitM-1_V1_Schematics.pdf>`_ (PDF)
|
||||
* `ESP32-S2-DevKitM-1(U) PCB 布局 <https://dl.espressif.com/dl/schematics/ESP32-S2-DevKitM-1_V1_PCB_Layout.pdf>`_ (PDF)
|
||||
* `ESP32-S2-DevKitM-1(U) 尺寸图 <https://dl.espressif.com/dl/schematics/ESP32-S2-DevKitM-1_V1_Dimensions.pdf>`_ (PDF)
|
||||
* `ESP32-S2 系列技术规格书 <https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_cn.pdf>`_ (PDF)
|
||||
* `ESP32-S2-MINI-1 & ESP32-S2-MINI-1U 技术规格书 <https://www.espressif.com/sites/default/files/documentation/esp32-s2-mini-1_esp32-s2-mini-1u_datasheet_cn.pdf>`_ (PDF)
|
||||
* `乐鑫产品选型工具 <https://products.espressif.com/#/product-selector?names=>`__
|
||||
|
||||
有关本开发板的更多设计文档,请联系我们的商务部门 `sales@espressif.com <sales@espressif.com>`_。
|
@ -1,10 +1,8 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@ -402,6 +400,12 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par
|
||||
param->update_conn_params.latency,
|
||||
param->update_conn_params.timeout);
|
||||
break;
|
||||
case ESP_GAP_BLE_SET_PKT_LENGTH_COMPLETE_EVT:
|
||||
ESP_LOGI(GATTC_TAG, "packet length updated: rx = %d, tx = %d, status = %d",
|
||||
param->pkt_data_lenth_cmpl.params.rx_len,
|
||||
param->pkt_data_lenth_cmpl.params.tx_len,
|
||||
param->pkt_data_lenth_cmpl.status);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@ -233,6 +233,12 @@ static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param
|
||||
param->update_conn_params.latency,
|
||||
param->update_conn_params.timeout);
|
||||
break;
|
||||
case ESP_GAP_BLE_SET_PKT_LENGTH_COMPLETE_EVT:
|
||||
ESP_LOGI(GATTS_TAG, "packet length updated: rx = %d, tx = %d, status = %d",
|
||||
param->pkt_data_lenth_cmpl.params.rx_len,
|
||||
param->pkt_data_lenth_cmpl.params.tx_len,
|
||||
param->pkt_data_lenth_cmpl.status);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -283,7 +289,7 @@ void example_write_event_env(esp_gatt_if_t gatts_if, prepare_type_env_t *prepare
|
||||
|
||||
void example_exec_write_event_env(prepare_type_env_t *prepare_write_env, esp_ble_gatts_cb_param_t *param){
|
||||
if (param->exec_write.exec_write_flag == ESP_GATT_PREP_WRITE_EXEC){
|
||||
esp_log_buffer_hex(GATTS_TAG, prepare_write_env->prepare_buf, prepare_write_env->prepare_len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG, prepare_write_env->prepare_buf, prepare_write_env->prepare_len);
|
||||
}else{
|
||||
ESP_LOGI(GATTS_TAG,"ESP_GATT_PREP_WRITE_CANCEL");
|
||||
}
|
||||
@ -336,7 +342,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
esp_ble_gatts_create_service(gatts_if, &gl_profile_tab[PROFILE_A_APP_ID].service_id, GATTS_NUM_HANDLE_TEST_A);
|
||||
break;
|
||||
case ESP_GATTS_READ_EVT: {
|
||||
ESP_LOGI(GATTS_TAG, "GATT_READ_EVT, conn_id %d, trans_id %d, handle %d\n", param->read.conn_id, param->read.trans_id, param->read.handle);
|
||||
ESP_LOGI(GATTS_TAG, "GATT_READ_EVT, conn_id %d, trans_id %u, handle %d\n", param->read.conn_id, param->read.trans_id, param->read.handle);
|
||||
esp_gatt_rsp_t rsp;
|
||||
memset(&rsp, 0, sizeof(esp_gatt_rsp_t));
|
||||
rsp.attr_value.handle = param->read.handle;
|
||||
@ -350,10 +356,10 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
break;
|
||||
}
|
||||
case ESP_GATTS_WRITE_EVT: {
|
||||
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %d, handle %d", param->write.conn_id, param->write.trans_id, param->write.handle);
|
||||
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %u, handle %d", param->write.conn_id, param->write.trans_id, param->write.handle);
|
||||
if (!param->write.is_prep){
|
||||
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, value len %d, value :", param->write.len);
|
||||
esp_log_buffer_hex(GATTS_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG, param->write.value, param->write.len);
|
||||
if (gl_profile_tab[PROFILE_A_APP_ID].descr_handle == param->write.handle && param->write.len == 2){
|
||||
uint16_t descr_value = param->write.value[1]<<8 | param->write.value[0];
|
||||
if (descr_value == 0x0001){
|
||||
@ -385,7 +391,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
ESP_LOGI(GATTS_TAG, "notify/indicate disable ");
|
||||
}else{
|
||||
ESP_LOGE(GATTS_TAG, "unknown descr value");
|
||||
esp_log_buffer_hex(GATTS_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG, param->write.value, param->write.len);
|
||||
}
|
||||
|
||||
}
|
||||
@ -483,7 +489,7 @@ static void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
case ESP_GATTS_CONF_EVT:
|
||||
ESP_LOGI(GATTS_TAG, "ESP_GATTS_CONF_EVT, status %d attr_handle %d", param->conf.status, param->conf.handle);
|
||||
if (param->conf.status != ESP_GATT_OK){
|
||||
esp_log_buffer_hex(GATTS_TAG, param->conf.value, param->conf.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG, param->conf.value, param->conf.len);
|
||||
}
|
||||
break;
|
||||
case ESP_GATTS_OPEN_EVT:
|
||||
@ -508,7 +514,7 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
esp_ble_gatts_create_service(gatts_if, &gl_profile_tab[PROFILE_B_APP_ID].service_id, GATTS_NUM_HANDLE_TEST_B);
|
||||
break;
|
||||
case ESP_GATTS_READ_EVT: {
|
||||
ESP_LOGI(GATTS_TAG, "GATT_READ_EVT, conn_id %d, trans_id %d, handle %d\n", param->read.conn_id, param->read.trans_id, param->read.handle);
|
||||
ESP_LOGI(GATTS_TAG, "GATT_READ_EVT, conn_id %d, trans_id %u, handle %d\n", param->read.conn_id, param->read.trans_id, param->read.handle);
|
||||
esp_gatt_rsp_t rsp;
|
||||
memset(&rsp, 0, sizeof(esp_gatt_rsp_t));
|
||||
rsp.attr_value.handle = param->read.handle;
|
||||
@ -522,10 +528,10 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
break;
|
||||
}
|
||||
case ESP_GATTS_WRITE_EVT: {
|
||||
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %d, handle %d\n", param->write.conn_id, param->write.trans_id, param->write.handle);
|
||||
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %u, handle %d\n", param->write.conn_id, param->write.trans_id, param->write.handle);
|
||||
if (!param->write.is_prep){
|
||||
ESP_LOGI(GATTS_TAG, "GATT_WRITE_EVT, value len %d, value :", param->write.len);
|
||||
esp_log_buffer_hex(GATTS_TAG, param->write.value, param->write.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG, param->write.value, param->write.len);
|
||||
if (gl_profile_tab[PROFILE_B_APP_ID].descr_handle == param->write.handle && param->write.len == 2){
|
||||
uint16_t descr_value= param->write.value[1]<<8 | param->write.value[0];
|
||||
if (descr_value == 0x0001){
|
||||
@ -626,7 +632,7 @@ static void gatts_profile_b_event_handler(esp_gatts_cb_event_t event, esp_gatt_i
|
||||
case ESP_GATTS_CONF_EVT:
|
||||
ESP_LOGI(GATTS_TAG, "ESP_GATTS_CONF_EVT status %d attr_handle %d", param->conf.status, param->conf.handle);
|
||||
if (param->conf.status != ESP_GATT_OK){
|
||||
esp_log_buffer_hex(GATTS_TAG, param->conf.value, param->conf.len);
|
||||
ESP_LOG_BUFFER_HEX(GATTS_TAG, param->conf.value, param->conf.len);
|
||||
}
|
||||
break;
|
||||
case ESP_GATTS_DISCONNECT_EVT:
|
||||
|
@ -69,6 +69,8 @@ wifi_config_t g_ap_config = {
|
||||
|
||||
#define ETH_ALEN 6
|
||||
#define MAX_CONNECT_RETRY_ATTEMPTS 5
|
||||
#define DEFAULT_WAIT_TIME_MS (10 * 1000)
|
||||
#define MAX_FTM_BURSTS 8
|
||||
#define DEFAULT_AP_CHANNEL 1
|
||||
#define DEFAULT_AP_BANDWIDTH 20
|
||||
|
||||
@ -84,7 +86,6 @@ static const int DISCONNECTED_BIT = BIT1;
|
||||
static EventGroupHandle_t s_ftm_event_group;
|
||||
static const int FTM_REPORT_BIT = BIT0;
|
||||
static const int FTM_FAILURE_BIT = BIT1;
|
||||
static wifi_ftm_report_entry_t *s_ftm_report;
|
||||
static uint8_t s_ftm_report_num_entries;
|
||||
static uint32_t s_rtt_est, s_dist_est;
|
||||
static bool s_ap_started;
|
||||
@ -136,10 +137,12 @@ static void event_handler(void *arg, esp_event_base_t event_base,
|
||||
|
||||
s_rtt_est = event->rtt_est;
|
||||
s_dist_est = event->dist_est;
|
||||
s_ftm_report = event->ftm_report_data;
|
||||
s_ftm_report_num_entries = event->ftm_report_num_entries;
|
||||
if (event->status == FTM_STATUS_SUCCESS) {
|
||||
xEventGroupSetBits(s_ftm_event_group, FTM_REPORT_BIT);
|
||||
} else if (event->status == FTM_STATUS_USER_TERM) {
|
||||
/* Do Nothing */
|
||||
ESP_LOGI(TAG_STA, "User terminated FTM procedure");
|
||||
} else {
|
||||
ESP_LOGI(TAG_STA, "FTM procedure with Peer("MACSTR") failed! (Status - %d)",
|
||||
MAC2STR(event->peer_mac), event->status);
|
||||
@ -152,21 +155,38 @@ static void event_handler(void *arg, esp_event_base_t event_base,
|
||||
}
|
||||
}
|
||||
|
||||
static void ftm_process_report(void)
|
||||
static void ftm_print_report(void)
|
||||
{
|
||||
int i;
|
||||
char *log = NULL;
|
||||
wifi_ftm_report_entry_t *ftm_report = NULL;
|
||||
|
||||
if (s_ftm_report_num_entries == 0)
|
||||
if (s_ftm_report_num_entries == 0) {
|
||||
/* FTM Failure case */
|
||||
return;
|
||||
}
|
||||
|
||||
if (!g_report_lvl)
|
||||
return;
|
||||
if (!g_report_lvl) {
|
||||
/* No need to print, just free the internal FTM report */
|
||||
esp_wifi_ftm_get_report(NULL, 0);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
ftm_report = malloc(sizeof(wifi_ftm_report_entry_t) * s_ftm_report_num_entries);
|
||||
if (!ftm_report) {
|
||||
ESP_LOGE(TAG_STA, "Failed to alloc buffer for FTM report");
|
||||
goto exit;
|
||||
}
|
||||
bzero(ftm_report, sizeof(wifi_ftm_report_entry_t) * s_ftm_report_num_entries);
|
||||
if (ESP_OK != esp_wifi_ftm_get_report(ftm_report, s_ftm_report_num_entries)) {
|
||||
ESP_LOGE(TAG_STA, "Could not get FTM report");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
log = malloc(200);
|
||||
if (!log) {
|
||||
ESP_LOGE(TAG_STA, "Failed to alloc buffer for FTM report");
|
||||
return;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
bzero(log, 200);
|
||||
@ -180,24 +200,32 @@ static void ftm_process_report(void)
|
||||
|
||||
bzero(log, 200);
|
||||
if (g_report_lvl & BIT0) {
|
||||
log_ptr += sprintf(log_ptr, "%6d|", s_ftm_report[i].dlog_token);
|
||||
log_ptr += sprintf(log_ptr, "%6d|", ftm_report[i].dlog_token);
|
||||
}
|
||||
if (g_report_lvl & BIT1) {
|
||||
if (s_ftm_report[i].rtt != UINT32_MAX)
|
||||
log_ptr += sprintf(log_ptr, "%7" PRIi32 " |", s_ftm_report[i].rtt);
|
||||
if (ftm_report[i].rtt != UINT32_MAX)
|
||||
log_ptr += sprintf(log_ptr, "%7" PRIi32 " |", ftm_report[i].rtt);
|
||||
else
|
||||
log_ptr += sprintf(log_ptr, " INVALID |");
|
||||
}
|
||||
if (g_report_lvl & BIT2) {
|
||||
log_ptr += sprintf(log_ptr, "%14llu |%14llu |%14llu |%14llu |", s_ftm_report[i].t1,
|
||||
s_ftm_report[i].t2, s_ftm_report[i].t3, s_ftm_report[i].t4);
|
||||
log_ptr += sprintf(log_ptr, "%14llu |%14llu |%14llu |%14llu |", ftm_report[i].t1,
|
||||
ftm_report[i].t2, ftm_report[i].t3, ftm_report[i].t4);
|
||||
}
|
||||
if (g_report_lvl & BIT3) {
|
||||
log_ptr += sprintf(log_ptr, "%6d |", s_ftm_report[i].rssi);
|
||||
log_ptr += sprintf(log_ptr, "%6d |", ftm_report[i].rssi);
|
||||
}
|
||||
ESP_LOGI(TAG_STA, "|%s", log);
|
||||
}
|
||||
free(log);
|
||||
|
||||
exit:
|
||||
if (log) {
|
||||
free(log);
|
||||
}
|
||||
if (ftm_report) {
|
||||
free(ftm_report);
|
||||
}
|
||||
s_ftm_report_num_entries = 0;
|
||||
}
|
||||
|
||||
void initialise_wifi(void)
|
||||
@ -244,7 +272,7 @@ static bool wifi_cmd_sta_join(const char *ssid, const char *pass)
|
||||
s_reconnect = false;
|
||||
xEventGroupClearBits(s_wifi_event_group, CONNECTED_BIT);
|
||||
ESP_ERROR_CHECK( esp_wifi_disconnect() );
|
||||
xEventGroupWaitBits(s_wifi_event_group, DISCONNECTED_BIT, 0, 1, portTICK_RATE_MS);
|
||||
xEventGroupWaitBits(s_wifi_event_group, DISCONNECTED_BIT, 0, 1, portMAX_DELAY);
|
||||
}
|
||||
|
||||
s_reconnect = true;
|
||||
@ -270,7 +298,7 @@ static int wifi_cmd_sta(int argc, char **argv)
|
||||
s_reconnect = false;
|
||||
xEventGroupClearBits(s_wifi_event_group, CONNECTED_BIT);
|
||||
esp_wifi_disconnect();
|
||||
xEventGroupWaitBits(s_wifi_event_group, DISCONNECTED_BIT, 0, 1, portTICK_PERIOD_MS);
|
||||
xEventGroupWaitBits(s_wifi_event_group, DISCONNECTED_BIT, 0, 1, portMAX_DELAY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -457,11 +485,13 @@ static int wifi_cmd_ftm(int argc, char **argv)
|
||||
{
|
||||
int nerrors = arg_parse(argc, argv, (void **) &ftm_args);
|
||||
wifi_ap_record_t *ap_record;
|
||||
uint32_t wait_time_ms = DEFAULT_WAIT_TIME_MS;
|
||||
EventBits_t bits;
|
||||
|
||||
wifi_ftm_initiator_cfg_t ftmi_cfg = {
|
||||
.frm_count = 32,
|
||||
.burst_period = 2,
|
||||
.use_get_report_api = true,
|
||||
};
|
||||
|
||||
if (nerrors != 0) {
|
||||
@ -505,11 +535,11 @@ static int wifi_cmd_ftm(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (ftm_args.burst_period->count != 0) {
|
||||
if (ftm_args.burst_period->ival[0] >= 2 &&
|
||||
ftm_args.burst_period->ival[0] < 256) {
|
||||
if (ftm_args.burst_period->ival[0] >= 0 &&
|
||||
ftm_args.burst_period->ival[0] <= 100) {
|
||||
ftmi_cfg.burst_period = ftm_args.burst_period->ival[0];
|
||||
} else {
|
||||
ESP_LOGE(TAG_STA, "Invalid Burst Period! Valid range is 2-255");
|
||||
ESP_LOGE(TAG_STA, "Invalid Burst Period! Valid range is 0-100");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -523,17 +553,19 @@ static int wifi_cmd_ftm(int argc, char **argv)
|
||||
}
|
||||
|
||||
bits = xEventGroupWaitBits(s_ftm_event_group, FTM_REPORT_BIT | FTM_FAILURE_BIT,
|
||||
pdTRUE, pdFALSE, portMAX_DELAY);
|
||||
/* Processing data from FTM session */
|
||||
ftm_process_report();
|
||||
free(s_ftm_report);
|
||||
s_ftm_report = NULL;
|
||||
s_ftm_report_num_entries = 0;
|
||||
pdTRUE, pdFALSE, wait_time_ms / portTICK_PERIOD_MS);
|
||||
if (bits & FTM_REPORT_BIT) {
|
||||
/* Print detailed data from FTM session */
|
||||
ftm_print_report();
|
||||
ESP_LOGI(TAG_STA, "Estimated RTT - %d nSec, Estimated Distance - %d.%02d meters",
|
||||
s_rtt_est, s_dist_est / 100, s_dist_est % 100);
|
||||
} else if (bits & FTM_FAILURE_BIT) {
|
||||
/* FTM Failure case */
|
||||
ESP_LOGE(TAG_STA, "FTM procedure failed!");
|
||||
} else {
|
||||
/* Failure case */
|
||||
/* Timeout, end session gracefully */
|
||||
ESP_LOGE(TAG_STA, "FTM procedure timed out!");
|
||||
esp_wifi_ftm_end_session();
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -628,7 +660,7 @@ void register_wifi(void)
|
||||
ftm_args.initiator = arg_lit0("I", "ftm_initiator", "FTM Initiator mode");
|
||||
ftm_args.ssid = arg_str0("s", "ssid", "SSID", "SSID of AP");
|
||||
ftm_args.frm_count = arg_int0("c", "frm_count", "<0/8/16/24/32/64>", "FTM frames to be exchanged (0: No preference)");
|
||||
ftm_args.burst_period = arg_int0("p", "burst_period", "<2-255 (x 100 mSec)>", "Periodicity of FTM bursts in 100's of miliseconds (0: No preference)");
|
||||
ftm_args.burst_period = arg_int0("p", "burst_period", "<0-100 (x 100 mSec)>", "Periodicity of FTM bursts in 100's of miliseconds (0: No preference)");
|
||||
/* FTM Responder commands */
|
||||
ftm_args.responder = arg_lit0("R", "ftm_responder", "FTM Responder mode");
|
||||
ftm_args.enable = arg_lit0("e", "enable", "Restart SoftAP with FTM enabled");
|
||||
|
@ -1,3 +1,3 @@
|
||||
IDF_VERSION_MAJOR := 4
|
||||
IDF_VERSION_MINOR := 4
|
||||
IDF_VERSION_PATCH := 7
|
||||
IDF_VERSION_PATCH := 8
|
||||
|
@ -1,5 +1,5 @@
|
||||
set(IDF_VERSION_MAJOR 4)
|
||||
set(IDF_VERSION_MINOR 4)
|
||||
set(IDF_VERSION_PATCH 7)
|
||||
set(IDF_VERSION_PATCH 8)
|
||||
|
||||
set(ENV{IDF_VERSION} "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}")
|
||||
|
@ -4,7 +4,6 @@ import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from io import open
|
||||
|
||||
import click
|
||||
|
||||
@ -22,6 +21,7 @@ def executable_exists(args):
|
||||
|
||||
|
||||
def _idf_version_from_cmake():
|
||||
"""Acquires version of ESP-IDF from version.cmake"""
|
||||
version_path = os.path.join(os.environ['IDF_PATH'], 'tools/cmake/version.cmake')
|
||||
regex = re.compile(r'^\s*set\s*\(\s*IDF_VERSION_([A-Z]{5})\s+(\d+)')
|
||||
ver = {}
|
||||
@ -55,7 +55,7 @@ def idf_version():
|
||||
'--work-tree=%s' % os.environ['IDF_PATH'],
|
||||
'describe', '--tags', '--dirty', '--match', 'v*.*',
|
||||
]).decode('utf-8', 'ignore').strip()
|
||||
except (subprocess.CalledProcessError, UnicodeError):
|
||||
except Exception:
|
||||
# if failed, then try to parse cmake.version file
|
||||
sys.stderr.write('WARNING: Git version unavailable, reading from source\n')
|
||||
version = _idf_version_from_cmake()
|
||||
|