I'm using an nRF52 (PRX) to communicate with with an nRF24L01+ (PTX) using ESB. As part of a pairing routine they need to switch channel and addresses. I've confirmed that the nRF52 is receiving the correct frequency and address, but it still fails to change over correctly. It will work sometimes, but seemingly at random.
Could I get a quick code snippet showing how to properly change address and channel when the nRF52 is currently communicating? My current code looks like this
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
nrf_esb_disable();
tx_payload.length = 32;
uint32_t err_code;
nrf_esb_config_t nrf_esb_config = NRF_ESB_LEGACY_CONFIG;
nrf_esb_config.payload_length = 32;
nrf_esb_config.protocol = NRF_ESB_PROTOCOL_ESB_DPL;
nrf_esb_config.bitrate = NRF_ESB_BITRATE_2MBPS;
nrf_esb_config.crc = NRF_ESB_CRC_16BIT;
nrf_esb_config.mode = NRF_ESB_MODE_PRX;
nrf_esb_config.event_handler = nrf_esb_event_handler;
nrf_esb_config.selective_auto_ack = false;
err_code = nrf_esb_init(&nrf_esb_config);
VERIFY_SUCCESS(err_code);
nrf_esb_stop_rx();
while(!nrf_esb_is_idle());
//Set frequency
err_code = nrf_esb_set_rf_channel(freq);