Hello,
I'm having this problem with this nRF24L01+ connected to an ESP8266 (ESP12-E on BOB), and I'm using NodeMCU 2.2.1. The nRF24L01+ module I'm using is a small board with 8 castellations that I broke out using half of a SOIC-16 to 2.54 mm adapter. I'm also using the NodeMCU SPI library, though I'm confident it's not the problem.
I can communicate with the chip just fine, I can read registers, and they are all at their default values, however, when I try to set a register by sending 0x2X, I get 0x00 back, and reading the register after also returns 0x00. Other registers will be at their default values, though sometimes the chip crashes, and I have to power-cycle to reset to be able to read registers again.
Obviously the chip can receive data, and output data; and the software can write data to the MOSI buffer, and read data from the MISO buffer... I also tried to set RX_ADDR_P2 to see if maybe my bits were out of order or something, it should've accepted pretty much any value from 0x0 to 0xFFFFFFFFFF, but it just gets set to 0x00.
Once I was playing with the clock polarity and phase settings (I know from the datasheet that they're both supposed to be low, but I was turning knobs to see), and I managed to get 0x08 set at some point, but it had nothing to do with the data, so it was probably just noise from the bad polarity, but it shew that it was possible to set something in the register at all.
I suppose this is pretty simple I'm just not aware of, or not paying attention to, and so preemptively, I would like to add that while I'm a pretty bright kid, I'm just starting out as a hobbyist, it's my first time with the nRF24L01+, and my first time with SPI, but know that your help is invaluable to me, and that I am eager to learn anything you may be willing to show me.
The nRF24L01+ is wired straight to the ESP8266's HSPI GPIO ports (TX/RX and IRQ are floating), I don't have any pF caps at hand, so the transmission lines aren't pulled-up, nor decoupled, but since I can communicate, I don't think it's the problem... I think it's either my code, or my understanding, but I did read the datasheet cover to cover. Below is my code, and let me know if you would like a picture of the physical setup.
Thanks in advance for your time, and any help, or insight you may be able to provide. : ]
spi.setup ( 1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, 8, 80, spi.FULLDUPLEX ) --spi.setup(id, mode, cpol, cpha, databits, clock_div[, duplex_mode]) local buffer local address = 0x000000 local addrlen = 0 local misolen = 256 local command = 0x2B --tonumber ( 00101011, 2 ) -- MSBit first local datalen = 5*8 local data = 0x1a1a1a1a1a -- tonumber( 00001100, 2 ) -- LSByte first, MSBit first spi.set_mosi ( 1, 0, datalen, data ) --spi.set_mosi(id, offset, bitlen, data1[, data2[, ..., datan]]) spi.transaction ( 1, 8, command, addrlen*8, address, datalen, 0, misolen ) --spi.transaction(id, cmd_bitlen, cmd_data, addr_bitlen, addr_data, mosi_bitlen, dummy_bitlen, miso_bitlen) for i = 0, misolen-1, 1 do if ( i == 0 ) then buffer = spi.get_miso ( 1, i, 1, 1 ) --spi.get_miso(id, offset, bitlen, num) else buffer = buffer .. spi.get_miso ( 1, i, 1, 1 ) end if ( (i+1)%8 == 0 ) then buffer = buffer .. ' ' end end print ( buffer )