You are reading a single comment by @hansamann and its replies. Click here to read the full conversation.
  • I am starting to use the NRF24... modules I got with the espruino and the master/slave example that I found in the code examples worked really great initially. I then modified the example of the master slightly:

    SPI1.setup({sck:A5, miso:A6, mosi:A7});
    var nrf = require("NRF24L01P").connect( SPI1, B0, B1 );
    var counter = 0;
    function onInit() {
      //transmit, receive
      nrf.init([0,0,0,0,2], [0,0,0,0,1]);
      
      setInterval(function() {
        nrf.sendCommand("" + counter++, function(r) { print("=="+r); });
      }, 1000);
    }
    onInit();
    setInterval(function() {
      nrf.masterHandler();
    }, 50);
    

    It sends the counter variable to the slave, then prints the response. So ideally it will print the increasing numbers.

    Two observations:

    • when starting up, and once also just in the middle of runing the master code, I see

      TX not received 30
      TX not received 30
      ==@
      ==
       
      ==!B
      ==A
      ==8
      ==9
      ==
      ==15
      
    • I sometimes get an empty response - the output from teh print is just == in this case. That seems simple to check against, just wondering what the issue is and if it could be fixed.

    • after running this counter till around 600, I disconnected. then connected again and got a massive out of memory error. is this because of the print statement which might queue the output?

    All output is below:

    ERROR: Out of Memory!
    WARNING: Out of memory while appending to array
    INTERNAL ERROR: Timeout on SPI TX
    ERROR: Out of Memory!
    WARNING: Out of memory while appending to array
    INTERNAL ERROR: Timeout on SPI TX
    ERROR: Out of Memory!
    WARNING: Out of memory while appending to array
    INTERNAL ERROR: Timeout on SPI TX
    ERROR: Out of Memory!
    WARNING: Out of memory while appending to array
    INTERNAL ERROR: Timeout on SPI TX
    INTERNAL ERROR: Timeout on SPI RX
    ERROR: Out of Memory!
    WARNING: Out of memory while appending to array
    INTERNAL ERROR: Timeout on SPI TX
    INTERNAL ERROR: Timeout on SPI RX
    ERROR: Out of Memory!
    WARNING: Out of memory while appending to array
    at line 1 col 144
    {this.setReg(7,48);digitalWrite(this.CE,­0);this.setReg(0,10);this.spi.send(225,t­his.CSN);a=a.clone();a.splice(0,0,160);t­his.spi.send(a,this.CSN);digitalWrite(th­is.CE,1);for(a=1E3;a--&&!(this.getReg(7)­&48););0>=a&&print("TX timeout");a=!0;this.getReg(7)&16&&(print­("TX not received "+this.getReg(7)),a=!1);digitalWrite(thi­s.CE,0);this.setReg(0,11);digitalWrite(t­his.CE,1);this.setReg(7,48);return a}
                                                                                                                                                    ^
    in function "send" called from line 2 col 124
    in function "sendString" called from line 1 col 42
    in function "sendCommand" called from line 2 col 67
    in function called from system
    ERROR: Error processing interval - removing it.
    Execution Interrupted during event processing.
    ERROR: Out of Memory!
    ERROR: Out of Me
    
About

Avatar for hansamann @hansamann started