Skip to content

I can't init connection with NRF #64

@engmarconi

Description

@engmarconi

this my nodejs code on Pi3

const cePin = 24;
const irqPin = 25;
const spiDev = "/dev/spidev0.0";
pipes = [0x746D610000, 0x0000616D74];

var nrf = require('nrf');
var radio = nrf.connect(spiDev, cePin, irqPin);
radio._debug = true

radio.channel(115);
radio.dataRate('1Mbps');
radio.crcBytes(2);
radio.autoRetransmit({ count: 15, delay: 4000 });


radio.begin(function () {
  var rx = nrf.openPipe('rx', pipes[0]);
  var tx = nrf.openPipe('tx', pipes[1]);
  rx.on('data', function (d) {
    console.log("Got data, will respond", d);
    tx.write(d);
  });
  tx.on('error', function (e) {
    console.warn("Error sending reply.", e);
  });
});

But I got the following response

setStates { RF_CH: 115 }
setStates { RF_DR_LOW: false, RF_DR_HIGH: false }
setStates { EN_CRC: true, CRCO: 1 }
setStates { ARC: 15, ARD: 15 }
Set CE low.
blocked for 130µs.
Set CE low.
blocked for 130µs.
execCommand FLUSH_TX 0
execCommand [ 'W_REGISTER', 5 ] [ 115 ]
execCommand FLUSH_RX 0
execCommand [ 'R_REGISTER', 6 ] 1
setStates { PWR_UP: true,
  PRIM_RX: false,
  EN_RXADDR: 0,
  RX_DR: true,
  TX_DS: true,
  MAX_RT: true,
  EN_DPL: true,
  EN_ACK_PAY: true,
  EN_DYN_ACK: true }
 - exec read: null
/home/pi/Documents/DreamHome/NRF_demo/Pi/node_modules/nrf/index.js:150
                var val = d[0],
                           ^

TypeError: Cannot read property '0' of null

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions