This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF24 SPI woes

Hi folks, I am trying to talk to the nRF241L from a PIC 16F688. It is my first time with SPI, and to complicate matters I code in assembly only so cannot refer to online examples...

Anyway, I am happy with my SPI routine, I think, but I am not quite sure about the Nordic manual...

I will get down and tell you what I am transmitting, receiving, and maybe someone would be good enough to give me a pointer as to where I am going wrong, if at all!

Timings are deliberately slow as I am on a breadboard...

Clocking at 500uS per 1 cycle
CSN to the first clock is 500nS (it was longer and I can lengthen again but this is still 100 times the min
space between end and start clocks approx 1mS
last clock to CSN high is 100uS

So, to initialize...

I am sending 0x33 to 0x00 (config) and this is what I am seeing out...

MOSI 0x00 (conf addy)
MISO 0x0E

MOSI 0x33
MISO 0x08

Which doesn't seem to make any sense to me!

I hope this is just a case of 'can't see the wood for the trees'.

Any help would be appreciated!

Thank you.

  • Hi 

    Your communication seems to be working perfectly Slight smile

    If you refer to the list of SPI commands in chapter 8 of the nRF24L01+ product specification you can see that command 0x00 corresponds to the R_REGISTER command, which means you are trying to read register 0x00 (CONFIG). 

    The first byte returned while outputting the SPI command is the STATUS register, which defaults to 0x0E (regardless of which register you are trying to write or read the STATUS register will always be returned on the first byte). 

    The second byte returned is the value of the CONFIG register, which is 0x08. Again this happens to be the default value of the register, leading me to believe the communication is good. 

    To check this further you can try to set one of the bits in the CONFIG register, such as the PWR_UP bit:

    First set the PWR_UP bit high by sending the following SPI command: 0x20, 0x0A

    Then try to read it back and verify that the register is set. 

    Best regards
    Torbjørn

Related