This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

See RSSI values for all 3 advertising channels like on nRF Sniffer

When I use the nRF Sniffer on a 52840 or 52832 with Wireshark I can see the RSSI values for each advertising message for all 3 channels (37, 38, 39).
So for each advertising message I have all 3 RSSI values.

Now when I program a scanner on the 52840 DK with the S140 soft device, I get only 1 RSSI value for each advertising message.

How can I get all three RSSI values for each single advertising message received?

  • Try this in ble_evt_handler():

    static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
    {
        blahblah
        ble_gap_evt_t const * p_gap_evt = &p_ble_evt->evt.gap_evt;
        static int8_t   rssi_value = 0;
        switch (p_ble_evt->header.evt_id)
        {
        blahblah
           case BLE_GAP_EVT_RSSI_CHANGED:
                rssi_value =  p_gap_evt->params.rssi_changed.rssi;
                int16_t channel_rssi =  p_gap_evt->params.rssi_changed.ch_index;
                NRF_LOG_INFO("RSSI changed, new: %d, channel: %d",rssi_value, channel_rssi);
                NRF_LOG_INFO(";%d;%d;%d",rssi_value, channel_rssi, p_gap_evt->params.adv_report.tx_power);
                break;
        }
    

    I use this (although my own processing not NRF_LOG) and it works well. channel_rssi is the channel id; I just log all values when received in an array index by channel_rssi.

  • Hi,

    I checked your proposal but as far as I can see in the documentation this does only apply for connections on channel 0...36. Not for advertising on channel 37, 38 and 39.
    I also implemented the code inside my ble_evt_handler() and it's never going to this case.

  • Hi,

    You can get both the channel and RSSI from the ble_gap_evt_adv_report_t struct. I added this in the nrf_ble_scan_on_adv_report in the nrf_scan module to view info from all advertising packets, but you can use similar directly in BLE_GAP_EVT_ADV_REPORT event if you do not use the scanning library:

    NRF_LOG_INFO("CH: %d, RSSI: %d", p_adv_report->ch_index, p_adv_report->rssi);

    Typically the scanner will only receive the advertising packet on one channel per advertising interval. The scanner will change the scanning channel each scan window (given that the channel mask is set to scan on multiple/all channels).

    Best regards,
    Jørgen

  • Hi Jørgen,

    thanks for your answer. But my issue is that

    Typically the scanner will only receive the advertising packet on one channel per advertising interval

    This is the case if I use the S140 or S132 soft device. But I know with the nRF Sniffer firmware I can see all thrree channels / RSSI values for each single advertising.
    But I don't know how it's done because the source code for the sniffer is not available to check.

    Best regards,
    Ludger

  • The nRF Sniffer uses a custom firmware that controls the RADIO peripheral directly, it does not use any softdevice. Most likely it switches the channel rapidly in order to receive most advertising packets on all channels.

Related