• AVR Freaks

Hot!USB module disturbs SPI module

Author
GoEk
Senior Member
  • Total Posts : 120
  • Reward points : 0
  • Joined: 2012/09/27 00:32:28
  • Location: Sweden
  • Status: offline
2018/10/26 05:10:27 (permalink)
0

USB module disturbs SPI module

Hi,
using a PIC24FJ256GB210 chip as a USB device using the MLA 2017-03-06 USB Device code and I have a problem with the USB system really disturbing the SPI3 module, i.e. the SPI module looses sync and skips parts of the SCK Clock cycle. The attached image shows the USB interrupt (port pin toggle) at the top trace and the SPI SCK bottom trace.
 
The SPI port runs fine until I plug in the USB Cable (USB module starts) and then the SPI SCK hickup is in sync with the USB interrupt. The SPI port is in Standard mode and uses PIC device pins 76-78. EDIT: It seems to not be a PPS issue, problem remains after pin reassign.
 
I have two other SPI ports also Active, talking to external FLASH devices but they have no such problems, USB or not.
 
Anyone seen this/know about it?
 
Regards
Goran
post edited by GoEk - 2018/10/26 06:00:56

Attached Image(s)

#1

3 Replies Related Threads

    BobAGI
    Super Member
    • Total Posts : 1725
    • Reward points : 0
    • Joined: 2011/03/09 00:04:35
    • Location: Texas and Sweden
    • Status: offline
    Re: USB module disturbs SPI module 2018/10/26 06:10:43 (permalink)
    0
    It seems to me like the clock irregularity (bottom trace) happens well before the fall of the top trace so how can the clock problem depend on the top trace activity? Or have you time reversed the image?

    --
    Bo B
    Sweden & Texas
     
    #2
    GoEk
    Senior Member
    • Total Posts : 120
    • Reward points : 0
    • Joined: 2012/09/27 00:32:28
    • Location: Sweden
    • Status: offline
    Re: USB module disturbs SPI module 2018/10/26 06:25:16 (permalink)
    0
    BobAGI
    It seems to me like the clock irregularity (bottom trace) happens well before the fall of the top trace so how can the clock problem depend on the top trace activity? Or have you time reversed the image?

    As you see there is about 600ns from the clock disturbance to the pin toggle. The pin toggle is first in the USB ISR so with interrupt overhead I interprete it as the disturbance is in sync with the cause of the USB interrupt.
    #3
    GoEk
    Senior Member
    • Total Posts : 120
    • Reward points : 0
    • Joined: 2012/09/27 00:32:28
    • Location: Sweden
    • Status: offline
    Re: USB module disturbs SPI module 2019/07/03 11:04:32 (permalink)
    0
    To follow up this case. Unfortunately MC could not replicate the problem. One important detail that may help someone is that if I switched the MLA USB Device stack from Interrupt mode to Polled mode the disturbance went away. The disturbance also caused stretching of the SPI CLK signal.
    post edited by GoEk - 2019/07/03 11:06:50
    #4
    Jump to:
    © 2019 APG vNext Commercial Version 4.5