From b5b607cc1d2070c93101fc885a14c990c01fbac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Duda?= Date: Mon, 10 Feb 2020 02:11:07 +0100 Subject: [PATCH] [nrf528xx] fix synchronous GetRssi functionality (#4537) This commit aligns otPlatRadioGetRssi implementation with the latest changes to radio driver. Without this change, for example, Channel Monitor and Energy Scanning with duration of 0 (energy scan 0 command) does not work. --- examples/platforms/nrf528xx/src/radio.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/platforms/nrf528xx/src/radio.c b/examples/platforms/nrf528xx/src/radio.c index d97aaab2c..e85f8fa07 100644 --- a/examples/platforms/nrf528xx/src/radio.c +++ b/examples/platforms/nrf528xx/src/radio.c @@ -71,6 +71,8 @@ #define FRAME_PENDING_OFFSET 1 ///< Byte containing pending bit (+1 for frame length byte). #define FRAME_PENDING_BIT (1 << 4) ///< Frame Pending bit. +#define RSSI_SETTLE_TIME_US 40 ///< RSSI settle time in microseconds. + #if defined(__ICCARM__) _Pragma("diag_suppress=Pe167") #endif @@ -413,6 +415,12 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); + // Ensure the RSSI measurement is done after RSSI settling time. + // This is necessary for the Channel Monitor feature which quickly switches between channels. + NRFX_DELAY_US(RSSI_SETTLE_TIME_US); + + nrf_802154_rssi_measure_begin(); + return nrf_802154_rssi_last_get(); }