+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Member level 3
    Points: 561, Level: 5

    Join Date
    Sep 2017
    Posts
    63
    Helped
    0 / 0
    Points
    561
    Level
    5

    general SPI troubleshooting

    Hi,
    Using a PIC18F26K40 to run a NRF24L01 over SPI. Works as expected.
    Trying to use PIC16F18326 to run a NRF24L01 over SPI. Doesn't work.

    I am using pretty much the same code as the 18F. It is generated by MCC. The main differences are the microcontroller, and the pins that are being mapped via PPS. I have tried various things but I have run out of options to fault find it.

    The 16F code works ok with a digital pot MCP4341, and I believe the NRF24L01 has the same CKE and CKP requirements. I have used a logic analyser and it looks like the correct values are being written via MOSI, but what is being read back doesn't seem right. I am writing to the status register of the NRF and there should be data coming back saying there is data in the RX buffer. but all i get back is 0E, which means buffer empty.

    What can i do to try and work out what is happening?

    •   AltAdvertisment

        
       

  2. #2
    Advanced Member level 5
    Points: 23,087, Level: 36
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,414
    Helped
    979 / 979
    Points
    23,087
    Level
    36

    Re: general SPI troubleshooting

    Maybe the buffer IS Empty? How do you know it’s not? Is it a different PCB from the 18? Maybe there’s some other hardware issue?



    •   AltAdvertisment

        
       

  3. #3
    Member level 3
    Points: 561, Level: 5

    Join Date
    Sep 2017
    Posts
    63
    Helped
    0 / 0
    Points
    561
    Level
    5

    Re: general SPI troubleshooting

    Quote Originally Posted by barry View Post
    Maybe the buffer IS Empty? How do you know it’s not? Is it a different PCB from the 18? Maybe there’s some other hardware issue?
    Yes, it might be a hardware issue. yes its a different pcb.

    I am sure now that the logic analyser is reading and writing the correct values. It seems that the NRF is not being setup correctly for channel etc. The IRQ line is floating, but tying it high or low makes no difference. However, I can make it work by connecting the IRQ line to the data analyser when it is tied high or tied low. I can then disconnect the analyser and it keeps working correctly. So again it seems the the NRF is not being setup correctly. There is probably a clue there, but I don't know enough to work it out.



    •   AltAdvertisment

        
       

  4. #4
    Advanced Member level 5
    Points: 23,087, Level: 36
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,414
    Helped
    979 / 979
    Points
    23,087
    Level
    36

    Re: general SPI troubleshooting

    Sounds like maybe there’s a grounding/layout issue.



  5. #5
    Advanced Member level 4
    Points: 7,496, Level: 20

    Join Date
    Jan 2015
    Posts
    1,055
    Helped
    331 / 331
    Points
    7,496
    Level
    20

    Re: general SPI troubleshooting

    Variant of the same question asked at https://www.microchip.com/forums/m1089435.aspx#1089435.
    Susan



--[[ ]]--