Open Manawyrm opened 10 years ago
Thanks for the report. I've filed the pi-spi compilation issue at https://github.com/natevw/pi-spi/issues/8 — I'm hoping it won't be too much trouble to get it working for both node.js versions but I want it to work on the latest at least!
If you've been testing with the C++ library, it probably ± broke the Linux SPI driver and you'll need to either reboot your Pi or follow the modprobe
instructions in https://github.com/natevw/node-nrf/issues/1#issuecomment-32395546 before "/dev/spidev0.0" will work as it should for node-nrf.
It's really kind of odd that you're getting [mostly] 0x40
back over the SPI instead of just 0x00
or 0xFF
but until the driver is working I wouldn't pay too much attention to it yet. I think your pinouts are correct, but you might want to double check that too. Here's the connections that I'm using for the included test.js file: https://gist.github.com/natevw/5789019 (Note that the only connections that effect printDetails
are the SPI ones, the CE and IRQ are only used when RF is active.)
Hope this helps!
OK, now its getting strange... After a reboot:
SPI device: /dev/spidev0.0
CE GPIO: 24
IRQ GPIO: 25
STATUS: 0xe RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0–1: 0xe7e7e7e7e7 0xc2c2c2c2c2
RX_ADDR_P2–5: 0xc3 0xc4 0xc5 0xc6
TX_ADDR: 0xe7e7e7e7e7
RX_PW_P0–5: 0x0 0x0 0x0 0x0 0x0 0x0
EN_AA: 0x3f
EN_RXADDR: 0x03
RF_CH: 0x2
RF_SETUP: 0x0f
CONFIG: 0x0b
DYNPD/FEATURE: 0x03 0x07
Data Rate: 2Mbps
Model: nRF24L01+
CRC Length: 8 bits
PA Power: PA_MAX
and then after a
sudo modprobe -r spi_bcm2708
sudo modprobe spi_bcm2708
THIS happens:
SPI device: /dev/spidev0.0
CE GPIO: 24
IRQ GPIO: 25
STATUS: 0xe RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0–1: 0xe7e7616d74 0x746d616d74
RX_ADDR_P2–5: 0xc3 0xc4 0xc5 0xc6
TX_ADDR: 0xe7e7e7e7e7
RX_PW_P0–5: 0x0 0x0 0x0 0x0 0x0 0x0
EN_AA: 0x3f
EN_RXADDR: 0x03
RF_CH: 0x2
RF_SETUP: 0x0f
CONFIG: 0x0b
DYNPD/FEATURE: 0x03 0x07
Data Rate: 2Mbps
Model: nRF24L01+
CRC Length: 8 bits
PA Power: PA_MAX
And THIS is strange. Because as you can see here, there are some bits of my set adress, but not all (wth?!) (my set address was 0x746D610000)
Any ideas? The connections are correct.
Sorry for the delay on this, keep encountering setbacks wiring up a second radio/RasPi to test on. (You'd think it'd be easier the second time…) If I can't get a "development" setup going soon I'll just have to borrow the "in-use" system for an evening or two instead.
Any news on your end, in the meantime?
Not quite, I couldn't get any data events out of it, but seemed to be able to program the chips registers after a reboot of the raspberry. But still -- that weird issue with the bits of the addresses persists too.
Thanks, Tobias
I saved your example script as "issue4.js" and the basic setup is working on my Pi. The first time I run it reports the previous pipe numbers (the script doesn't wait for pipe setup to complete before the printDetails starts talking with the chip too), but when running again I see the correct address:
pi@rubus-officinalis ~/radio/node-nrf $ sudo node issue4.js
SPI device: /dev/spidev0.0
CE GPIO: 24
IRQ GPIO: 25
STATUS: 0xe RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0–1: 0xe7e7e7e7e7 0xc2c2c2c2c2
RX_ADDR_P2–5: 0xc3 0xc4 0xc5 0xc6
TX_ADDR: 0xe7e7e7e7e7
RX_PW_P0–5: 0x0 0x0 0x0 0x0 0x0 0x0
EN_AA: 0x3f
EN_RXADDR: 0x03
RF_CH: 0x2
RF_SETUP: 0x0f
CONFIG: 0x0b
DYNPD/FEATURE: 0x03 0x07
Data Rate: 2Mbps
Model: nRF24L01+
CRC Length: 8 bits
PA Power: PA_MAX
^Cpi@rubus-officinalis ~/radio/node-nrf $ sudo node issue4.js
SPI device: /dev/spidev0.0
CE GPIO: 24
IRQ GPIO: 25
STATUS: 0xe RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0–1: 0xe7e7616d74 0x746d610000
RX_ADDR_P2–5: 0xc3 0xc4 0xc5 0xc6
TX_ADDR: 0xe7e7e7e7e7
RX_PW_P0–5: 0x0 0x0 0x0 0x0 0x0 0x0
EN_AA: 0x3f
EN_RXADDR: 0x03
RF_CH: 0x2
RF_SETUP: 0x0f
CONFIG: 0x0b
DYNPD/FEATURE: 0x03 0x07
Data Rate: 2Mbps
Model: nRF24L01+
CRC Length: 8 bits
PA Power: PA_MAX
^Cpi@rubus-officinalis ~/radio/node-nrf $
(Note that I'm only looking at the RX address, which is getting associated with the P1 "slot" by design. I wouldn't expect the TX address to be set, since that only gets set as needed, i.e. a packet gets sent.)
Hmm, it is interesting that in both our cases the P0 address ends up as 0xe7e7616d74. I turned my little debug flag on (nrf._debug = true
near the top) which helped me see why. Basically when you open the TX pipe with a numeric (rather than buffer) address because of the leading zeroes it gets treated internally as a shorter width address.
I need to review a couple different things about this (I'm not sure the TX pipe should be claiming P0 to begin with, and also it needs to check its address width better…) but you may get farther along with pipes = [Buffer("746D610000",'hex'), Buffer("0000616D74",'hex')];
in the meantime.
For my reference, the followup items here are:
slotForAddr
logic…
Hi,
I was trying to get node-nrf to work right. At first, I had to downgrade node to v0.10.16. After downgrading I was able to compile the needed spi libs.
My hardware is OK, because I'm able to get the chip running with the C++ lib RF24:
Using this javascript I was not able to get the chip running:
printDetails outputted the following instead of the correct variables:
Any ideas what I did wrong here?
Thanks, Tobias