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

RSSI measurement on a specific channel

Hey all

I'm working on a BLE device using a nRf52840 SOC and for some tests now I've to measure the RSSI on a specific BLE channel (e.g. ch 37). What I've done so far to measure the RSSI is following.

    static uint32_t u32Packet = 0;
    static uint32_t u32RssiSample = 0;

    NRF_RADIO->PACKETPTR = (uint32_t)u32Packet; // set payload pointer

    NRF_RADIO->EVENTS_READY = 0u;           // clear ready event
    NRF_RADIO->TASKS_RXEN = 1u;             // enable radio in RX mode
    while(NRF_RADIO->EVENTS_READY == 0u);   // wait for the radio to be ramped up and ready to be started

    NRF_RADIO->EVENTS_READY = 0u;           // clear ready event
    NRF_RADIO->TASKS_START = 1u;            // start radio
    // TODO while(NRF_RADIO->EVENTS_READY == 0u);   // wait for the radio to be ramped up and ready to be started

    // perform RSSI determination
    NRF_RADIO->EVENTS_RSSIEND = 0u;         // clear rssiend event
    NRF_RADIO->TASKS_RSSISTART = 1u;        // start the RSSI and take one single sample of the receive signal strength
    while(NRF_RADIO->EVENTS_RSSIEND == 0u); // wait for the sampling of the receive signal strength to be completed

    u32RssiSample = NRF_RADIO->RSSISAMPLE;   // take RSSI sample

    NRF_RADIO->TASKS_RSSISTOP = 1u;         // stop RSSI sampling

    NRF_RADIO->TASKS_STOP = 1u;             // stop radio

    NRF_RADIO->EVENTS_DISABLED = 0u;        // clear disabled event
    NRF_RADIO->TASKS_DISABLE = 1u;          // disable the radio
    while(NRF_RADIO->EVENTS_DISABLED == 0u); // wait for the radio to be disabled

This seems to work fine to take a RSSI sample. My question now is, can I and if yes how can I measure the RSSI only on a specific channel?

For the test the device would be in an shielded environment, where only the signal from the test-infrastructure should be received, so I'm also wondering if it even makes sense to measure on a specific channel, if the transmitted signal is only on this specific channel. However if there is a possibility I'd still like to set it up like this.

Any help would be much appreciated

Greetings

Samuel

  • Hi Samuel

    Yes, it should be possible to get the RSSI only from one specific channel, but you would have to implement the logic to do so where you only request the RSSI from I.E. Channel 37 and not theother channels.

    If you check out the DTM example we have as well as the DTM app in nRFConnect for Desktop, you can see that it has handled this in the central application where you either set it to retrieve the RSSI value of either a selected "sweep" of channels or just a single one.

    Best regards,

    Simon

  • Hi Simon

    thank you for your response..

    The DTM example I've already been looking at, however its hard to deceipher what command in the end is provided to the dtm_cmd(...) function.

    I'm not sure if you had a look at the code I've provided in the original question, but there I can nowhere see where to set the channle/frequency. Could you point me a bit to a closer location in the DTM example where to look at?

    My goal is to read the RSSI value of channel 37.

    Another approach I've tried was, using the radio_test example as a basis, but there it seems not to be possible to measure an RSSI value.

    EDIT:

    I've just found out that you can also set the radio frequency like this:

    NRF_RADIO->FREQUENCY = 2400 + 39;

    So in order to measure the RSSI on channel 39, would this do the trick? By setting the frequency before enabling the radio?

  • Please note that the frequency for channels 37, 38, and 39 are not 2437, 2438, and 2439. The BLE system operates on 40 channels from 2402 to 2480 each being 2MHz wide. The advertising channels are strategically placed at these values to avoid interference from each other and other devices operating in the same spectrum.

    I would suggest using the nrf_radio_frequency_set if you'd like to advertise on one specific frequency, but writing straight to the registers should work as well. The frequency for channel 37 would be 2402MHz.

    Best regards,

    Simon

  • What I've seen from the nrf_radio_frequency_set function, it sets the RF_RADIO->FREQUENCY register to a delta value of the provided frequency minus 2400.

    If I provide 2480 for Channel 39 the register is set to 80.

    Would this mean if I want to set the register directly, I'd have to write  the following values to the register to set it to channel  39 or channel 37?


    RF_RADIO->FREQUENCY = 80u; //Channel 39
    RF_RADIO->FREQUENCY = 2u;  //Channel 37

  • Hi

    That depends on your project settings, but by default, nrf_radio_frequency_set is used to set the radio frequency in MHz.

    Best regards,

    Simon

Related