You are reading a single comment by @conor and its replies. Click here to read the full conversation.
  • @ArthurGuy I finally got back to trying this out again and made some progress. I can now successfully transmit from Arduino to Espruino completely reliably.

    On Espruino:

    SPI1.setup({ sck: A5, miso: A6, mosi: A7 } );
    var nrf = exports.connect( SPI1, B0, B1 );
    var counterCheck=0;
    function onInit() {
      nrf.init([0xF0,0xF0,0xF0,0xF0,0xF0], [0xF0,0xF0,0xF0,0xF0,0xF0]);
    }
    onInit();
    
    dataLine = "";
    setInterval(function() {
      while (nrf.dataReady()) {
        var data = nrf.getData();
        for (var i in data) {
          var ch = data[i];
          if ((ch===0 || ch==0x0A) && dataLine!=="") {
            console.log(dataLine);
            dataLine = "";
          } else if (ch!==0) {
            dataLine += String.fromCharCode(ch);
          }
        }
      }
    }, 50);
    
    

    On Arduino:

    // Set up nRF24L01 radio on SPI pin for CE, CSN
    RF24 radio(8,9);
    // Example below using pipe5 for writing
    const uint64_t pipes[2] = { 0xF0F0F0F0F0LL, 0xF1F1F1F1F1LL };
    
      //radio.enableDynamicPayloads();
    radio.setPayloadSize(0x10);  
    
    radio.setDataRate(RF24_2MBPS);
    radio.setPALevel(RF24_PA_MAX);
    radio.setChannel(2);
    radio.setRetries(15,15);
    radio.setCRCLength(RF24_CRC_8);
    radio.openWritingPipe(pipes[0]);
    radio.openReadingPipe(1,pipes[1]);
    

    The only change I really made since previously was to set the Payload to 16 on Arduino as suggested by @Gordon. I also tried setting Dynamic Payload in both cases and that seems to work too.

    However making the Arduino the receiver and the Espruino the transmitter is proving more difficult. The Arduino says that it has received a payload every time one is sent from the Espruino, but the contents are all zeros. The Espruino also gives a "TX not received 82" after every transmit.

    So at least we know there is no fundamental incompatibility here but I'm running out of ideas on the Arduino-RX side of things.

About

Avatar for conor @conor started