• Has anyone managed to make this work?

    I'm using the RF24 arduino library from here:


    SPI1.setup({sck:A5, miso:A6, mosi:A7}); // B0, 1 used for other pins.
    var nrf1 = require("http://localhost/NRF24L01P.min.­js").connect( SPI1, B0, B1, 32);//Arduino library defaults 32 byte packet length. 
    nrf1.init([0xE7,0xE7,0xE7,0xE7,0xE7], [0xE8,0xE8,0xF0,0xF0,0xE1]);
    nrf1.setReg(0x05,76); //The arduino library uses channel 76
    var test=[222,173,190,239,222,173,190,239,22­2,173,190,239,222,173,190,239];
    var test2=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,­15,16,17,18,19,20,21,22,23,24,25,26,27,2­8,29,30,31,32];

    My version of the NRF module was modified to change the BASE_CONFIG to use 2-byte CRC, since the arduino library wants that; no other changes.

    Code on Arduino side (hacked up from an example)

    [#include](http://forum.espruino.com/sea­rch/?q=%23include) <SPI.h>
    [#include](http://forum.espruino.com/sea­rch/?q=%23include) "nRF24L01.h"
    [#include](http://forum.espruino.com/sea­rch/?q=%23include) "RF24.h"
    [#include](http://forum.espruino.com/sea­rch/?q=%23include) "printf.h"
    // Hardware configuration
    // Set up nRF24L01 radio on SPI bus plus pins 9 & 10
    RF24 radio(9,10);
    // Topology
    // Single radio pipe address for the 2 nodes to communicate.
    const uint64_t pipe = 0xE8E8F0F0E1LL;
    uint8_t payload_data[16];
    // Setup
    void setup(void)
      // Role
      // Setup and configure rf radio
      // Open pipes to other nodes for communication
      // This simple sketch opens a single pipes for these two nodes to communicate
      // back and forth.  One listens on it, the other talks to it.
    // Loop
    void loop(void)
      // if there is data ready
      if ( radio.available() )
        // Dump the payloads until we've gotten everything
        bool done = false;
        while (!done)
          // Fetch the payload, and see if this was the last one.
          radio.read( payload_data, 16 );
          // Spew it
          printf("Got payload\n\r");
          int i;
          for (i = 0; i < 16; i = i + 1) {

    Serial output is this - which all looks right:

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

    On the Espruino, I try to do:

    TX not received 30

    I remember reading a post by someone else doing this - I can't seem to find it now though. I'm wondering if they ever got it working.... The NRF24 should be a great way to do simple communications between an Espruino and one or more less-capable Arduino-like devices tucked into corners, or located outdoors, etc.


Avatar for DrAzzy @DrAzzy started