NRF24L01P shim for Pico

Posted on
  • Has anyone successfully used this? I've had no luck and I'm almost certain it's because of having to use software SPI. I've used the NRF24 without the shim lots of times before, so in general I don't think it's because of how my code is doing things with it. I thought maybe the table with the pins listed on the shims page had a typo but after going through it I think it's fine.

    Is there just some nuance or trick with software SPI that I should know?

  • Can you post the code you're using, so we can look it over?

    I'm honestly surprised that @Gordon made the shim such that you need software spi... (on phone, hence can't go pull the appropriate data to sanity check this).

  • I don't have one handy, but I have definitely had this working. The pinout is here - but I imagine you found that already (http://www.espruino.com/Shims#nrf24l01p-­0-05-shim).

    It does use software SPI, but that shouldn't be a big issue compared to hardware SPI - Espruino waits for the SPI transmission to finish anyway, so it's not significantly slower than hardware.

    If you could post up you code and the error messages you get (if any) I'll try it out here.

  • Apologies for asking my first question and then going M.I.A. for a week. Bad form on my part.

    In any case, here's a bit of code for a "beacon" Pico, with the receiver Pico having essentially the same code. As it is here it runs fine, but if I switch over to the commented out software SPI portion, I get a "TX timeout". I've tried on multiple Pico/NRF24 combos so it shouldn't be a hardware issue.

    Thanks for taking a look!

    SPI1.setup( { sck: B3, miso: B4, mosi: B5 } );
    var nrf = require( "NRF24L01P" ).connect( SPI1, B6, B7 );
    
    //var spi = new SPI();
    //spi.setup( { sck: A1, miso: A3, mosi: A2 } );
    //var nrf = require( "NRF24L01P" ).connect( spi, A0, A10 );
    
    var ledValue = 1;
    var dataLine = "";
    
    function onInit() {
       clearInterval();
       nrf.init( [0, 0, 0, 0, 1], [0, 0, 0, 0, 2] );
       sendData( 'PING' );
    }
    
    function sendData( value ) {
       digitalWrite( LED2, ledValue );
       ledValue = !ledValue;
       nrf.sendString( value );
       setTimeout( sendData, 2000, 'PING' );
    }
    
    function receive() {
       dataLine = "";
       while ( nrf.getDataPipe() !== undefined ) {
          var data = nrf.getData();
          for ( var i in data ) {
             var ch = data[i];
             if ( ch === 0 && dataLine !== "" ) {
                console.log( dataLine );
                if ( dataLine == 'PING' ) {
                   digitalWrite( LED2, ledValue );
                   ledValue = !ledValue;
                }
                dataLine = "";
             } else if ( ch !== 0 ) {
                dataLine += String.fromCharCode( ch );
             }
          }
       }
    }
    
    onInit();
    
  • I just tried it here on the Pico I've got wired up with the shim and software SPI, and I get TX not received 30 - which is pretty much what you'd expect if no nRF24 was there to receive the data?

    Could it be that you've got some wires shorted or not connected somehow?

  • Could I bother you to put up the exact code you're using? (If it's different at all from what I'm doing.) I ask because I get the 255 code instead of 30.

    I'm pretty confident it's not a hardware or wiring thing. I don't have success between two picos each using the shim either, and there's no wiring mistakes to make there. And I've tested my soldering for shorts, etc.

  • It's exactly your code, with the software SPI uncommented.

    To me, code 255 sounds like SPI MISO is shorted high somehow or not connected. Could you send me a picture of the shim as you've soldered it on?

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

NRF24L01P shim for Pico

Posted by Avatar for tambeb @tambeb

Actions