My application currently uses 2 nRF24LE1 for communication. I am porting over one side to the nRF51822. My first step is just trying to send out packets from the nRF51822 to the nRF24LE1. Using the code below, the nRF24LE1 receives only the 4th packet after being power cycled. It doesn't receive any other packet. Note that my application can't use ACK. Any suggestions on what to fix?
UPDATED 9/24/15:
I still can't get reliable communications from the nRF51822->nRF24LE1. I only get the 4th packet sent. After that I don't receive anything until I power-cycle the nRF24LE1. I have been trying different settings but I have been unable to locate the magic combination. Any suggestions?
Note: I do have communications from the nRF24LE1->nRF51822.
nRF51822 transmitter:
nrf_esb_init(NRF_ESB_MODE_PTX); nrf_esb_set_base_address_0(0xA7A7A7A7); nrf_esb_set_base_address_1(0xA7A7A7A7); nrf_esb_set_address_prefix_byte(0, 0xA7); nrf_esb_set_address_prefix_byte(1, 0xA8); nrf_esb_set_address_prefix_byte(2, 0xA9); nrf_esb_set_address_prefix_byte(3, 0xAA); nrf_esb_set_address_prefix_byte(4, 0xAB); nrf_esb_set_address_prefix_byte(5, 0xAC); nrf_esb_set_address_prefix_byte(6, 0xAD); nrf_esb_set_address_prefix_byte(7, 0xAE); nrf_esb_set_datarate(NRF_ESB_DATARATE_1_MBPS); nrf_esb_set_crc_length(NRF_ESB_CRC_OFF); nrf_esb_set_output_power(NRF_ESB_OUTPUT_POWER_0_DBM); nrf_esb_set_base_address_length(NRF_ESB_BASE_ADDRESS_LENGTH_4B); nrf_esb_set_xosc_ctl(NRF_ESB_XOSC_CTL_AUTO); nrf_esb_enable_dyn_ack(); nrf_esb_set_channel(50);
while(true) { // Add packet into TX queue nrf_esb_add_packet_to_tx_fifo(0, mRxBuffer, NRF_ESB_CONST_MAX_PAYLOAD_LENGTH, NRF_ESB_PACKET_NO_ACK); nrf_esb_enable(); nrf_delay_ms(1000); }
nRF24LE1 receiver: uint8_t address[5] = {0xA7, 0xA7, 0xA7, 0xA7, 0xA7}; uint8_t address2[5] = {0xA8, 0xA7, 0xA7, 0xA7, 0xA7};
// Configure radio as primary Reciever (PRX) hal_nrf_set_operation_mode(HAL_NRF_PRX); hal_nrf_set_datarate( HAL_NRF_1MBPS ); hal_nrf_set_output_power( HAL_NRF_0DBM ); hal_nrf_set_auto_retr( 0, 250 ); // turn off the automatic retransmission.
// Set payload width to nRF_PAYLOAD_SIZE bytes // hal_nrf_set_rx_payload_width((int)HAL_NRF_PIPE0, NRF_PAYLOAD_SIZE);
hal_nrf_set_rf_channel( 50 ); hal_nrf_set_address(HAL_NRF_TX, address2); hal_nrf_set_address( HAL_NRF_PIPE0, address ); hal_nrf_setup_dynamic_payload(0xFF); hal_nrf_enable_dynamic_payload(true); hal_nrf_enable_dynamic_ack(true); hal_nrf_enable_ack_payload(false); hal_nrf_set_crc_mode(HAL_NRF_CRC_OFF); hal_nrf_open_pipe(HAL_NRF_PIPE0,false);
// Power up radio hal_nrf_set_power_mode(HAL_NRF_PWR_UP);
while(true) // spin forever { CE_HIGH(); if( !hal_nrf_rx_fifo_empty() ) { hal_nrf_read_rx_payload( rx_payload ); hal_uart_putchar('X'); for (loop=0; loop<32; loop++) { hal_uart_putchar(rx_payload[loop]); } } }