I want to get 32000 bytes per second with NRF24LU1+ ,as my audio sampling rate is 16K and sampling bits is 16.But actually I have lost one packet or more per 10ms.data loss.png.
Some codes is shown below:
NRF24LU1+:
hal_nrf_set_rf_channel(0x32);
hal_nrf_set_datarate(HAL_NRF_2MBPS);
hal_nrf_set_crc_mode(HAL_NRF_CRC_16BIT); // CRC:16bits
hal_nrf_set_address(HAL_NRF_PIPE0,RX_ADDRESS);
hal_nrf_open_pipe(HAL_NRF_PIPE0,true);
// Configure radio as primary receiver (PRX)
hal_nrf_set_operation_mode(HAL_NRF_PRX);
// Set payload width to 1 bytes
hal_nrf_set_rx_payload_width((int)HAL_NRF_PIPE0, 32);
// Power up radio
hal_nrf_set_power_mode(HAL_NRF_PWR_UP);
NRF52832:
nrf_esb_config_t nrf_esb_config = NRF_ESB_DEFAULT_CONFIG;
nrf_esb_config.payload_length = 32;
nrf_esb_config.protocol = NRF_ESB_PROTOCOL_ESB;//_DPL;
nrf_esb_config.bitrate = RADIO_MODE_MODE_Nrf_2Mbit;
nrf_esb_config.mode = NRF_ESB_MODE_PTX;
nrf_esb_config.event_handler = nrf_esb_event_handler;
nrf_esb_config.selective_auto_ack = false;
nrf_esb_config.retransmit_count=1;
nrf_esb_config.retransmit_delay=0;
err_code = nrf_esb_init(&nrf_esb_config);
VERIFY_SUCCESS(err_code);
err_code = nrf_esb_set_base_address_0(base_addr_0);
VERIFY_SUCCESS(err_code);
err_code = nrf_esb_set_base_address_1(base_addr_1);
VERIFY_SUCCESS(err_code);
err_code = nrf_esb_set_prefixes(addr_prefix, 8);
MAIN.C:
for(num=0;num<100;num++)
{
for(num1=0;num1<16;)
{
tx_payload.data[2*num1]=0;
tx_payload.data[2*num1+1]=0;
num1=num1+1;
tx_payload.noack = false;
nrf_esb_write_payload(&tx_payload);
nrf_delay_us(800);
}
}
Could you give me some advice?