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

Trying to communicate between NRF24L01+ (TX) and NRF51822 (RX)

Hi

I am trying to establish communication between a NRF24L01+ and an NRF51822, but unable to do so. I am able to communicate between 2 NRF24L01+ and also between 2 NRF51822. I am using the NRF24L01+ to transmit at regular intervals and trying to receive them on NRF51822

I have interfaced the NRF24L01+ with an ARM controller and have not used any of the SDK's for NRF24 but have coded my own.

In the NRF24, I have enabled CRC (8-bit mode) and using the default RX_ADDR_P0 and TX_ADDR (0xE7E7E7E7E7). Some of the configured registers are listed as below:

  • CONFIG: 0x4A
  • ENAA: 0x01
  • ENRXADDR: 0x01
  • SETUPAW: 0x03
  • SETUPRETR: 0x00
  • RFCH: 0x28
  • RFSETUP: 0x07
  • FEATURE: 0x07
  • DYNPD: 0x01
  • RX_ADDR_P0: 0xE7E7E7E7E7
  • TX_ADDR: 0xE7E7E7E7E7

I have set the retransmit count to zero as I don't require an acknowledgement for now. I am transmitting every 1 second. The FIFO buffer is loaded using the W_TX_PAYLOAD_NOACK command (0xB0).

On the NRF51822, I have used the SDK 12.3, esb_low_power_prx example and made some minor modification as follows:

in main.c

#define NRF_ESB_LEGACY

uint32_t esb_init( void )
{
    uint32_t err_code;
    uint8_t base_addr_0[4] = {0xE7, 0xE7, 0xE7, 0xE7};
		uint8_t base_addr_1[4] = {0xC2, 0xC2, 0xC2, 0xC2};
    uint8_t addr_prefix[8] = {0xE7, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8 };

#ifndef NRF_ESB_LEGACY
    nrf_esb_config_t nrf_esb_config         = NRF_ESB_DEFAULT_CONFIG;
#else // NRF_ESB_LEGACY
    nrf_esb_config_t nrf_esb_config         = NRF_ESB_LEGACY_CONFIG;
#endif // NRF_ESB_LEGACY
		nrf_esb_config.protocol									= NRF_ESB_PROTOCOL_ESB_DPL;
		nrf_esb_config.bitrate                  = NRF_ESB_BITRATE_1MBPS;			//MODDED
    nrf_esb_config.mode                     = NRF_ESB_MODE_PRX;
    nrf_esb_config.event_handler            = nrf_esb_event_handler;
		nrf_esb_config.crc											= NRF_ESB_CRC_8BIT;
		nrf_esb_config.selective_auto_ack				=	false;
		nrf_esb_config.retransmit_count					=	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);
    VERIFY_SUCCESS(err_code);
		
//		tx_payload.length = 1;

    return NRF_SUCCESS;
}

int main(void)
{
    uint32_t err_code;
    err_code = logging_init();
    APP_ERROR_CHECK(err_code);
    gpio_init();
    err_code = esb_init();
    APP_ERROR_CHECK(err_code);
    clocks_start();

    NRF_LOG_DEBUG("Enhanced ShockBurst Receiver Example running.\r\n");

    err_code = nrf_esb_start_rx();
    APP_ERROR_CHECK(err_code);

//    tx_payload.data[0] = m_state[0] << 0
//                       | m_state[1] << 1
//                       | m_state[2] << 2
//                       | m_state[3] << 3;
//    err_code = nrf_esb_write_payload(&tx_payload);
//    APP_ERROR_CHECK(err_code);

    while (true)
    {
        if (NRF_LOG_PROCESS() == false)
        {
            power_manage();
        }
    }
}

in nrf_esb.h

#define NRF_ESB_ADDR_DEFAULT                                                    \
{                                                                               \
    .base_addr_p0       = { 0xE7, 0xE7, 0xE7, 0xE7 },                           \
    .base_addr_p1       = { 0xC2, 0xC2, 0xC2, 0xC2 },                           \
    .pipe_prefixes      = { 0xE7, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8 },   \
    .addr_length        = 5,                                                    \
    .num_pipes          = 8,                                                    \
    .rf_channel         = 0x28,                                                    \
    .rx_pipes_enabled   = 0xFF                                                  \
}

But, when I keep a breakpoint in the nrf_esb_event_handler routine, it does not trigger and I don't receive any data.

Can someone guide me with what is wrong in the configuration and help resolve this? Thanks

Parents Reply
  • Arvind123 said:
    The examples are for nRF24LE and nRF24LU, which have  on chip microcontroller, while I have an NRF24L01+ chips which I have connected to an ARM controller using the SPI port. In such a case, these examples cannot be used I guess.

    Internally there is an nRF24L01+ that is controlled through an internal SPI interface, so it should be possible to re-use this. The following application note may also be useful:

    https://www.nordicsemi.com/-/media/DocLib/Other/App_Notes/nAN24-12.zip?la=en  

    Arvind123 said:
    The configurations that I have mentioned in the first post for both NRF24 & NRF51822 are compatible right?

    It seems you have followed the default values, so I can't see any obvious wrong. If you transmit from the nRF24L01+ you should see the VDD_PA pin toggle to ~1.8V for 100-200us during transmission. The pin will stay low during reception (and idle).

Children
No Data
Related