• AVR Freaks

Hot!18F26K80 SPI – SSPBUF floating - any ideas needed!

Author
chrzesm
New Member
  • Total Posts : 9
  • Reward points : 0
  • Joined: 2020/03/03 00:57:33
  • Location: 0
  • Status: offline
2021/01/17 07:35:54 (permalink)
0

18F26K80 SPI – SSPBUF floating - any ideas needed!

I am trying to use single SPI communication using 18F26K80. The proc needs to read SPI only, so no rocket science task. I have the following config:
PMD0bits.SSPMD = 0; //MSSP enabled
SSPSTATbits.SMP = 0; //receiving mode
SSPSTATbits.CKE = 1; // clock trigger on rise (mode 0)
SSPCON1bits.CKP = 0; // clock trigger on rise (mode 0)
SSPCON1bits.SSPEN = 1; //serial port enabled
SSPCON1bits.SSPOV = 1; //
SSPCON1bits.SSPM = 4; //SPI Slave mode: clock = SCK pin; SS pin control enabled
I use high priority interrupt SSPIF to read SSPBUFF.
When I test the circuits, it seems the SSPBUF gets full randomly, sometimes after 6/7 or 8 SCK clock cycles. I tried different combination of pulling-up/down the SCK pin with no effect. However I noticed the circuits works properly (SSPBUFF full after every 8 SCK cycles) when I touch the SCK pin with … my finger. Hmm, that seems to be weird. I have check all grounding, connected additional cap to the PIC power pins… and after 3 days I have exhausted my ideas :-(.
I attached screens from my investigation.
Any suggestion would be much appreciated.

Attached Image(s)

#1

10 Replies Related Threads

    NorthGuy
    Super Member
    • Total Posts : 6518
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: 18F26K80 SPI – SSPBUF floating - any ideas needed! 2021/01/17 08:50:11 (permalink)
    +1 (1)
    Looks like some sort of grounding problem, or a bad connection/soldering on the CLK pin (for example, when you press it with the finger, you improve the connection, but otherwise it is glitchy).
     
    Do you probe directly at the PIC's pin (as opposed to pads, wires, TPs etc.)?
    #2
    chrzesm
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2020/03/03 00:57:33
    • Location: 0
    • Status: offline
    Re: 18F26K80 SPI – SSPBUF floating - any ideas needed! 2021/01/17 09:24:22 (permalink)
    0
    Thanks NorthGuy. Yes, I do probe directly, so my screens show actual signals on the PIC pins. I resolder all connections twice, still the same effect. It seems CLK pin gets some edges internally or MSSP is not grounded inside the chip? I do not push with my finger anything, just touch the wire soldered to CLK making some additional capacity. Tried small capacitors on CLK - no improvement. My all ports are digital: ANCON0 = 0x00; ANCON1 = 0x00. Must admit have never seen that before, except RF projects. Tend to switch to NXP since this drives me mad. 
     
    #3
    NorthGuy
    Super Member
    • Total Posts : 6518
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: 18F26K80 SPI – SSPBUF floating - any ideas needed! 2021/01/17 10:23:12 (permalink)
    0
    chrzesm
    Yes, I do probe directly, so my screens show actual signals on the PIC pins.



    I would look with a scope to see the actual signal. There may be bad voltage levels or some sort of noise. This may make the PIC see the extra edges. Your LA hides most of this stuff and shows its own interpretation.
    #4
    chrzesm
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2020/03/03 00:57:33
    • Location: 0
    • Status: offline
    Re: 18F26K80 SPI – SSPBUF floating - any ideas needed! 2021/01/17 11:15:47 (permalink)
    0
    Thanks, yes, aslo suspected my LA misses some details, even if it can detect 10nsek (100MHz) spikes, so I did check with OSC. The clock shape seems all fine - see the attached screen.

    Attached Image(s)

    #5
    chrzesm
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2020/03/03 00:57:33
    • Location: 0
    • Status: offline
    Re: 18F26K80 SPI – SSPBUF floating - any ideas needed! 2021/01/19 01:50:17 (permalink)
    0
    Hmm, it looks the SCK input is extremely sensitive to the rise time and clk quality in 18F..K80. Thus, even 7 cm clock wire creates issues. After I shortened the wire to less than 1cm all works fine. It seems there is no any kind of schmitt trigger gate forming properly the CLK input inside the chip! Never experienced this before with other manufactures...
    Thank you NorthGuy for your suggestions.
    #6
    ric
    Super Member
    • Total Posts : 29870
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: 18F26K80 SPI – SSPBUF floating - any ideas needed! 2021/01/19 02:06:39 (permalink)
    +1 (1)
    What is the bandwidth of that scope, and is it in "peak detect" mode?
    I suspect there is some ringing on that waveform that you are not seeing.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #7
    chrzesm
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2020/03/03 00:57:33
    • Location: 0
    • Status: offline
    Re: 18F26K80 SPI – SSPBUF floating - any ideas needed! 2021/01/19 03:28:04 (permalink)
    0
    It is 20MHz scope, LA can detect 10nsek spikes. During my investigation, I pulled the SCK to ground and VCC with 1kohm (with no improvement), so unlikely there were any induction coming to SCK line on the 7cm wire. The CLK source gave a crystal clear wave. I could not find any technical details how SCK input in K80 has been designed. I suspect there is simple "and" gate, while it should be schmitt like design.     

    Attached Image(s)

    #8
    oliverb
    Super Member
    • Total Posts : 403
    • Reward points : 0
    • Joined: 2009/02/16 13:12:38
    • Location: 0
    • Status: offline
    Re: 18F26K80 SPI – SSPBUF floating - any ideas needed! 2021/01/19 04:44:47 (permalink)
    0
    Have you tried any kinds of "termination" on the clock line? Possibly 47-100 ohms in series with the clock output or alternatively 100 ohms and 100pf RC network between the clock input and ground.
     
     
     
    #9
    1and0
    Access is Denied
    • Total Posts : 12086
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: 18F26K80 SPI – SSPBUF floating - any ideas needed! 2021/01/19 05:45:59 (permalink)
    0
    chrzesm
    I could not find any technical details how SCK input in K80 has been designed. I suspect there is simple "and" gate, while it should be schmitt like design.     

    SCK on RC3 is ST.
     
    https://ww1.microchip.com...030009977G.pdf#page=21
    #10
    chrzesm
    New Member
    • Total Posts : 9
    • Reward points : 0
    • Joined: 2020/03/03 00:57:33
    • Location: 0
    • Status: offline
    Re: 18F26K80 SPI – SSPBUF floating - any ideas needed! 2021/01/19 06:39:35 (permalink)
    0
    Thank you 1and0, right, it is ST according to the documentation, so I am a bit lost here.
    Interesting idea oliverb on the clock terminators, worth to try.
    #11
    Jump to:
    © 2021 APG vNext Commercial Version 4.5