As well know, there have 100 channels in ESB function in nRF52832, but 2.4GHz also share with Wifi and Bluetooth.
So there have many noise if I choice wrong channel.
How can I detect the RF noise in each channel and choice the best one?
While the radio can be configured to use 100 different channels, you should stick to channels 0-83 in order to ensure you meet ETSI and FCC requirements (1-82 if you use 2Mbps modulation).
It is possible to read the current RSSI state on any RF channel when you are in receive mode, which can give you an estimate off the amount of noise on that channel at a specific point in time, but this is not handled automatically by the ESB library. You would have to add some additional code to enable RSSI manually when the radio is in receive mode, as described in the product specification.
An alternative method to avoid bad channels is to look at the number of lost packet (when you don't receive an ACK). As long as you get an ACK on a certain channel you can assume that the link quality is good enough, but if you see that you lose a lot of packets then you could try to change to a different RF frequency to see if the link quality improves.
Thank you for your description.
Would you please give me the sample code to detect the environment noise?
Do you have any comment of this issue?
Would you please give me some sample code?
Sorry for the late reply, I have been on vacation for the last two weeks.
To make an RSSI measurement when you are already in RX mode all you have to do is the following:
1. Start the RSSI sampling:
NRF_RADIO->TASKS_RSSISTART = 1;
2. Wait for the RSSIEND event to occur, either by enabling an interrupt on this event or by looping over the event register:
while(NRF_RADIO->EVENTS_RSSIEND == 0);// END event occured, proceed after this
3. Read the RSSI value from the RSSISAMPLE register:
int8_t rssi_reading = NRF_RADIO->RSSISAMPLE;
You might have to do multiple readings for each channel, and sample over all the channels, to get a better understanding of the noise on the channel. This we don't have any examples of unfortunately.