Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 11 of 11

Thread: Noise on GND from SPI (SCK)... what is normal?

  1. #1

    Noise on GND from SPI (SCK)... what is normal?

    I am probing the output of my Teensy 3.1 board which is driving driving some SPI peripherals... Everything works as expected, but I do see some very high frequency noise on the power rails, which is related to the SPI bus whenever SCK is transitioned.

    The noise is about 100mV spikes in the 5nS range, measuring straight from the GND to 3.3V on the teensy itself.

    So, I wondered if this is normal on the Teensy 3.1?
    I thought the decoupling caps would have taken care of (most of) the high frequency noise?

    Any insight is appreciated!

    JK

    Attachment 4216

  2. #2
    Senior Member
    Join Date
    Jan 2015
    Location
    frisia
    Posts
    285
    measuring straight from the GND to 3.3V on the teensy itself.
    Which 3V3, which GND? Also preferably measured with the ground spring, or a short wire attached to the ground near the tip.
    Click image for larger version. 

Name:	PSo3N.jpg 
Views:	152 
Size:	197.7 KB 
ID:	4217
    I can try to measure on mine. What kind of loading do you have on the clock line? (R and C)
    I can not open your attachment.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,452
    100 mV seems like quite a lot. I'd also suspect issues with the measurement technique.

    Can you try using pin 14 for SCK, using SPI.setSCK(14) before SPI.begin(), to reconfigure for pin 14.

    Because pin 13 has the LED, the SPI library enables the higher current option for the pin. I believe it will default to the lower current option on pin 14. That will likely make some difference. Maybe?

  4. #4
    Quote Originally Posted by PaulStoffregen View Post
    100 mV seems like quite a lot. I'd also suspect issues with the measurement technique.

    Can you try using pin 14 for SCK, using SPI.setSCK(14) before SPI.begin(), to reconfigure for pin 14.

    Because pin 13 has the LED, the SPI library enables the higher current option for the pin. I believe it will default to the lower current option on pin 14. That will likely make some difference. Maybe?
    Hmm, thanks for the tips... I was able to get some major improvement by adding even more decoupling 100nF caps on a relatively long trace for the rails and SPI bus. Putting a 20MHz bandwidth limit on the scope and using a shorter ground connection also cleaned up the measurements.

    I am using the SPI4Teensy library, is there some documentation on this high current option for the pins?
    I did a bit of searching in the Kinetis reference manual without much luck.

    JK

  5. #5
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,552
    Quote Originally Posted by JKIM View Post
    Hmm, thanks for the tips... I was able to get some major improvement by adding even more decoupling 100nF caps on a relatively long trace for the rails and SPI bus. Putting a 20MHz bandwidth limit on the scope and using a shorter ground connection also cleaned up the measurements.

    I am using the SPI4Teensy library, is there some documentation on this high current option for the pins?
    I did a bit of searching in the Kinetis reference manual without much luck.

    JK
    If you want to learn how to do it yourself, perhaps look at chapter 11.14.1 in the refManual.
    But i don't know where to find the exact electrical specs.

  6. #6
    Quote Originally Posted by Frank B View Post
    If you want to learn how to do it yourself, perhaps look at chapter 11.14.1 in the refManual.
    But i don't know where to find the exact electrical specs.
    Wow, even better! thanks!

    I turned off the drive strength for SCK and MOSI and get a considerable noise improvement.

    I see that PORT_PCR_DSE is being set for any pins designated as output in the pinMode function, how can I determine if/when drive strength is needed on a particular pin?

    JK

  7. #7
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,552
    good question :-)
    if you want to be sure, set it yourself..
    don't know.

    Edit:
    the slew rate can be important too, for fast toggling or a spi-clk
    Last edited by Frank B; 05-05-2015 at 09:20 PM.

  8. #8
    Quote Originally Posted by Frank B View Post
    good question :-)
    if you want to be sure, set it yourself..
    don't know.
    Well, I did the "sensible" thing and disabled DSE in the pinMode function for everything.
    I'm not driving any major loads with my output pins, so hopefully it should not be a problem.

    Now my noise problem is obsolete, thanks for the help everyone.

    JK

  9. #9
    Senior Member
    Join Date
    Mar 2013
    Posts
    651
    Quote Originally Posted by PaulStoffregen View Post
    100 mV seems like quite a lot. I'd also suspect issues with the measurement technique.

    Can you try using pin 14 for SCK, using SPI.setSCK(14) before SPI.begin(), to reconfigure for pin 14.

    Because pin 13 has the LED, the SPI library enables the higher current option for the pin. I believe it will default to the lower current option on pin 14. That will likely make some difference. Maybe?
    Are pins 13 and 14 interchangeable or does 14 have drawbacks vs 13?

  10. #10
    Junior Member
    Join Date
    Dec 2018
    Posts
    16
    Quote Originally Posted by JKIM View Post
    Wow, even better! thanks!

    I turned off the drive strength for SCK and MOSI and get a considerable noise improvement.

    I see that PORT_PCR_DSE is being set for any pins designated as output in the pinMode function, how can I determine if/when drive strength is needed on a particular pin?

    JK
    Hi Everybdy,

    I have exactly the same problem.
    The SPI exchanges 30 bytes 1000 times per second and Audio Board amplifies annoying 1000Khz signal.

    I'm using
    Code:
    #include <SPI.h>
    Can someone, please, point me where to disable DSE for the SPI1?
    Last edited by s_arty; 05-01-2020 at 01:05 AM.

  11. #11
    Junior Member
    Join Date
    Dec 2018
    Posts
    16
    just in case if anybody is still fighting the problem:
    http://https://forum.pjrc.com/thread...-Fun-with-pins
    it's quite elegant solution, but not compatible with 4.1, at least right out of the box.

    And disabling SRE didn't solve my problem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •