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