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

How can I tell that a Bluetooth channel is busy

Hi,

I'm using nRf52832 with SoftDevice S132 V3.0. 

I found that I can exclude a bluetooth channel from the map by function sd_ble_opt_set.

But how can I tell that a channel is busy and need to be excluded?  Is there a way to find that data are lost or corrupted during transmission?

Parents
  • I wonder, would it be possible to request a timeslot (devzone.nordicsemi.com/.../setting-up-the-timeslot-api) from the softdevice, so that the radio can be accessed from the application, and then perform a channel measurement manually? Set channel, and then repeat a rssi measurement a few times, to calculate an average signal strength on the channel. And then exit the time slot.

    // Set up radio for scanning
    	// Make sure the radio is powered on
    	NRF_RADIO->POWER = 1;
    	// Make sure the radio is not doing an RSSI measurement at the moment
    	NRF_RADIO->EVENTS_RSSIEND = 0;
    	// Flush Cache 
    	__DSB();
    	// Reception must be enabled in order to measure RSSI
        NRF_RADIO->TASKS_RXEN = 1;  
        NRF_RADIO->TASKS_START = 1;
        while(NRF_RADIO->EVENTS_READY == 0);
        NRF_RADIO->EVENTS_END = 0;
        __DSB();
        
    // Scan
        int rssi = 0;
        for (int i = 0 ; i < NR_OF_SAMPLES; i++) {
            // Set radio channel
            NRF_RADIO->FREQUENCY = channel;
            // Start RSSI measurement
            NRF_RADIO->TASKS_RSSISTART = 1;
            __DSB();
            // Wait for measurement to finish
            while (!NRF_RADIO->EVENTS_RSSIEND);
            // Accumulate results 
            // N.B. NRF_RADIO->RSSISAMPLE contains positive values. Eg 20 means -20dB
            rssi += NRF_RADIO->RSSISAMPLE;
        }

    Then if the average rssi is too high (N.B. the lower the value, the higher the signal), exclude it.  One thing you need to keep in mind is that the bluetooth channels don't map one-to-one to radio channels.

  • Good idea. That may actually work yes.

    Best regards,
    Kenneth

Reply Children
No Data
Related