Merge branch 'fix/rx_abort_next_op_v5.2' into 'release/v5.2'

fix(openthread): disable rx_abort events in next operation (v5.2)

See merge request espressif/esp-idf!39961
This commit is contained in:
Shu Chen
2025-06-18 10:16:54 +00:00
5 changed files with 78 additions and 6 deletions

View File

@@ -385,6 +385,7 @@ static IRAM_ATTR void next_operation(void)
#if !CONFIG_IEEE802154_TEST
if (s_pending_tx.frame) {
// Here the driver needs to recover the setting of rx aborts, see function `ieee802154_transmit`.
ieee802154_ll_disable_rx_abort_events(IEEE802154_RX_ABORT_ALL);
ieee802154_ll_enable_rx_abort_events(BIT(IEEE802154_RX_ABORT_BY_TX_ACK_TIMEOUT - 1) | BIT(IEEE802154_RX_ABORT_BY_TX_ACK_COEX_BREAK - 1));
// Clear the RX abort event again for avoiding the risk if there are still some rx abort events created after last isr process.
ieee802154_ll_clear_events(IEEE802154_EVENT_RX_ABORT);

View File

@@ -320,8 +320,8 @@ menu "OpenThread"
config OPENTHREAD_RX_ON_WHEN_IDLE
bool "Enable OpenThread radio capability rx on when idle"
default y if !ESP_COEX_SW_COEXIST_ENABLE
default n if ESP_COEX_SW_COEXIST_ENABLE
default y if !ESP_COEX_SW_COEXIST_ENABLE && !ESP_COEX_EXTERNAL_COEXIST_ENABLE
default n if ESP_COEX_SW_COEXIST_ENABLE || ESP_COEX_EXTERNAL_COEXIST_ENABLE
help
Select this option to enable OpenThread radio capability rx on when idle.
Do not support this feature when SW coexistence is enabled.
@@ -343,7 +343,7 @@ menu "OpenThread"
RSS to its current parent every periodically and starts a parent search process if the average
RSS is below OPENTHREAD_PARENT_SEARCH_RSS_THRESHOLD. This feature is always enabled for FTDs.
menu "Parent Search Configurations"
depends on OPENTHREAD_PARENT_SEARCH_MTD
depends on OPENTHREAD_PARENT_SEARCH_MTD || OPENTHREAD_FTD
config OPENTHREAD_PARENT_SEARCH_CHECK_INTERVAL_MINS
int "The interval in minutes for a child to check the trigger condition to perform a parent search"
default 9
@@ -353,6 +353,12 @@ menu "OpenThread"
config OPENTHREAD_PARENT_SEARCH_RSS_THRESHOLD
int "The RSS threshold used to trigger a parent search"
default -65
config OPENTHREAD_PARENT_SEARCH_RESELECT_TIMEOUT_MINS
int "The parent reselect timeout duration in minutes used on FTD child devices"
default 90
config OPENTHREAD_PARENT_SEARCH_RSS_MARGIN
int "The RSS margin over the current parent RSS used on FTD child devices"
default 7
endmenu
menu "Thread Memory Allocation"

View File

@@ -382,6 +382,68 @@
#define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL
*
* Specifies the interval in seconds for a child to check the trigger condition to perform a parent search.
*
* Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`).
*/
#ifdef OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL
#error `OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL` is redefined.
#endif
#define OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL CONFIG_OPENTHREAD_PARENT_SEARCH_CHECK_INTERVAL_MINS * 60
/**
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL
*
* Specifies the backoff interval in seconds for a child to not perform a parent search after triggering one. This is
* used when device is an MTD child.
*
* Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`).
*/
#ifdef OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL
#error `OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL` is redefined.
#endif
#define OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL CONFIG_OPENTHREAD_PARENT_SEARCH_BACKOFF_INTERVAL_MINS * 60
/**
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD
*
* Specifies the RSS threshold used to trigger a parent search.
*
* Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`).
*/
#ifdef OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD
#error `OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD` is redefined.
#endif
#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD CONFIG_OPENTHREAD_PARENT_SEARCH_RSS_THRESHOLD
/**
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_RESELECT_TIMEOUT
*
* Specifies parent reselect timeout duration in seconds used on FTD child devices. When an attach attempt to a
* neighboring router selected as a potential new parent fails, the same router cannot be selected again until this
* timeout expires.
*
* Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`).
*/
#ifdef OPENTHREAD_CONFIG_PARENT_SEARCH_RESELECT_TIMEOUT
#error `OPENTHREAD_CONFIG_PARENT_SEARCH_RESELECT_TIMEOUT` is redefined.
#endif
#define OPENTHREAD_CONFIG_PARENT_SEARCH_RESELECT_TIMEOUT CONFIG_OPENTHREAD_PARENT_SEARCH_RESELECT_TIMEOUT_MINS * 60
/**
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_MARGIN
*
* Specifies the RSS margin over the current parent RSS for allowing selection of a neighboring router as a potential
* new parent to attach to. Used on FTD child devices.
*/
#ifdef OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_MARGIN
#error `OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_MARGIN` is redefined.
#endif
#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_MARGIN CONFIG_OPENTHREAD_PARENT_SEARCH_RSS_MARGIN
/*----The following options set fixed default values but can be overridden by the user header file.----*/
#if CONFIG_OPENTHREAD_BORDER_ROUTER

View File

@@ -19,10 +19,12 @@ esp_err_t esp_openthread_sleep_init(void)
{
esp_err_t err = ESP_OK;
err = esp_pm_lock_create(ESP_PM_CPU_FREQ_MAX, 0, "ieee802154", &s_pm_lock);
// Here we use APB_MAX because modem requires MODEM_REQUIRED_MIN_APB_CLK_FREQ.
// No need for CPU_MAX to reduce current consumption during Rx window.
err = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "ot_sleep", &s_pm_lock);
if (err == ESP_OK) {
esp_pm_lock_acquire(s_pm_lock);
ESP_LOGI(TAG, "Enable ieee802154 light sleep, the wake up source is ESP timer");
ESP_LOGI(TAG, "Enable OpenThread light sleep, the wake up source is ESP timer");
} else {
if (s_pm_lock != NULL) {
esp_pm_lock_delete(s_pm_lock);

View File

@@ -25,6 +25,7 @@
#include "esp_openthread_netif_glue.h"
#include "esp_ot_sleepy_device_config.h"
#include "esp_vfs_eventfd.h"
#include "esp_private/esp_clk.h"
#include "driver/uart.h"
#include "nvs_flash.h"
#include "openthread/logging.h"
@@ -192,7 +193,7 @@ static esp_err_t ot_power_save_init(void)
esp_pm_config_t pm_config = {
.max_freq_mhz = cur_cpu_freq_mhz,
.min_freq_mhz = cur_cpu_freq_mhz,
.min_freq_mhz = esp_clk_xtal_freq() / MHZ,
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
.light_sleep_enable = true
#endif