This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

want nrf24l01 communication with nrf51822

hello,will you please tell me which code i have to use in the sdk 12.2.0 for rf communication with nrf51822 and nrf24l01 .and also tell me which settings i have to do for nrf24l01 side as a transmitter.so that i can receive data on nrf51822 side.

Parents
  • Hi Pallavi

    The ESB library in the nRF5 SDK v12.2.0 is designed to be backwards compatible with the nRF24L01/nRF24L01+, assuming you don't use the L01 device in legacy Shockburst mode (ACK's disabled).

    On the nRF5 side you can use the esb_ptx and esb_prx examples as a starting point: \nRF5_SDK_12.2.0\examples\proprietary_rf\

    For this to work you need the following settings on the nRF24L01 side:
    Default address (0xE7E7E7E7E7), with 5 byte address length
    16-bit CRC
    2Mbps bitrate
    Auto ACK and dynamic payload length enabled

    For all other settings you can use the default values.

    Edit: Added attachment.

    Best regards
    Torbjørn

  • Hello sir,

    Print details for the following Receiver Code :

        #include <SPI.h>
        #include "printf.h"
    
        #include <nRF24L01.h>
        #include <RF24.h>
    #define CE 18
    #define CSN 19
    RF24 radio(CE, CSN);
    unsigned char values;
    const byte rxAddr[5] = {0xC0,0x01,0x23,0x45,0x67};
    
    void setup()
    {
      Serial.begin(9600);
      printf_begin();
      radio.begin();
      radio.setPALevel(RF24_PA_MAX);
      radio.setDataRate(RF24_1MBPS);
      radio.setChannel(7);
      radio.openReadingPipe(0, rxAddr);
      radio.startListening();
    }
    
    void loop()
    {
      if (radio.available())
      {
        char text;
        radio.read(&text, 1);
        Serial.print("####### Data Received :");
        Serial.print(text);
        Serial.println(" #######");
        radio.printDetails() ;
      }
    }
    

    Receiver Prints:

    ####### Data Received :A #######
    STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1	 = 0x67452301c0 0xc2c2c2c2c2
    RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
    TX_ADDR		 = 0xe7e7e7e7e7
    RX_PW_P0-6	 = 0x01 0x00 0x00 0x00 0x00 0x00
    EN_AA		 = 0x3f
    EN_RXADDR	 = 0x03
    RF_CH		 = 0x07
    RF_SETUP	 = 0x07
    CONFIG		 = 0x0f
    DYNPD/FEATURE	 = 0x00 0x00
    Data Rate	 = 1MBPS
    Model		 = nRF24L01+
    CRC Length	 = 16 bits
    PA Power	 = PA_MAX
    ####### Data Received :A #######
    STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1	 = 0x67452301c0 0xc2c2c2c2c2
    RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
    TX_ADDR		 = 0xe7e7e7e7e7
    RX_PW_P0-6	 = 0x01 0x00 0x00 0x00 0x00 0x00
    EN_AA		 = 0x3f
    EN_RXADDR	 = 0x03
    RF_CH		 = 0x07
    RF_SETUP	 = 0x07
    CONFIG		 = 0x0f
    DYNPD/FEATURE	 = 0x00 0x00
    Data Rate	 = 1MBPS
    Model		 = nRF24L01+
    CRC Length	 = 16 bits
    PA Power	 = PA_MAX
    

    Transmitter Code:

     #include <SPI.h>
        #include "printf.h"
    
        #include <nRF24L01.h>
        #include <RF24.h>
        #define CE 18
        #define CSN 19
        RF24 radio(CE, CSN);
        char values;
        const byte rxAddr[5] = {0xC0,0x01,0x23,0x45,0x67};
    
        void setup()
        {
          Serial.begin(9600);
          printf_begin();
          radio.begin();
          radio.setPALevel(RF24_PA_MAX);
          radio.setDataRate(RF24_1MBPS);
          radio.setChannel(7);
          radio.openWritingPipe(rxAddr);
          radio.stopListening();
    
        }
    
    void loop()
    {
      values = 'A';
             radio.write(&values,1);
             Serial.print("####### Data Transmitted :");
        Serial.print(values);
        Serial.println(" #######");
             radio.printDetails() ;
             delay(2000);
          }
    

    Transmitter Prints:

    ####### Data Transmitted :A #######
    STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1	 = 0x67452301c0 0xc2c2c2c2c2
    RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
    TX_ADDR		 = 0x67452301c0
    RX_PW_P0-6	 = 0x01 0x00 0x00 0x00 0x00 0x00
    EN_AA		 = 0x3f
    EN_RXADDR	 = 0x03
    RF_CH		 = 0x07
    RF_SETUP	 = 0x07
    CONFIG		 = 0x0e
    DYNPD/FEATURE	 = 0x00 0x00
    Data Rate	 = 1MBPS
    Model		 = nRF24L01+
    CRC Length	 = 16 bits
    PA Power	 = PA_MAX
    ####### Data Transmitted :A #######
    STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1	 = 0x67452301c0 0xc2c2c2c2c2
    RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
    TX_ADDR		 = 0x67452301c0
    RX_PW_P0-6	 = 0x01 0x00 0x00 0x00 0x00 0x00
    EN_AA		 = 0x3f
    EN_RXADDR	 = 0x03
    RF_CH		 = 0x07
    RF_SETUP	 = 0x07
    CONFIG		 = 0x0e
    DYNPD/FEATURE	 = 0x00 0x00
    Data Rate	 = 1MBPS
    Model		 = nRF24L01+
    CRC Length	 = 16 bits
    PA Power	 = PA_MAX
    

    Hope this will help, sir please help i am unable to communicate with nrf51 for along.

    Thanks and Regards Pallavi

Reply
  • Hello sir,

    Print details for the following Receiver Code :

        #include <SPI.h>
        #include "printf.h"
    
        #include <nRF24L01.h>
        #include <RF24.h>
    #define CE 18
    #define CSN 19
    RF24 radio(CE, CSN);
    unsigned char values;
    const byte rxAddr[5] = {0xC0,0x01,0x23,0x45,0x67};
    
    void setup()
    {
      Serial.begin(9600);
      printf_begin();
      radio.begin();
      radio.setPALevel(RF24_PA_MAX);
      radio.setDataRate(RF24_1MBPS);
      radio.setChannel(7);
      radio.openReadingPipe(0, rxAddr);
      radio.startListening();
    }
    
    void loop()
    {
      if (radio.available())
      {
        char text;
        radio.read(&text, 1);
        Serial.print("####### Data Received :");
        Serial.print(text);
        Serial.println(" #######");
        radio.printDetails() ;
      }
    }
    

    Receiver Prints:

    ####### Data Received :A #######
    STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1	 = 0x67452301c0 0xc2c2c2c2c2
    RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
    TX_ADDR		 = 0xe7e7e7e7e7
    RX_PW_P0-6	 = 0x01 0x00 0x00 0x00 0x00 0x00
    EN_AA		 = 0x3f
    EN_RXADDR	 = 0x03
    RF_CH		 = 0x07
    RF_SETUP	 = 0x07
    CONFIG		 = 0x0f
    DYNPD/FEATURE	 = 0x00 0x00
    Data Rate	 = 1MBPS
    Model		 = nRF24L01+
    CRC Length	 = 16 bits
    PA Power	 = PA_MAX
    ####### Data Received :A #######
    STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1	 = 0x67452301c0 0xc2c2c2c2c2
    RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
    TX_ADDR		 = 0xe7e7e7e7e7
    RX_PW_P0-6	 = 0x01 0x00 0x00 0x00 0x00 0x00
    EN_AA		 = 0x3f
    EN_RXADDR	 = 0x03
    RF_CH		 = 0x07
    RF_SETUP	 = 0x07
    CONFIG		 = 0x0f
    DYNPD/FEATURE	 = 0x00 0x00
    Data Rate	 = 1MBPS
    Model		 = nRF24L01+
    CRC Length	 = 16 bits
    PA Power	 = PA_MAX
    

    Transmitter Code:

     #include <SPI.h>
        #include "printf.h"
    
        #include <nRF24L01.h>
        #include <RF24.h>
        #define CE 18
        #define CSN 19
        RF24 radio(CE, CSN);
        char values;
        const byte rxAddr[5] = {0xC0,0x01,0x23,0x45,0x67};
    
        void setup()
        {
          Serial.begin(9600);
          printf_begin();
          radio.begin();
          radio.setPALevel(RF24_PA_MAX);
          radio.setDataRate(RF24_1MBPS);
          radio.setChannel(7);
          radio.openWritingPipe(rxAddr);
          radio.stopListening();
    
        }
    
    void loop()
    {
      values = 'A';
             radio.write(&values,1);
             Serial.print("####### Data Transmitted :");
        Serial.print(values);
        Serial.println(" #######");
             radio.printDetails() ;
             delay(2000);
          }
    

    Transmitter Prints:

    ####### Data Transmitted :A #######
    STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1	 = 0x67452301c0 0xc2c2c2c2c2
    RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
    TX_ADDR		 = 0x67452301c0
    RX_PW_P0-6	 = 0x01 0x00 0x00 0x00 0x00 0x00
    EN_AA		 = 0x3f
    EN_RXADDR	 = 0x03
    RF_CH		 = 0x07
    RF_SETUP	 = 0x07
    CONFIG		 = 0x0e
    DYNPD/FEATURE	 = 0x00 0x00
    Data Rate	 = 1MBPS
    Model		 = nRF24L01+
    CRC Length	 = 16 bits
    PA Power	 = PA_MAX
    ####### Data Transmitted :A #######
    STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
    RX_ADDR_P0-1	 = 0x67452301c0 0xc2c2c2c2c2
    RX_ADDR_P2-5	 = 0xc3 0xc4 0xc5 0xc6
    TX_ADDR		 = 0x67452301c0
    RX_PW_P0-6	 = 0x01 0x00 0x00 0x00 0x00 0x00
    EN_AA		 = 0x3f
    EN_RXADDR	 = 0x03
    RF_CH		 = 0x07
    RF_SETUP	 = 0x07
    CONFIG		 = 0x0e
    DYNPD/FEATURE	 = 0x00 0x00
    Data Rate	 = 1MBPS
    Model		 = nRF24L01+
    CRC Length	 = 16 bits
    PA Power	 = PA_MAX
    

    Hope this will help, sir please help i am unable to communicate with nrf51 for along.

    Thanks and Regards Pallavi

Children
No Data
Related