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

ESB communication between nRF24L01 and nRF51

HI, I have a remote control with nRF24L01. It was talking with Gen1(uses nRF24L01) product via ESB. Now, I am developing Gen2 product*using nRF51822xxaa) and I need to support backwards compatibility with the remote control, in other words, I need to make nRF51 to talk with nRF24L01 via ESB. I am able to receive from nRF24L01. But, only when I turn the CRC off. If I make CRC to be the same as nRF24L01(which is 16bit CRC), I am not receiving anything from the remote control. Please help.

This is the init settings for nRF24L01:

hash define RF_CHANNEL  	40 //physical channel frequency MHz (2400+RF_CHANNEL)

hash define RF_POWER_DB		3	//0:-18dBm, 1:- 12dBm, 2:-6dBm, 3:0dBm

hash define RF_ADDR_WIDTH	4 //the address is 4 bytes

hash define RF_RETRANSMITS	6	//auto retransmit

hash define RF_RETRANS_DELAY 750	//wait for the ACK (us)

hash  define BROADCAST_ADDR_BYTE1	0x7E

hash define BROADCAST_ADDR_BYTE2	0x7E

hash define BROADCAST_ADDR_BYTE3	0x7E

hash define BROADCAST_ADDR_BYTE4	0x6E

	// Enable the radio clock
	RFCKEN = 1;

	//close all pipes
	hal_nrf_close_pipe(HAL_NRF_ALL);
addr[RF_ADDR_WIDTH] = {BROADCAST_ADDR_BYTE1, BROADCAST_ADDR_BYTE2, BROADCAST_ADDR_BYTE3, BROADCAST_ADDR_BYTE4};

	hal_nrf_set_address(HAL_NRF_TX, addr); 

	hal_nrf_set_address(HAL_NRF_PIPE0, addr); 

	// Set rf channel 2430
	hal_nrf_set_rf_channel(RF_CHANNEL);
	
	// Set the RF_SETUP register
	hal_nrf_set_output_power(RF_POWER_DB); 
	//hal_nrf_set_datarate(HAL_NRF_1MBPS); //1Mbps data rate 	
	hal_nrf_set_datarate(HAL_NRF_250KBPS);

	// Set CRC16
	hal_nrf_set_crc_mode(HAL_NRF_CRC_16BIT); 	
	
	// Set address width
	hal_nrf_set_address_width(RF_ADDR_WIDTH); 

	// Set auto retries(ARC) and delay(ARD, us)
	hal_nrf_set_auto_retr(RF_RETRANSMITS, RF_RETRANS_DELAY);

	// Enable payload with ack and Dynamic payload length
	hal_nrf_activate_features(); //this chip does not need activate, so the func is empty
	hal_nrf_enable_ack_payload(true);
	hal_nrf_enable_dynamic_payload(true);	 //dynamic payload length
	
	// Enable Pipe0 Dynamic payload length 
	hal_nrf_setup_dynamic_payload(0x01);

	// Enable pipe0 with auto ack
	hal_nrf_open_pipe(HAL_NRF_PIPE0, true);

	// Set rx payload width to the number of bytes expected
	hal_nrf_set_rx_payload_width(HAL_NRF_PIPE0, RF_PAYLOAD_LENGTH);
	
	// Flush tx and rx fifo
	hal_nrf_flush_rx();
	hal_nrf_flush_tx();	 	
	
	
	// Configure radio as PTX  
	hal_nrf_set_operation_mode(HAL_NRF_PTX);

	// Power up radio
	hal_nrf_set_power_mode(HAL_NRF_PWR_UP);

	ptx_check_ack.enable = false;


**This is the init settings for nRF51822xxaa:**

    (void)nrf_esb_init(NRF_ESB_MODE_PRX);
		
nrf_esb_set_crc_length(NRF_ESB_CRC_LENGTH_2_BYTE);

nrf_esb_set_datarate(NRF_ESB_DATARATE_250_KBPS);

nrf_esb_set_retransmit_delay(2750);

nrf_esb_set_base_address_length(NRF_ESB_BASE_ADDRESS_LENGTH_4B);

nrf_esb_set_address_prefix_byte(0, 0x7e);

nrf_esb_set_base_address_0(0x006e7e7e);

 nrf_esb_set_channel(40);

    // Load data into TX queue
 my_tx_payload[0] = 0xEF;

    (void)nrf_esb_add_packet_to_tx_fifo(PIPE_NUMBER, my_tx_payload, TX_PAYLOAD_LENGTH, NRF_ESB_PACKET_USE_ACK);

    (void)nrf_esb_add_packet_to_tx_fifo(PIPE_NUMBER, my_tx_payload, TX_PAYLOAD_LENGTH, NRF_ESB_PACKET_USE_ACK);

    (void)nrf_esb_add_packet_to_tx_fifo(PIPE_NUMBER, my_tx_payload, TX_PAYLOAD_LENGTH, NRF_ESB_PACKET_USE_ACK);

    
    // Enable ESB to start receiving
    (void)nrf_esb_enable();
Parents Reply Children
No Data
Related