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, i have also tried with your configurations i.e address 0xe7e7e7 and enabling dynamic payload length, it works fine with both the arduino+nrf24l01. but will not work with nrf51822.the code i have used on nrf51822 side is esb_prx from the pro[pritary_rf folder:

    Transmitter code is,

    #include <SPI.h>
    #include <nRF24L01.h>
    #include <RF24.h>
    #include "printf.h"  
    #define CE 18
    #define CSN 19
    RF24 radio(CE, CSN);
    
    
    int x=0;
    //const byte rxAddr[6] = "00001";
    const byte txAddr[5] = {0xE7,0xE7,0xE7,0xE7,0xE7};
    char values;
    void setup()
    {
      Serial.begin(9600);
        printf_begin();
    
      radio.begin();
     //radio.setPALevel(RF24_PA_MAX);
      radio.setDataRate(RF24_2MBPS);
     // radio.setChannel(7);
    //  radio.setRetries(15,15);
     radio.setCRCLength(RF24_CRC_16);
    //radio.enableAckPayload();
    radio.enableDynamicPayloads();
    radio.openWritingPipe(txAddr);
    radio.stopListening();
    }
    
    void loop()
    {
    values = 'A';
             radio.write(&values,1);
             Serial.print("####### Data Transmitted :");
        Serial.print(values);
        Serial.println(" #######");
             radio.printDetails() ;
             delay(2000);
    
    }
    
    transmitter print details are:
    
    
    .####### 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. = 0xe7e7e7e7e7 0xc2c2c2c2c2
    .RX_ADDR_P2-5. = 0xc3 0xc4 0xc5 0xc6
    .TX_ADDR.. = 0xe7e7e7e7e7
    .RX_PW_P0-6. = 0x20 0x00 0x00 0x00 0x00 0x00
    .EN_AA.. = 0x3f
    .EN_RXADDR. = 0x03
    .RF_CH.. = 0x4c
    .RF_SETUP. = 0x0f
    .CONFIG.. = 0x0e
    .DYNPD/FEATURE. = 0x3f 0x04
    .Data Rate. = 2MBPS
    .Model.. = nRF24L01+
    .CRC Length. = 16 bits
    .PA Power. = PA_MAX
    
    
    the receiver code is,
    
    #include <SPI.h>
    #include <nRF24L01.h>
    #include <RF24.h>
    #include "printf.h"  
    #define CE 18
    #define CSN 19
    RF24 radio(CE, CSN);
    
    
    int x=0;
    //const byte rxAddr[6] = "00001";
    const byte rxAddr[5] = {0xE7,0xE7,0xE7,0xE7,0xE7};
    char values;
    void setup()
    {
      Serial.begin(9600);
        printf_begin();
    
      radio.begin();
     //radio.setPALevel(RF24_PA_MAX);
      radio.setDataRate(RF24_2MBPS);
     // radio.setChannel(7);
    //  radio.setRetries(15,15);
     radio.setCRCLength(RF24_CRC_16);
    //radio.enableAckPayload();
    radio.enableDynamicPayloads();
     radio.openReadingPipe(0, rxAddr);
      radio.startListening();
    }
    
    void loop()
    {
     char text;
        radio.read(&text, 1);
        Serial.print("####### Data Received :");
        Serial.print(text);
        Serial.println(" #######");
        radio.printDetails() ;
    }
    
    print detauils of receiver are as
    
    ####### 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. = 0xe7e7e7e7e7 0xc2c2c2c2c2
    .RX_ADDR_P2-5. = 0xc3 0xc4 0xc5 0xc6
    .TX_ADDR.. = 0xe7e7e7e7e7
    .RX_PW_P0-6. = 0x20 0x00 0x00 0x00 0x00 0x00
    .EN_AA.. = 0x3f
    .EN_RXADDR. = 0x03
    .RF_CH.. = 0x4c
    .RF_SETUP. = 0x0f
    .CONFIG.. = 0x0f
    .DYNPD/FEATURE. = 0x3f 0x04
    .Data Rate. = 2MBPS
    .Model.. = nRF24L01+
    .CRC Length. = 16 bits
    .PA Power. = PA_MAX
    

    sir please go through this and match the settings now with your code and because i had changed my address anabled dynamic payload. after that it doesnt work.

    and the code i previously given that code i am trying to compatible it with code from the peripheral folder the code is radio.thats why you told that it is bit different but now i have posted both the codes go please refer these codes and tell me actually what is going wrong with nrf51822.both codes i.e radio and esb_prx for nrf51822 is not working.and if you had done this then can you share the code with me i.e code from arduino side and code from nrf51822 side. i dont have any issue with the specification .my intension is just that to make communication between nrf51822 and arduino+nrf24l01.

    waiting for your reply.

    Pallavi

Reply
  • hello sir, i have also tried with your configurations i.e address 0xe7e7e7 and enabling dynamic payload length, it works fine with both the arduino+nrf24l01. but will not work with nrf51822.the code i have used on nrf51822 side is esb_prx from the pro[pritary_rf folder:

    Transmitter code is,

    #include <SPI.h>
    #include <nRF24L01.h>
    #include <RF24.h>
    #include "printf.h"  
    #define CE 18
    #define CSN 19
    RF24 radio(CE, CSN);
    
    
    int x=0;
    //const byte rxAddr[6] = "00001";
    const byte txAddr[5] = {0xE7,0xE7,0xE7,0xE7,0xE7};
    char values;
    void setup()
    {
      Serial.begin(9600);
        printf_begin();
    
      radio.begin();
     //radio.setPALevel(RF24_PA_MAX);
      radio.setDataRate(RF24_2MBPS);
     // radio.setChannel(7);
    //  radio.setRetries(15,15);
     radio.setCRCLength(RF24_CRC_16);
    //radio.enableAckPayload();
    radio.enableDynamicPayloads();
    radio.openWritingPipe(txAddr);
    radio.stopListening();
    }
    
    void loop()
    {
    values = 'A';
             radio.write(&values,1);
             Serial.print("####### Data Transmitted :");
        Serial.print(values);
        Serial.println(" #######");
             radio.printDetails() ;
             delay(2000);
    
    }
    
    transmitter print details are:
    
    
    .####### 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. = 0xe7e7e7e7e7 0xc2c2c2c2c2
    .RX_ADDR_P2-5. = 0xc3 0xc4 0xc5 0xc6
    .TX_ADDR.. = 0xe7e7e7e7e7
    .RX_PW_P0-6. = 0x20 0x00 0x00 0x00 0x00 0x00
    .EN_AA.. = 0x3f
    .EN_RXADDR. = 0x03
    .RF_CH.. = 0x4c
    .RF_SETUP. = 0x0f
    .CONFIG.. = 0x0e
    .DYNPD/FEATURE. = 0x3f 0x04
    .Data Rate. = 2MBPS
    .Model.. = nRF24L01+
    .CRC Length. = 16 bits
    .PA Power. = PA_MAX
    
    
    the receiver code is,
    
    #include <SPI.h>
    #include <nRF24L01.h>
    #include <RF24.h>
    #include "printf.h"  
    #define CE 18
    #define CSN 19
    RF24 radio(CE, CSN);
    
    
    int x=0;
    //const byte rxAddr[6] = "00001";
    const byte rxAddr[5] = {0xE7,0xE7,0xE7,0xE7,0xE7};
    char values;
    void setup()
    {
      Serial.begin(9600);
        printf_begin();
    
      radio.begin();
     //radio.setPALevel(RF24_PA_MAX);
      radio.setDataRate(RF24_2MBPS);
     // radio.setChannel(7);
    //  radio.setRetries(15,15);
     radio.setCRCLength(RF24_CRC_16);
    //radio.enableAckPayload();
    radio.enableDynamicPayloads();
     radio.openReadingPipe(0, rxAddr);
      radio.startListening();
    }
    
    void loop()
    {
     char text;
        radio.read(&text, 1);
        Serial.print("####### Data Received :");
        Serial.print(text);
        Serial.println(" #######");
        radio.printDetails() ;
    }
    
    print detauils of receiver are as
    
    ####### 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. = 0xe7e7e7e7e7 0xc2c2c2c2c2
    .RX_ADDR_P2-5. = 0xc3 0xc4 0xc5 0xc6
    .TX_ADDR.. = 0xe7e7e7e7e7
    .RX_PW_P0-6. = 0x20 0x00 0x00 0x00 0x00 0x00
    .EN_AA.. = 0x3f
    .EN_RXADDR. = 0x03
    .RF_CH.. = 0x4c
    .RF_SETUP. = 0x0f
    .CONFIG.. = 0x0f
    .DYNPD/FEATURE. = 0x3f 0x04
    .Data Rate. = 2MBPS
    .Model.. = nRF24L01+
    .CRC Length. = 16 bits
    .PA Power. = PA_MAX
    

    sir please go through this and match the settings now with your code and because i had changed my address anabled dynamic payload. after that it doesnt work.

    and the code i previously given that code i am trying to compatible it with code from the peripheral folder the code is radio.thats why you told that it is bit different but now i have posted both the codes go please refer these codes and tell me actually what is going wrong with nrf51822.both codes i.e radio and esb_prx for nrf51822 is not working.and if you had done this then can you share the code with me i.e code from arduino side and code from nrf51822 side. i dont have any issue with the specification .my intension is just that to make communication between nrf51822 and arduino+nrf24l01.

    waiting for your reply.

    Pallavi

Children
No Data
Related