Hot!18F4620 SPI SCK problem

Author
Camerart
Starting Member
  • Total Posts : 44
  • Reward points : 0
  • Joined: 2013/04/12 02:19:40
  • Location: 0
  • Status: offline
2018/12/06 02:13:09 (permalink)
0

18F4620 SPI SCK problem

Hi,
I've got some surface mount PCBs, with 18F4620 PICs.
 
The SPI SCK only switches between 0-0.5V, are there any suggestions as to why?
 
Camerart
post edited by Camerart - 2018/12/08 02:05:38
#1

13 Replies Related Threads

    qhb
    Superb Member
    • Total Posts : 7898
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: 18F4620 SPI SCK problem 2018/12/06 03:05:14 (permalink)
    +1 (1)
    The most obvious chances are a short to ground, or it's connected to a chip that is also trying to drive the clock signal.
    Hard to say without seeing your schematic.
     
    #2
    Camerart
    Starting Member
    • Total Posts : 44
    • Reward points : 0
    • Joined: 2013/04/12 02:19:40
    • Location: 0
    • Status: offline
    Re: 18F4620 SPI SCK problem 2018/12/06 03:27:14 (permalink)
    0
    qhb
    The most obvious chances are a short to ground, or it's connected to a chip that is also trying to drive the clock signal.
    Hard to say without seeing your schematic.
     


    Hi Q,
    Just switched on the PCB to test your suggestions and SMOKE..........  My Oscilloscope's blown up:(    
    It's been telling me I need a new one for a couple of years now, so that's next on the list.
    C
    #3
    Camerart
    Starting Member
    • Total Posts : 44
    • Reward points : 0
    • Joined: 2013/04/12 02:19:40
    • Location: 0
    • Status: offline
    Re: 18F4620 SPI SCK problem 2018/12/06 07:54:25 (permalink)
    0
    Hi,
    I've checked the resistance on the SCK track, with nothing connected.  Continuity almost zero.  Between SCK PIN and anywhere else on the circuit 11 M'Ohm max.
    C
    #4
    jack@kksound
    code tags!
    • Total Posts : 2896
    • Reward points : 0
    • Joined: 2014/05/14 10:03:19
    • Location: 0
    • Status: online
    Re: 18F4620 SPI SCK problem 2018/12/06 09:05:52 (permalink)
    +1 (1)
    Sounds like a pcb issue......
    #5
    Camerart
    Starting Member
    • Total Posts : 44
    • Reward points : 0
    • Joined: 2013/04/12 02:19:40
    • Location: 0
    • Status: offline
    Re: 18F4620 SPI SCK problem 2018/12/07 02:45:35 (permalink)
    0
    Hi,
    I added this: SSPCON1 = %0010000, and it started working, but have been told, that this shouldn't be done.  So it appears the problem is somewhere in settings.
    C.
    #6
    qhb
    Superb Member
    • Total Posts : 7898
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: 18F4620 SPI SCK problem 2018/12/07 05:53:33 (permalink)
    +2 (2)
    Camerart
    I added this: SSPCON1 = %0010000, and it started working,

    So what had you written to that register when it was NOT working?
    This is why it's hard to help when yo udon't show your code.
     

    but have been told, that this shouldn't be done.

    Told by who?
    Did they reveal why you shouldn't?

    So it appears the problem is somewhere in settings.

    Which you have so far managed to avoid showing us.
     
    #7
    1and0
    Access is Denied
    • Total Posts : 8531
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: 18F4620 SPI SCK problem 2018/12/07 06:55:35 (permalink)
    +1 (1)
    Camerart
    I added this: SSPCON1 = %0010000, and it started working, but have been told, that this shouldn't be done.

    What programming language are you using?
     
    #8
    Camerart
    Starting Member
    • Total Posts : 44
    • Reward points : 0
    • Joined: 2013/04/12 02:19:40
    • Location: 0
    • Status: offline
    Re: 18F4620 SPI SCK problem 2018/12/07 10:39:59 (permalink)
    0
    1and0
    Camerart
    I added this: SSPCON1 = %0010000, and it started working, but have been told, that this shouldn't be done.

    What programming language are you using?
     


    Hi Q and 1,
    I'm using Oshonsoft BASIC.
     
    I'm not being secretive when I don't post my programs, because I am not a good programmer, so keep trying different old programs, with perhaps different PICs, hoping to get a sign of life.  In other words, it would be confusing with me keeping changing things.
     
    Regarding SSPCON1:  I was told it may conflict with the SPI setting, which is exactly what it does.  I removed it and no different.
     
    Anyway I stumbled around in my usual way, and now I have SPI SCK working.
     
    Thanks, and sorry for the confusions.
    C.
     
     
    #9
    qhb
    Superb Member
    • Total Posts : 7898
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: 18F4620 SPI SCK problem 2018/12/07 14:03:13 (permalink)
    +1 (1)
    Camerart
    ...
    I'm not being secretive when I don't post my programs, because I am not a good programmer, so keep trying different old programs, with perhaps different PICs, hoping to get a sign of life.  In other words, it would be confusing with me keeping changing things.
     

    It's even more confusing when you don't show anything.
    As you say, you stumbled upon something that works just by mindlessly swapping code.
    That shows that the problem was in the code you didn't show us.
    That's no way to learn how it works, try to understand what you are writing actually does.
     
    #10
    Camerart
    Starting Member
    • Total Posts : 44
    • Reward points : 0
    • Joined: 2013/04/12 02:19:40
    • Location: 0
    • Status: offline
    Re: 18F4620 SPI SCK problem 2018/12/08 02:03:45 (permalink)
    0
    qhb
    Camerart
    ...
    I'm not being secretive when I don't post my programs, because I am not a good programmer, so keep trying different old programs, with perhaps different PICs, hoping to get a sign of life.  In other words, it would be confusing with me keeping changing things.
     

    It's even more confusing when you don't show anything.
    As you say, you stumbled upon something that works just by mindlessly swapping code.
    That shows that the problem was in the code you didn't show us.
    That's no way to learn how it works, try to understand what you are writing actually does.
     


    Hi Q,
    Ok, here's the program where the SPI SCK works:
    I had to switch around 
    Symbol altmtr = PORTD.6 '5 'BAROMETER/TEMP 
    Symbol compss = PORTD.5 '6 'AK8963C 
    Which tells me that the SPI SCK was working, but the program hadn't reached a suitable one.
     
    The program now get's to the bottom RETURN, but to get there I had to comment out all of the LCD lines.  So this is where I start today.
    C.
    #11
    qhb
    Superb Member
    • Total Posts : 7898
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: 18F4620 SPI SCK problem 2018/12/08 04:46:26 (permalink)
    +1 (1)
    Something went wrong with your attachment. The file has zero size.
     
    #12
    Camerart
    Starting Member
    • Total Posts : 44
    • Reward points : 0
    • Joined: 2013/04/12 02:19:40
    • Location: 0
    • Status: offline
    Re: 18F4620 SPI SCK problem 2018/12/08 10:19:22 (permalink)
    0
    Hi Q,
    Hopefully it's a bit fatter this time.
    To clarify, over time, I made programs, with single modules on e,g, GPS, LCD etc, because the PIC didn't have enough memory.  Now I've made a PCB with larger PIC, I can join them all together, but for me it's not easy, so don't spend too much time until I've cleared up a few errors and other things.
     There is an INCLUDE of a 'font' which I've also posted.
    The logic image shows [Compass initialisation] but this is when the SPI SCK stops.
    C.

    Attached Image(s)

    #13
    Camerart
    Starting Member
    • Total Posts : 44
    • Reward points : 0
    • Joined: 2013/04/12 02:19:40
    • Location: 0
    • Status: offline
    Re: 18F4620 SPI SCK problem 2018/12/09 02:58:47 (permalink)
    0
    Hi,
    Looking again at the attached image, I noticed a MOSI tick marked with a green ring, which is where the SPI SCK stops working.  How do I find this point in the program?
     
    EDIT: I added a wire to the logic probe and found the SPI SCK stops working around the CALL_CLEAR() area.
     
    C
    post edited by Camerart - 2018/12/09 04:48:38

    Attached Image(s)

    #14
    Jump to:
    © 2018 APG vNext Commercial Version 4.5