diff --git a/components/hal/include/hal/ieee802154_common_ll.h b/components/hal/include/hal/ieee802154_common_ll.h index 0cea3682b0..865b53cf5c 100644 --- a/components/hal/include/hal/ieee802154_common_ll.h +++ b/components/hal/include/hal/ieee802154_common_ll.h @@ -95,6 +95,7 @@ typedef enum { } ieee802154_ll_rx_abort_reason_t; typedef uint32_t ieee802154_ll_rx_abort_events; +#define IEEE802154_RX_ABORT_ALL 0x7fffffff /** * @brief IEEE802154 transmission failed reason. @@ -118,6 +119,7 @@ typedef enum { } ieee802154_ll_tx_abort_reason_t; typedef uint32_t ieee802154_ll_tx_abort_events; +#define IEEE802154_TX_ABORT_ALL 0x7fffffff /** * @brief IEEE802154 CCA mode. diff --git a/components/ieee802154/driver/esp_ieee802154_dev.c b/components/ieee802154/driver/esp_ieee802154_dev.c index 4bc758ac86..d5cf9b1afe 100644 --- a/components/ieee802154/driver/esp_ieee802154_dev.c +++ b/components/ieee802154/driver/esp_ieee802154_dev.c @@ -351,6 +351,8 @@ 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_enable_rx_abort_events(BIT(IEEE802154_RX_ABORT_BY_TX_ACK_TIMEOUT - 1) | BIT(IEEE802154_RX_ABORT_BY_TX_ACK_COEX_BREAK - 1)); ieee802154_transmit_internal(s_pending_tx.frame, s_pending_tx.cca); s_pending_tx.frame = NULL; } else @@ -482,18 +484,18 @@ static IRAM_ATTR void isr_handle_rx_abort(void) IEEE802154_ASSERT(s_ieee802154_state == IEEE802154_STATE_RX); #if CONFIG_IEEE802154_TEST esp_ieee802154_receive_failed(rx_status); - next_operation(); #endif break; case IEEE802154_RX_ABORT_BY_COEX_BREAK: IEEE802154_ASSERT(s_ieee802154_state == IEEE802154_STATE_RX); +#if CONFIG_IEEE802154_TEST esp_ieee802154_receive_failed(rx_status); +#endif break; case IEEE802154_RX_ABORT_BY_ED_ABORT: case IEEE802154_RX_ABORT_BY_ED_COEX_REJECT: IEEE802154_ASSERT(s_ieee802154_state == IEEE802154_STATE_ED || s_ieee802154_state == IEEE802154_STATE_CCA); esp_ieee802154_ed_failed(rx_status); - next_operation(); break; case IEEE802154_RX_ABORT_BY_TX_ACK_TIMEOUT: case IEEE802154_RX_ABORT_BY_TX_ACK_COEX_BREAK: @@ -503,7 +505,6 @@ static IRAM_ATTR void isr_handle_rx_abort(void) #else esp_ieee802154_receive_failed(rx_status); #endif - next_operation(); break; case IEEE802154_RX_ABORT_BY_ENHACK_SECURITY_ERROR: IEEE802154_ASSERT(s_ieee802154_state == IEEE802154_STATE_TX_ENH_ACK); @@ -512,11 +513,11 @@ static IRAM_ATTR void isr_handle_rx_abort(void) #else esp_ieee802154_receive_failed(rx_status); #endif - next_operation(); break; default: IEEE802154_ASSERT(false); } + next_operation(); } static IRAM_ATTR void isr_handle_tx_abort(void) @@ -816,6 +817,7 @@ static inline esp_err_t ieee802154_transmit_internal(const uint8_t *frame, bool esp_err_t ieee802154_transmit(const uint8_t *frame, bool cca) { #if !CONFIG_IEEE802154_TEST + ieee802154_enter_critical(); if ((s_ieee802154_state == IEEE802154_STATE_RX && ieee802154_ll_is_current_rx_frame()) || s_ieee802154_state == IEEE802154_STATE_TX_ACK || s_ieee802154_state == IEEE802154_STATE_TX_ENH_ACK) { // If the current radio is processing an RX frame or sending an ACK, do not shut down the ongoing process. @@ -824,8 +826,13 @@ esp_err_t ieee802154_transmit(const uint8_t *frame, bool cca) s_pending_tx.frame = frame; s_pending_tx.cca = cca; IEEE802154_TX_DEFERRED_NUMS_UPDATE(); + // Here we enable all rx interrupts due to the driver needs to know when the current RX has finished. + // Will recover the setting of rx abort in function `next_operation`. + ieee802154_ll_enable_rx_abort_events(IEEE802154_RX_ABORT_ALL); + ieee802154_exit_critical(); return ESP_OK; } + ieee802154_exit_critical(); #endif return ieee802154_transmit_internal(frame, cca); } diff --git a/components/openthread/Kconfig b/components/openthread/Kconfig index fd77585b23..c291ede131 100644 --- a/components/openthread/Kconfig +++ b/components/openthread/Kconfig @@ -114,6 +114,7 @@ menu "OpenThread" Select this to use the native 15.4 radio. config OPENTHREAD_RADIO_SPINEL_UART + select UART_ISR_IN_IRAM bool "Connect via UART" help Select this to connect to a Radio Co-Processor via UART. @@ -157,6 +158,7 @@ menu "OpenThread" default OPENTHREAD_RCP_UART config OPENTHREAD_RCP_UART + select UART_ISR_IN_IRAM bool "UART RCP" help Select this to enable UART connection to host. @@ -293,7 +295,7 @@ menu "OpenThread" config OPENTHREAD_UART_BUFFER_SIZE int "The uart received buffer size of openthread" depends on OPENTHREAD_ENABLED - default 256 + default 768 range 128 1024 help Set the OpenThread UART buffer size. @@ -374,6 +376,15 @@ menu "OpenThread" default n help Select this option to enable the OpenThread Radio Spinel for external protocol stack, such as Zigbee. + + config OPENTHREAD_RX_ON_WHEN_IDLE + bool "Enable OpenThread radio capibility rx on when idle" + default y if !ESP_COEX_SW_COEXIST_ENABLE + default n if ESP_COEX_SW_COEXIST_ENABLE + help + Select this option to enable OpenThread radio capibility rx on when idle. Do not support this feature when + SW coexistence is enabled. + menu "Thread Address Query Config" config OPENTHREAD_ADDRESS_QUERY_TIMEOUT int "Timeout value (in seconds) for a address notification response after sending an address query." diff --git a/components/openthread/lib b/components/openthread/lib index e0969fc15c..fcee30db4b 160000 --- a/components/openthread/lib +++ b/components/openthread/lib @@ -1 +1 @@ -Subproject commit e0969fc15c1991d91446a0dc5e4625ed2c0bb014 +Subproject commit fcee30db4b7342de4df9105bdd049a09d2d63187 diff --git a/components/openthread/openthread b/components/openthread/openthread index 41ef80717f..456c448284 160000 --- a/components/openthread/openthread +++ b/components/openthread/openthread @@ -1 +1 @@ -Subproject commit 41ef80717f4b757440125932723cc8721ef42f7f +Subproject commit 456c448284486abe2a9118a9fdaa468fe2383fcd diff --git a/components/openthread/sbom_openthread.yml b/components/openthread/sbom_openthread.yml index c518ee3bc0..0748bffc63 100644 --- a/components/openthread/sbom_openthread.yml +++ b/components/openthread/sbom_openthread.yml @@ -5,4 +5,4 @@ supplier: 'Organization: Espressif Systems (Shanghai) CO LTD' originator: 'Organization: Google LLC' description: OpenThread released by Google is an open-source implementation of the Thread networking url: https://github.com/espressif/openthread -hash: 41ef80717f4b757440125932723cc8721ef42f7f +hash: 456c448284486abe2a9118a9fdaa468fe2383fcd diff --git a/components/openthread/src/port/esp_openthread_radio.c b/components/openthread/src/port/esp_openthread_radio.c index c98989e086..3079d75e16 100644 --- a/components/openthread/src/port/esp_openthread_radio.c +++ b/components/openthread/src/port/esp_openthread_radio.c @@ -343,7 +343,11 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance) otRadioCaps otPlatRadioGetCaps(otInstance *aInstance) { - return (otRadioCaps)(OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_RX_ON_WHEN_IDLE | +// FIXME: Remove `CONFIG_OPENTHREAD_RX_ON_WHEN_IDLE` when JIRA: TZ-609 fixed. + return (otRadioCaps)(OT_RADIO_CAPS_ENERGY_SCAN | +#if CONFIG_OPENTHREAD_RX_ON_WHEN_IDLE + OT_RADIO_CAPS_RX_ON_WHEN_IDLE | +#endif OT_RADIO_CAPS_TRANSMIT_SEC | OT_RADIO_CAPS_RECEIVE_TIMING | OT_RADIO_CAPS_TRANSMIT_TIMING | OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_SLEEP_TO_TX); } @@ -771,8 +775,10 @@ otError otPlatRadioSetChannelMaxTransmitPower(otInstance *aInstance, uint8_t aCh return OT_ERROR_NONE; } +#if CONFIG_OPENTHREAD_RX_ON_WHEN_IDLE void otPlatRadioSetRxOnWhenIdle(otInstance *aInstance, bool aEnable) { OT_UNUSED_VARIABLE(aInstance); esp_ieee802154_set_rx_when_idle(aEnable); } +#endif diff --git a/components/openthread/src/port/esp_openthread_radio_spinel.cpp b/components/openthread/src/port/esp_openthread_radio_spinel.cpp index 2574bd2b13..a926138f9a 100644 --- a/components/openthread/src/port/esp_openthread_radio_spinel.cpp +++ b/components/openthread/src/port/esp_openthread_radio_spinel.cpp @@ -6,6 +6,7 @@ #include "esp_openthread_radio.h" +#include "sdkconfig.h" #include "esp_check.h" #include "esp_err.h" #include "esp_openthread_border_router.h" @@ -413,7 +414,9 @@ otError otPlatRadioConfigureEnhAckProbing(otInstance *aInstance, otLinkMetrics a } #endif +#if CONFIG_OPENTHREAD_RX_ON_WHEN_IDLE void otPlatRadioSetRxOnWhenIdle(otInstance *aInstance, bool aEnable) { s_radio.SetRxOnWhenIdle(aEnable); } +#endif