Cant interface with NRF24L01P

Posted on
  • I am having all kinds of trouble today lol.

    I am trying to get these two radios working again. I had them working in the past but have not been successful today even when trying the most basic example.

    https://www.espruino.com/NRF24L01P

    I have one espurino attached to a macbook pro USB plugged into the web ide with the following code:

    SPI1.setup({sck:A5, miso:A6, mosi:A7});
    var nrf = require("NRF24L01P").connect( SPI1, B0, B1 );
    function onInit() {
      nrf.init([0,0,0,0,1], [0,0,0,0,2]);
    }
    onInit();
    setInterval(function() {
      nrf.slaveHandler();
    }, 50);
    

    On another macbook pro I have an espurino plugged into the usb with the web ide open. On that one I have the following code:

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

    On the master once I pushed the code I then try the following from the console:

    nrf.sendCommand("1+2", function(r) { print("=="+r); });
    

    When I do that I get the error:

    TX not received 30
    

    If I swapped the two pieces of code and make the first the master I get this error:

    TX not received 255
    

    I have checked my wiring at least 10 times on both NRF24L01P. I used the pin instructions found here https://www.espruino.com/NRF24L01P for my two original espruino boards.

    Any insight or tips to debug would be really appreciated.

  • I am calling it a day now... I figured out the problem. After trying 3 espruinos and multiple NRF modules I kept getting 255 on one board and 30 on the other board. I read somewhere that the 255 was an issue with maybe the MOSI but I checked wiring at least 10 times. I ended up putting all new cables on the NRF to espurino and I'm back in action.

  • Glad you got it sorted! When interfacing with SPI, getting 255 is often a sign that one or more of MISO or MOSI is connected wrong

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Cant interface with NRF24L01P

Posted by Avatar for jakedempsey @jakedempsey

Actions