The use of NRF_RADIO->EVENTS_RSSIEND in esb

I use nrf5340 to build esb project, I use the following code to scan rssi of different channels, but I read the value of NRF_RADIO->EVENTS_RSSIEND is 127, I hope you can tell me where the problem is, thank you.

       uint8_t temp_chn = 0;
        while(1)
        {
            temp_chn++;
            esb_stop_rx();
            esb_set_rf_channel(temp_chn % 80);
            esb_start_rx();
            while(!NRF_RADIO->EVENTS_RXREADY);
            NRF_RADIO->TASKS_RSSISTART = 1;
            while(!NRF_RADIO->EVENTS_RSSIEND)
            {
                printk("wait rssi end\r\n");
            };
            
            printk("ch %d %d\r\n", NRF_RADIO->FREQUENCY, NRF_RADIO->RSSISAMPLE);
            NRF_RADIO->EVENTS_RSSIEND = 0;

            k_sleep(K_MSEC(100));
        }

Parents
  • Hi

    Can you let me know what you are trying to do by reading the RSSI? Are you looking for interference on the different RF channels?

    I would not recommend combining the ESB library code with direct radio peripheral access like you are doing here. The ESB library assumes that it has exclusive control of the radio, and will not work properly if you are accessing the NRF_RADIO peripheral on the side. 

    I would recommend either running your RSSI algorithm exclusively when the ESB library is disabled, or extending the ESB implementation to do something similar. At the moment the ESB library is only set up to read the RSSI when a valid packet is received, not when you are just receiving background noise. 

    Best regards
    Torbjørn

Reply
  • Hi

    Can you let me know what you are trying to do by reading the RSSI? Are you looking for interference on the different RF channels?

    I would not recommend combining the ESB library code with direct radio peripheral access like you are doing here. The ESB library assumes that it has exclusive control of the radio, and will not work properly if you are accessing the NRF_RADIO peripheral on the side. 

    I would recommend either running your RSSI algorithm exclusively when the ESB library is disabled, or extending the ESB implementation to do something similar. At the moment the ESB library is only set up to read the RSSI when a valid packet is received, not when you are just receiving background noise. 

    Best regards
    Torbjørn

Children
Related