nRF24L01 communication loss problem

The chip I am using is the nRF24L01.

Not the nRF24L01P.

One module is Rx-receiver and two modules are Tx-transmitter.

The test is carried out with one Rx module and one Tx module.

On the Tx-transmitter, Rx-receiver, the antenna is drawn in a pattern.

It is the same pattern antenna used for 2.4GHz Bluetooth communication in the past.

The circuit was referenced in the data sheet.

Transmitter and receiver are operating within 1m.

Tx-transmitter transmits 32byte data at 250Hz cycle.

The Rx-receiver is receiving well, but communication is not possible at a certain location and angle.

When communication is not possible, put an aluminum cooking foil near the transmitter or receiver to establish communication again.

The register settings are as follows.

Rx-receiver Tx-transmitter

void nRF24_Init(void)
{
    // Write to registers their initial values
    nRF24_WriteReg(nRF24_REG_CONFIG, 0x08);
    nRF24_WriteReg(nRF24_REG_EN_AA, 0x3F);
    nRF24_WriteReg(nRF24_REG_EN_RXADDR, 0x3F);
    nRF24_WriteReg(nRF24_REG_SETUP_AW, 0x03);
    nRF24_WriteReg(nRF24_REG_SETUP_RETR, 0x03);
    nRF24_WriteReg(nRF24_REG_RF_CH, 0x02);

    nRF24_WriteReg(nRF24_REG_RF_SETUP, 0x0F);

    nRF24_WriteReg(nRF24_REG_STATUS, 0x00);
    nRF24_WriteReg(nRF24_REG_RX_PW_P0, 0x00);
    nRF24_WriteReg(nRF24_REG_RX_PW_P1, 0x00);
    nRF24_WriteReg(nRF24_REG_RX_PW_P2, 0x00);
    nRF24_WriteReg(nRF24_REG_RX_PW_P3, 0x00);
    nRF24_WriteReg(nRF24_REG_RX_PW_P4, 0x00);
    nRF24_WriteReg(nRF24_REG_RX_PW_P5, 0x00);

    nRF24_WriteReg(nRF24_CMD_ACTIVATE, 0x73);

    nRF24_WriteReg(nRF24_REG_DYNPD, 0x00);
    nRF24_WriteReg(nRF24_REG_FEATURE, 0x00);
    // Clear the FIFO's
    nRF24_FlushRX();
    nRF24_FlushTX();
    // Clear any pending interrupt flags
    nRF24_ClearIRQFlags();
    // Deassert CSN pin (chip release)
    nRF24_CSN_H();
}

///////////////// Initialize nRF ////////////////////////////////////
// RX/TX disabled
    nRF24_CE_L();

// Initialize the nRF24L01 to its default state
    nRF24_Init();

// Set RF channel
    nRF24_SetRFChannel(40);

// Set data rate
    nRF24_SetDataRate(nRF24_DR_2Mbps);

// Set CRC scheme
    nRF24_SetCRCScheme(nRF24_CRC_2byte);

// Set address width, its common for all pipes (RX and TX)
    nRF24_SetAddrWidth(3);

// Configure RX PIPE1
    static const uint8_t nRF24_ADDR1[] = { 'N', 'd', '1' };

// program address for pipe
    nRF24_SetAddr(nRF24_PIPE1, nRF24_ADDR1); 

// Auto-ACK: enabled, payload length: 32 bytes
    nRF24_SetRXPipe(nRF24_PIPE1, nRF24_AA_ON, 32);

// Configure RX PIPE2
    static const uint8_t nRF24_ADDR2[] = { '2' };

// program address for pipe
    nRF24_SetAddr(nRF24_PIPE2, nRF24_ADDR2); 

// Auto-ACK: enabled, payload length: 32 bytes
    nRF24_SetRXPipe(nRF24_PIPE2, nRF24_AA_ON, 32); 

// Set TX power for Auto-ACK
// (maximum, to ensure that transmitter will hear ACK reply)

    nRF24_SetTXPower(nRF24_TXPWR_0dBm);

// Set operational mode (PRX == receiver)
    nRF24_SetOperationalMode(nRF24_MODE_RX);

// Clear any pending IRQ flags
    nRF24_ClearIRQFlags();

// Wake the transceiver
    nRF24_SetPowerMode(nRF24_PWR_UP);

// Enable DPL
    nRF24_SetDynamicPayloadLength(nRF24_DPL_ON);
    nRF24_SetPayloadWithAck(1);

// Put the transceiver to the RX mode
    nRF24_CE_H();

void nRF24_Init(void)
{
   // Write to registers their initial values
   nRF24_WriteReg(nRF24_REG_CONFIG, 0x08);
   nRF24_WriteReg(nRF24_REG_EN_AA, 0x3F);
   nRF24_WriteReg(nRF24_REG_EN_RXADDR, 0x03);
   nRF24_WriteReg(nRF24_REG_SETUP_AW, 0x03);
   nRF24_WriteReg(nRF24_REG_SETUP_RETR, 0x03);
   nRF24_WriteReg(nRF24_REG_RF_CH, 0x02);

   nRF24_WriteReg(nRF24_REG_RF_SETUP, 0x0E);

   nRF24_WriteReg(nRF24_REG_STATUS, 0x00);
   nRF24_WriteReg(nRF24_REG_RX_PW_P0, 0x00);
   nRF24_WriteReg(nRF24_REG_RX_PW_P1, 0x00);
   nRF24_WriteReg(nRF24_REG_RX_PW_P2, 0x00);
   nRF24_WriteReg(nRF24_REG_RX_PW_P3, 0x00);
   nRF24_WriteReg(nRF24_REG_RX_PW_P4, 0x00);
   nRF24_WriteReg(nRF24_REG_RX_PW_P5, 0x00);

   nRF24_WriteReg(nRF24_CMD_ACTIVATE, 0x73); 

   nRF24_WriteReg(nRF24_REG_DYNPD, 0x00);
   nRF24_WriteReg(nRF24_REG_FEATURE, 0x00);

   // Clear the FIFO's
   nRF24_FlushRX();
   nRF24_FlushTX();

   // Clear any pending interrupt flags
   nRF24_ClearIRQFlags();

   // Deassert CSN pin (chip release)
   nRF24_CSN_H();
}

// Initialize the nRF24L01 to its default state
   nRF24_Init();

// Set RF channel
   nRF24_SetRFChannel(40);

// Set data rate
   nRF24_SetDataRate(nRF24_DR_2Mbps);

// Set CRC scheme
   nRF24_SetCRCScheme(nRF24_CRC_2byte);

// Set address width, its common for all pipes (RX and TX)
   nRF24_SetAddrWidth(3);

// Configure TX PIPE
   static const uint8_t nRF24_ADDR[] = { 'N', 'd', '1' };

// program TX address
   nRF24_SetAddr(nRF24_PIPETX, nRF24_ADDR);

// program address for pipe#0, must be same as TX (for Auto-ACK)
   nRF24_SetAddr(nRF24_PIPE0, nRF24_ADDR); 

// Set TX power (maximum)
   nRF24_SetTXPower(nRF24_TXPWR_0dBm);

// Configure auto retransmit: 0 retransmissions with pause of 2500s in between
   nRF24_SetAutoRetr(nRF24_ARD_2500us, 0);

// Enable Auto-ACK for pipe#0 (for ACK packets)
   nRF24_EnableAA(nRF24_PIPE0);

// Set operational mode (PTX == transmitter)
   nRF24_SetOperationalMode(nRF24_MODE_TX);

// Clear any pending IRQ flags
   nRF24_ClearIRQFlags();

// Enable DPL
   nRF24_SetDynamicPayloadLength(nRF24_DPL_ON);
   nRF24_SetPayloadWithAck(1);

// Wake the transceiver
   nRF24_SetPowerMode(nRF24_PWR_UP);

  1. Is this problem due to the antenna?
    If the distance between Tx and Rx is less than 1m, will it be affected by the antenna?

  2. Is there anything I need to change in the above settings?

  3. Is there a function to automatically change the channel in an area where RF 2.4GHz communication is not available in the nRF24L01 chip?

Related