Merge branch 'feat/csl_power_consumption_v5.5' into 'release/v5.5'

feat(openthread): turn off rx earlier for csl if no packet received (v5.5)

See merge request espressif/esp-idf!46193
This commit is contained in:
Zhang Wen Xu
2026-03-03 03:35:30 +00:00
5 changed files with 41 additions and 6 deletions
@@ -66,6 +66,7 @@ static uint8_t s_rx_frame[CONFIG_IEEE802154_RX_BUFFER_SIZE + 1][IEEE802154_RX_FR
static esp_ieee802154_frame_info_t s_rx_frame_info[CONFIG_IEEE802154_RX_BUFFER_SIZE + 1];
static bool s_needs_next_operation = false;
static volatile bool s_pending_rx_stop = false;
static uint8_t s_rx_index = 0;
static uint8_t s_enh_ack_frame[128];
@@ -457,6 +458,13 @@ static void enable_rx(void)
static IRAM_ATTR void next_operation(void)
{
if (s_pending_rx_stop) {
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));
esp_ieee802154_receive_at_done();
s_pending_rx_stop = false;
}
if (ieee802154_pib_get_rx_when_idle()) {
enable_rx();
} else {
@@ -1044,8 +1052,15 @@ esp_err_t ieee802154_receive(void)
IEEE802154_NOINLINE static void ieee802154_finish_receive_at(void* ctx)
{
(void)ctx;
stop_current_operation();
esp_ieee802154_receive_at_done();
if (s_ieee802154_state == IEEE802154_STATE_RX && ieee802154_ll_is_current_rx_frame()) {
// if we successfully receive SFD, then continue receiving
ieee802154_ll_enable_rx_abort_events(IEEE802154_RX_ABORT_ALL);
s_pending_rx_stop = true;
} else {
// or else we go back to sleep
stop_current_operation();
esp_ieee802154_receive_at_done();
}
}
IEEE802154_NOINLINE static void ieee802154_start_receive_at(void* ctx)
+1 -1
View File
@@ -357,7 +357,7 @@ menu "OpenThread"
config OPENTHREAD_CSL_UNCERTAIN
int "The CSL Uncertainty in units of 10 us."
default 0
default 50
help
The fixed uncertainty of the Device for scheduling CSL Transmissions in units of 10 microseconds.
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -868,6 +868,16 @@
#define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD (OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US + 320)
#endif
/**
* @def OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER
*
* Additional time for CSL receiver to remain in rx active after SFD has been received, in units of microseconds.
*
*/
#ifndef OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER
#define OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER 0
#endif
/**
* @def OPENTHREAD_CONFIG_OPERATIONAL_DATASET_AUTO_INIT
*
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -450,6 +450,16 @@
#define OPENTHREAD_CONFIG_CSL_RECEIVE_TIME_AHEAD (OPENTHREAD_CONFIG_MAC_CSL_REQUEST_AHEAD_US + 320)
#endif
/**
* @def OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER
*
* Additional time for CSL receiver to remain in rx active after SFD has been received, in units of microseconds.
*
*/
#ifndef OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER
#define OPENTHREAD_CONFIG_MIN_RECEIVE_ON_AFTER 0
#endif
/**
* @def OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE
*
@@ -5,5 +5,5 @@ CONFIG_LOG_MAXIMUM_LEVEL_DEBUG=y
CONFIG_ESP_SLEEP_CACHE_SAFE_ASSERTION=y
CONFIG_OPENTHREAD_CSL_ENABLE=y
CONFIG_OPENTHREAD_CSL_ACCURACY=50
CONFIG_OPENTHREAD_CSL_UNCERTAIN=0
CONFIG_OPENTHREAD_CSL_UNCERTAIN=50
CONFIG_RTC_CLK_SRC_EXT_CRYS=y