From 6ebc5174087fbbe507f8132935d4f55ed7f6d1be Mon Sep 17 00:00:00 2001 From: Marven Gilhespie <45208741+marvensilabs@users.noreply.github.com> Date: Tue, 6 Aug 2019 17:32:24 +0100 Subject: [PATCH] [efr32] fix assert triggered in otPlatRadioTransmit (#3768) (#4060) * Removed assert if RAIL_StartTx() fails. It will report the error and continue * Updated Makefile.am to fix missing header and prettified radio.c * Added OPENTHREAD_CONFIG_NCP_UART_ENABLE to efr32mg12 config --- examples/platforms/efr32mg12/radio.c | 12 +++++++++--- .../efr32mg21/openthread-core-efr32-config.h | 8 ++++++++ examples/platforms/efr32mg21/radio.c | 12 +++++++++--- third_party/silabs/Makefile.am | 1 + 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/examples/platforms/efr32mg12/radio.c b/examples/platforms/efr32mg12/radio.c index 0b61c64d6..6460068e1 100644 --- a/examples/platforms/efr32mg12/radio.c +++ b/examples/platforms/efr32mg12/radio.c @@ -538,9 +538,15 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) status = RAIL_StartTx(gRailHandle, aFrame->mChannel, txOptions, NULL); } - assert(status == RAIL_STATUS_NO_ERROR); - - otPlatRadioTxStarted(aInstance, aFrame); + if (status == RAIL_STATUS_NO_ERROR) + { + otPlatRadioTxStarted(aInstance, aFrame); + } + else + { + sTransmitError = OT_ERROR_CHANNEL_ACCESS_FAILURE; + sTransmitBusy = false; + } exit: return error; diff --git a/examples/platforms/efr32mg21/openthread-core-efr32-config.h b/examples/platforms/efr32mg21/openthread-core-efr32-config.h index 65f81d2b4..1cc95180a 100644 --- a/examples/platforms/efr32mg21/openthread-core-efr32-config.h +++ b/examples/platforms/efr32mg21/openthread-core-efr32-config.h @@ -140,4 +140,12 @@ */ #define RADIO_CONFIG_SRC_MATCH_EXT_ENTRY_NUM 6 +/** + * @def OPENTHREAD_CONFIG_NCP_UART_ENABLE + * + * Define to 1 to enable NCP UART support. + * + */ +#define OPENTHREAD_CONFIG_NCP_UART_ENABLE 1 + #endif // OPENTHREAD_CORE_EFR32_CONFIG_H_ diff --git a/examples/platforms/efr32mg21/radio.c b/examples/platforms/efr32mg21/radio.c index e9511afbf..b2b34dc94 100644 --- a/examples/platforms/efr32mg21/radio.c +++ b/examples/platforms/efr32mg21/radio.c @@ -514,9 +514,15 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame) status = RAIL_StartTx(sTxBandConfig->mRailHandle, aFrame->mChannel, txOptions, &schedulerInfo); } - assert(status == RAIL_STATUS_NO_ERROR); - - otPlatRadioTxStarted(aInstance, aFrame); + if (status == RAIL_STATUS_NO_ERROR) + { + otPlatRadioTxStarted(aInstance, aFrame); + } + else + { + sTransmitError = OT_ERROR_CHANNEL_ACCESS_FAILURE; + sTransmitBusy = false; + } exit: return error; diff --git a/third_party/silabs/Makefile.am b/third_party/silabs/Makefile.am index a560b6479..93ef8a6e8 100644 --- a/third_party/silabs/Makefile.am +++ b/third_party/silabs/Makefile.am @@ -61,6 +61,7 @@ COMMONCPPFLAGS -D__STARTUP_CLEAR_BSS \ -I$(srcdir) \ -I$(top_srcdir)/include \ + -I$(top_srcdir)/src/core \ -I$(top_srcdir)/third_party/silabs/rail_config \ -I$(top_srcdir)/examples/platforms/efr32mg21/$(EFR32_BOARD_DIR) \ -I$(EFR32MG_SDK_SRCDIR) \