Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu/nrf52: fix RSSI calculation in nrf802154_radio #20839

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions cpu/nrf52/radio/nrf802154/nrf802154_radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,13 @@
radio_info->lqi = (uint8_t)(hwlqi > UINT8_MAX/ED_RSSISCALE
? UINT8_MAX
: hwlqi * ED_RSSISCALE);
/* We calculate RSSI from LQI, since it's already 8-bit
saturated (see page 321 of product spec v1.1) */
radio_info->rssi = _hwval_to_ieee802154_dbm(radio_info->lqi)
+ IEEE802154_RADIO_RSSI_OFFSET;
/* Converting the hardware-provided LQI value back to the
original RSSI value is not properly documented in the PS.
The linear mapping used here has been found empirically
through comparison with the RSSI value provided by NRF_RADIO->RSSISAMPLE
after enabling the ADDRESS_RSSISTART short. */
int8_t rssi_dbm = hwlqi + ED_RSSIOFFS - 1;
radio_info->rssi = ieee802154_dbm_to_rssi(rssi_dbm);
}
memcpy(buf, &rxbuf[1], pktlen);
}
Expand Down Expand Up @@ -703,7 +706,7 @@
{
(void) dev;
const uint16_t *pan_id = value;
switch(cmd) {

Check warning on line 709 in cpu/nrf52/radio/nrf802154/nrf802154_radio.c

View workflow job for this annotation

GitHub Actions / static-tests

keyword 'switch' not followed by a single space
case IEEE802154_AF_SHORT_ADDR:
memcpy(nrf802154_short_addr, value, IEEE802154_SHORT_ADDRESS_LEN);
break;
Expand All @@ -720,10 +723,10 @@
return 0;
}

static int _config_src_addr_match(ieee802154_dev_t *dev, ieee802154_src_match_t cmd, const void *value)

Check warning on line 726 in cpu/nrf52/radio/nrf802154/nrf802154_radio.c

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
{
(void) dev;
switch(cmd) {

Check warning on line 729 in cpu/nrf52/radio/nrf802154/nrf802154_radio.c

View workflow job for this annotation

GitHub Actions / static-tests

keyword 'switch' not followed by a single space
case IEEE802154_SRC_MATCH_EN:
cfg.pending = *((const bool*) value);
break;
Expand Down
Loading