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,

    My intention is to run a simple transmitter and receiver between NRF51822 and Arduino Uno +NRF24L01.

    Please see below working code for a Transmitter and Receiver both using Arduino Uno + NRF24L01 Library for NRF24L01 (http://tmrh20.github.io/RF24/)

    Pin Configuration: NRF24 Arduino 1 GND GND 2 VCC VCC 3 CE Analog 4 4 CSN Analog 5 5 SCK digIO 13 6 MOSI digIO 11 7 MISO digIO 12

    Transmitter Code with its Configurations

        #include <SPI.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);
          radio.begin();
          radio.setPALevel(RF24_PA_MAX);
          radio.setDataRate(RF24_1MBPS);
          radio.setChannel(7);
          radio.openWritingPipe(rxAddr);
          radio.stopListening();
        
        }
    
    void loop()
    {
             values = 0x10;
             radio.write(&values,1);
             delay(2000);
          //  Serial.print(value);  //prints the character just read
     }
    

    Receiver Code with its Configurations

    #include <SPI.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);
      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(text);
      }
    }
    

    Please suggest whats should i do with respect to NRF51822 to work with these transmitter and receiver code respectively. We have been discussing all for so long but haven't come to a conclusion. So can you help me in code with simple configuration mentioned in the code above and run transmitter and receiver successfully.

    Regards Pallavi

Reply
  • Hello Sir,

    My intention is to run a simple transmitter and receiver between NRF51822 and Arduino Uno +NRF24L01.

    Please see below working code for a Transmitter and Receiver both using Arduino Uno + NRF24L01 Library for NRF24L01 (http://tmrh20.github.io/RF24/)

    Pin Configuration: NRF24 Arduino 1 GND GND 2 VCC VCC 3 CE Analog 4 4 CSN Analog 5 5 SCK digIO 13 6 MOSI digIO 11 7 MISO digIO 12

    Transmitter Code with its Configurations

        #include <SPI.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);
          radio.begin();
          radio.setPALevel(RF24_PA_MAX);
          radio.setDataRate(RF24_1MBPS);
          radio.setChannel(7);
          radio.openWritingPipe(rxAddr);
          radio.stopListening();
        
        }
    
    void loop()
    {
             values = 0x10;
             radio.write(&values,1);
             delay(2000);
          //  Serial.print(value);  //prints the character just read
     }
    

    Receiver Code with its Configurations

    #include <SPI.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);
      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(text);
      }
    }
    

    Please suggest whats should i do with respect to NRF51822 to work with these transmitter and receiver code respectively. We have been discussing all for so long but haven't come to a conclusion. So can you help me in code with simple configuration mentioned in the code above and run transmitter and receiver successfully.

    Regards Pallavi

Children
No Data
Related