This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Advice for simple communication from nrf51822 to nrf24l01 ?

Hi everyone ! I'm trying to send data from an nrf51822 to an nrf24l01 with arduino and I guess I'm doing something wrong...

For the moment I succeeded to have these talking together:

...so I guess the hardware is not the problem :) (if you're curious about the context, the project is explained here: hackster.io/cedric/twi)

I looked for similar problems on the forum but I don't find the solution to my problem, if anyone has a suggestion I would be infinitely grateful ;D

Here is the configuration I use:

nrf51 (TX): radio_config.c main.c

nrf24 (RX) with arduino: Mirf.cpp RX.ino

I used the nrf51 sdk suggestions and an nrf24 library (+datasheets) to understand it, but it doesn't work (yet!), the nrf24 reception pipe stays empty.

Anyone has any suggestion to offer ? Thanks a lot !! ;)

Parents
  • Hi Cedric,

    The nRF51 does not have the enhanced shockburst in hardware anymore, which means that when you send a payload from the nRF51 side, and the L01+ is configured to do auto-ACKing, you will run into issues.

    What I would suggest is that you use the ESB-library on the nRF51 side, and on the nRF24L-side you enable registers:

    • EN_DPL for your pipes.
    • EN_DYN_ACK
    • EN_ACK_PAY

    If you look at the ESB library documentation, there's a section on how the nRF24LE1 should be configured (see the nRFgo SDKs hal_nrf.c file for reference to the calls, its basically the registers I posted): devzone.nordicsemi.com/.../a00139.html

    Best regards Håkon

  • (2/3) Bare bones of the RPi code that calls the RF24 routines:

    #include "../RF24.h";
    

    RF24 radio("/dev/spidev0.0",8000000 , 25);
    const int role_pin = 7; const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };

    void rf24setup(void){

    radio.begin(); radio.setRetries( 15, 15); radio.setChannel(0x05); radio.setPALevel(RF24_PA_MAX); radio.setPALevel(RF24_PA_MAX); radio.setDataRate(RF24_1MBPS); radio.setPayloadSize(0x0c); radio.enableAckPayload();

    radio.openWritingPipe(pipes[0]); radio.openReadingPipe(1,pipes[1]); radio.startListening(); radio.printDetails(); }

    int main( int argc, char *argv[]){

    // Declarations
    uint8_t message[12];
    
        // Initialise radio (and print settings to screen)
        rf24setup();
    
    // Finishing
    while (1)
    {
    	radio.startListening(); // Start listening for incoming messages
    
    	while ( ! radio.available() ) { // Wait for a message
    		__msleep(10);
    	}
    
    	radio.read( &message,12); // Get the message
    
    	// do something with message here	
                
    	radio.stopListening(); // stop listening so we can send an acknowledgement
    	radio.writeAckPayload(2,&message,13);
    }
    

    }

Reply
  • (2/3) Bare bones of the RPi code that calls the RF24 routines:

    #include "../RF24.h";
    

    RF24 radio("/dev/spidev0.0",8000000 , 25);
    const int role_pin = 7; const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };

    void rf24setup(void){

    radio.begin(); radio.setRetries( 15, 15); radio.setChannel(0x05); radio.setPALevel(RF24_PA_MAX); radio.setPALevel(RF24_PA_MAX); radio.setDataRate(RF24_1MBPS); radio.setPayloadSize(0x0c); radio.enableAckPayload();

    radio.openWritingPipe(pipes[0]); radio.openReadingPipe(1,pipes[1]); radio.startListening(); radio.printDetails(); }

    int main( int argc, char *argv[]){

    // Declarations
    uint8_t message[12];
    
        // Initialise radio (and print settings to screen)
        rf24setup();
    
    // Finishing
    while (1)
    {
    	radio.startListening(); // Start listening for incoming messages
    
    	while ( ! radio.available() ) { // Wait for a message
    		__msleep(10);
    	}
    
    	radio.read( &message,12); // Get the message
    
    	// do something with message here	
                
    	radio.stopListening(); // stop listening so we can send an acknowledgement
    	radio.writeAckPayload(2,&message,13);
    }
    

    }

Children
No Data
Related