This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 6e72118ee8d96a3fe82ec934ae50031721e797bd Author: raiden00pl <[email protected]> AuthorDate: Thu Oct 22 15:40:03 2026 +0200 arch/arm/nrf52,nrf53,nrf54l: report RSSI and the scaled LQI of a received frame RSSI was always 0 and LQI the raw RADIO value. Sample RSSI after the SFD with the ADDRESS-RSSISTART shortcut and scale LQI by ED_RSSISCALE like the energy detection result. Assisted-by: Claude Code Signed-off-by: raiden00pl <[email protected]> --- arch/arm/src/nrf52/nrf52_ieee802154_radio.c | 15 ++++++++------- arch/arm/src/nrf53/nrf53_ieee802154_radio.c | 15 ++++++++------- arch/arm/src/nrf54l/nrf54l_ieee802154_radio.c | 15 ++++++++------- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/arch/arm/src/nrf52/nrf52_ieee802154_radio.c b/arch/arm/src/nrf52/nrf52_ieee802154_radio.c index d4b025f4d2a..ba2b2de8140 100644 --- a/arch/arm/src/nrf52/nrf52_ieee802154_radio.c +++ b/arch/arm/src/nrf52/nrf52_ieee802154_radio.c @@ -73,6 +73,7 @@ * - IRQ on END event (packet recveived) * - shortcut between RXREADY and START * - shortcut between END and DISABLE + * - shortcut between ADDRESS and RSSISTART * * Set in nrf52_radioi8_rxenable() reset in nrf52_radioi8_rxenable(). * @@ -82,7 +83,8 @@ #define IEEE802154_RX_INT (RADIO_INT_END) #define IEEE802154_RX_SHORTS (RADIO_SHORTS_RXREADY_START | \ - RADIO_SHORTS_END_DISABLE) + RADIO_SHORTS_END_DISABLE | \ + RADIO_SHORTS_ADDRESS_RSSISTART) /* NOTE: for TX we trigger interrupts on PHYEND event, not END! */ @@ -1626,15 +1628,14 @@ static void nrf52_radioi8_work_rx(void *arg) ind->frame->io_data[index + 1] = 0; ind->frame->io_data[index + 2] = 0; - /* LQI is the last byte in RAM */ + /* LQI is the last byte in RAM, scaled to 0-255 like the ED result */ - ind->lqi = dev->radio->rxbuf[index + 1]; + ind->lqi = MIN(dev->radio->rxbuf[index + 1] * NRF52_ED_RSSISCALE, 255); - /* RSSI is non-standard field and is not supported here. - * TODO: get RSSI from LQI ? - */ + /* RSSI sampled after the SFD, the signal strength is -rssi dBm */ - ind->rssi = 0; + ind->rssi = NRF52_RADIO_GETREG(lower, NRF52_RADIO_RSSISAMPLE_OFFSET) & + RADIO_RSSISAMPLE_MASK; /* Callback the receiver in the next highest layer */ diff --git a/arch/arm/src/nrf53/nrf53_ieee802154_radio.c b/arch/arm/src/nrf53/nrf53_ieee802154_radio.c index 24e153c058f..9f241cf9444 100644 --- a/arch/arm/src/nrf53/nrf53_ieee802154_radio.c +++ b/arch/arm/src/nrf53/nrf53_ieee802154_radio.c @@ -73,6 +73,7 @@ * - IRQ on END event (packet recveived) * - shortcut between RXREADY and START * - shortcut between END and DISABLE + * - shortcut between ADDRESS and RSSISTART * * Set in nrf53_radioi8_rxenable() reset in nrf53_radioi8_rxenable(). * @@ -82,7 +83,8 @@ #define IEEE802154_RX_INT (RADIO_INT_END) #define IEEE802154_RX_SHORTS (RADIO_SHORTS_RXREADY_START | \ - RADIO_SHORTS_END_DISABLE) + RADIO_SHORTS_END_DISABLE | \ + RADIO_SHORTS_ADDRESS_RSSISTART) /* NOTE: for TX we trigger interrupts on PHYEND event, not END! */ @@ -1626,15 +1628,14 @@ static void nrf53_radioi8_work_rx(void *arg) ind->frame->io_data[index + 1] = 0; ind->frame->io_data[index + 2] = 0; - /* LQI is the last byte in RAM */ + /* LQI is the last byte in RAM, scaled to 0-255 like the ED result */ - ind->lqi = dev->radio->rxbuf[index + 1]; + ind->lqi = MIN(dev->radio->rxbuf[index + 1] * NRF53_ED_RSSISCALE, 255); - /* RSSI is non-standard field and is not supported here. - * TODO: get RSSI from LQI ? - */ + /* RSSI sampled after the SFD, the signal strength is -rssi dBm */ - ind->rssi = 0; + ind->rssi = NRF53_RADIO_GETREG(lower, NRF53_RADIO_RSSISAMPLE_OFFSET) & + RADIO_RSSISAMPLE_MASK; /* Callback the receiver in the next highest layer */ diff --git a/arch/arm/src/nrf54l/nrf54l_ieee802154_radio.c b/arch/arm/src/nrf54l/nrf54l_ieee802154_radio.c index 5abe1757362..da4c88f51d6 100644 --- a/arch/arm/src/nrf54l/nrf54l_ieee802154_radio.c +++ b/arch/arm/src/nrf54l/nrf54l_ieee802154_radio.c @@ -70,6 +70,7 @@ /* RX configuration: * - IRQ on END event (packet recveived) * - shortcut between RXREADY and START + * - shortcut between ADDRESS and RSSISTART * * Set in nrf54l_radioi8_rxenable() reset in nrf54l_radioi8_rxenable(). * @@ -80,7 +81,8 @@ #define IEEE802154_RX_INT (RADIO_INT_END) /* There is no END to DISABLE shortcut, RADIO is disabled in the ISR */ -#define IEEE802154_RX_SHORTS (RADIO_SHORTS_RXREADY_START) +#define IEEE802154_RX_SHORTS (RADIO_SHORTS_RXREADY_START | \ + RADIO_SHORTS_ADDRESS_RSSISTART) /* NOTE: for TX we trigger interrupts on PHYEND event, not END! */ @@ -1446,15 +1448,14 @@ static void nrf54l_radioi8_work_rx(void *arg) ind->frame->io_data[index + 1] = 0; ind->frame->io_data[index + 2] = 0; - /* LQI is the last byte in RAM */ + /* LQI is the last byte in RAM, scaled to 0-255 like the ED result */ - ind->lqi = dev->radio->rxbuf[index + 1]; + ind->lqi = MIN(dev->radio->rxbuf[index + 1] * NRF54L_ED_RSSISCALE, 255); - /* RSSI is non-standard field and is not supported here. - * TODO: get RSSI from LQI ? - */ + /* RSSI sampled after the SFD, the signal strength is -rssi dBm */ - ind->rssi = 0; + ind->rssi = NRF54L_RADIO_GETREG(lower, NRF54L_RADIO_RSSISAMPLE_OFFSET) & + RADIO_RSSISAMPLE_MASK; /* Callback the receiver in the next highest layer */
