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

nrf24L01 only received packets on second tx packet from nrf52

We configured nrf24LE1 as PRX and nrf52 as PTX and the packet sent out every seconds.

The nrf24LE1 will only received the packets every twice packet sent out and both packet will received at the same time.

This only happen when configured to noack, no issue on ack, ack with payload and nrf52->nrf24LE1.

Chip version: nrf24LE1: NRF C 24LE1D 1129AA nrf52: nrf52832 QFAABA 1542AB

The code as below: nrf24LE1:

hal_nrf_close_pipe(HAL_NRF_ALL);
 hal_nrf_open_pipe (HAL_NRF_ALL, true);
 hal_nrf_enable_ack_payload(false);
 hal_nrf_enable_dynamic_payload(true);
 hal_nrf_setup_dynamic_payload(HAL_NRF_ALL); 
 hal_nrf_enable_dynamic_ack(true);
 hal_nrf_set_auto_retr(0,0); 
 hal_nrf_set_crc_mode(HAL_NRF_CRC_16BIT);
 hal_nrf_set_datarate(HAL_NRF_1MBPS);

//Change Channel
 hal_nrf_set_rf_channel(23); 
 
 // Configure The TX_ADDR
 SYS.HS_ADDRESS[0] = PREFIX_TX;
 SYS.HS_ADDRESS[1] = BASE_TX_A0;
 SYS.HS_ADDRESS[2] = BASE_TX_A1;
 SYS.HS_ADDRESS[3] = BASE_TX_A2;
 SYS.HS_ADDRESS[4] = BASE_TX_A3;
 hal_nrf_set_address(HAL_NRF_TX, SYS.HS_ADDRESS); //TX Address

 // Configure The RX_ADDR_P0
 SYS.HS_ADDRESS[0] = PREFIX_RX;
 SYS.HS_ADDRESS[1] = BASE_RX_A0;
 SYS.HS_ADDRESS[2] = BASE_RX_A1;
 SYS.HS_ADDRESS[3] = BASE_RX_A2;
 SYS.HS_ADDRESS[4] = BASE_RX_A3;
 hal_nrf_set_address(HAL_NRF_PIPE0, SYS.HS_ADDRESS); //RX Address  
 
 //Set Rx Payload Length to 32
 hal_nrf_set_rx_payload_width((int)HAL_NRF_PIPE0, 32);

nrf52:

uint8_t base_addr_0[4] = {0x9F, 0x94, 0x36, 0x58};
 uint8_t base_addr_1[4] = {0x9F, 0x94, 0x36, 0x58};
 uint8_t addr_prefix[8] = {0xE1, 0xE2, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7 };
 nrf_esb_config_t nrf_esb_config         = NRF_ESB_DEFAULT_CONFIG;
 nrf_esb_config.bitrate                  = NRF_ESB_BITRATE_1MBPS;
 nrf_esb_config.payload_length           = 32;
 nrf_esb_config.mode                     = NRF_ESB_MODE_PTX;
 nrf_esb_config.event_handler            = nrf_esb_event_handler;
 nrf_esb_config.retransmit_delay         = 0;
 nrf_esb_config.retransmit_count         = 0;
 nrf_esb_config.selective_auto_ack       = true;

 nrf_esb_init(&nrf_esb_config);

 nrf_esb_set_base_address_0(base_addr_0);

 nrf_esb_set_base_address_1(base_addr_1);

 nrf_esb_set_prefixes(addr_prefix, 8);

 nrf_esb_set_rf_channel(23UL);


uint32_t nrf_esb_write_payload_with_noack(uint8_t *payload, int length)
{
 esb_tx_payload_main.pipe = 0;
 esb_tx_payload_main.length = length;
 esb_tx_payload_main.noack = true;

 memcpy(esb_tx_payload_main.data, payload, length);

 return nrf_esb_write_payload(&esb_tx_payload_main);
}
Parents Reply Children
No Data
Related