• AVR Freaks

Hot!How do I fault find this SPI issue

Author
brownt
Super Member
  • Total Posts : 296
  • Reward points : 0
  • Joined: 2015/11/21 14:58:09
  • Location: 0
  • Status: offline
2019/03/08 19:49:56 (permalink)
5 (1)

How do I fault find this SPI issue

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 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.
 
   
 
RC0PPSbits.RC0PPS = 0x1A;   //RC0->MSSP2:SCK2;    
RC3PPSbits.RC3PPS = 0x1B;   //RC3->MSSP2:SDO2;    
SSP2CLKPPSbits.SSP2CLKPPS = 0x10;   //RC0->MSSP2:SCK2;    
SSP2DATPPSbits.SSP2DATPPS = 0x11;   //RC1->MSSP2:SDI2;   
 
 

 
I have used a logic analyser on it and it 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.
 
Any ideas on how I can find out what is wrong?
post edited by brownt - 2019/03/09 20:35:27

Attached Image(s)

#1

6 Replies Related Threads

    jack@kksound
    code tags!
    • Total Posts : 3198
    • Reward points : 0
    • Joined: 2014/05/14 10:03:19
    • Location: 0
    • Status: offline
    Re: How do I fault find this SPI issue 2019/03/11 09:13:52 (permalink)
    0
    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

    This would appear to indicate some sort of floating or unconnected signal somewhere.
    #2
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: How do I fault find this SPI issue 2019/03/11 12:40:14 (permalink)
    0
    brownt
    ...
     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.

    HOW exactly are you tying it high or low?
    i.e. where, and with what value resistor.
     
    Why are there no lines on your schematic?
    If one of our employees brought that to me, I would send them back to do it properly.
    Just using global net names to do the connections is lazy, and makes it almost impossible to follow where a signal goes without perusing every single net name on the sheet.
     

    Nearly there...
    #3
    jack@kksound
    code tags!
    • Total Posts : 3198
    • Reward points : 0
    • Joined: 2014/05/14 10:03:19
    • Location: 0
    • Status: offline
    Re: How do I fault find this SPI issue 2019/03/11 13:19:04 (permalink)
    0
    qhb
    Why are there no lines on your schematic?
    If one of our employees brought that to me, I would send them back to do it properly.
    Just using global net names to do the connections is lazy, and makes it almost impossible to follow where a signal goes without perusing every single net name on the sheet.
     

    Absolutely! One of my biggest complaints about schematic editing software, I simply hate having to deal with just net-name labels! Use them when appropriate but draw the bloody lines most of the time!
     
    To the OP: you have really not presented enough information to get a usable response.
    #4
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: How do I fault find this SPI issue 2019/03/11 14:43:37 (permalink)
    0
    I also just noticed you have pullup resistors on the ICSP_CLK and ICSP_DATA signals, which the PK3 user manual specifically tells you not to do.
    Bear that in mind if you have any programming or in-circuit debugging problems later.
     

    Nearly there...
    #5
    Aussie Susan
    Super Member
    • Total Posts : 3591
    • Reward points : 0
    • Joined: 2008/08/18 22:20:40
    • Location: Melbourne, Australia
    • Status: offline
    Re: How do I fault find this SPI issue 2019/03/11 18:57:36 (permalink)
    #6
    DeutcheN
    Super Member
    • Total Posts : 108
    • Reward points : 0
    • Joined: 2010/09/01 12:35:40
    • Location: DM43BH
    • Status: offline
    Re: How do I fault find this SPI issue 2019/03/13 22:59:42 (permalink)
    0
    PIC device is powered at 5V.   NRF device is at 3.3V.   Do you use any level shifters?  Also no pull-up resistors?
    #7
    Jump to:
    © 2019 APG vNext Commercial Version 4.5