Author Topic: Series Resistor on SPI bus  (Read 40779 times)

0 Members and 1 Guest are viewing this topic.

Offline creeg2Topic starter

  • Newbie
  • Posts: 4
Series Resistor on SPI bus
« on: October 03, 2012, 01:12:18 am »
Hi all,

I am doing a design that uses a SPI bus to communicate between a microcontroller and an ADC.  In the developer kit for the ADC, they utilize series 100 ohm resistors on the SPI bus. 

http://ww1.microchip.com/downloads/en/DeviceDoc/103-00310-R1.pdf

I was wondering what these are used for and how I should incorporate them into my design instead of just putting them in because it was in the reference design.

I suppose it has something to do with properly terminating the high speed bus?

Thanks,
Chris R
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: Series Resistor on SPI bus
« Reply #1 on: October 03, 2012, 02:08:26 am »
Those resistors might be there to limit current in the event that the output pins get shorted to ground or Vcc or if an input is mistakenly configured as an output.  They might also be there to reduce the slew rate so that the effect of ground bounce is reduced.
« Last Edit: October 03, 2012, 02:35:33 am by TerminalJack505 »
 

Offline Jad.z

  • Regular Contributor
  • *
  • Posts: 83
  • Country: 00
Re: Series Resistor on SPI bus
« Reply #2 on: October 03, 2012, 10:37:18 am »
Hi Chris,

These series termination resistors are used to prevent glitches and reduce ringing on the digital lines. Signal integrity stuff  ;)


For more on the subject:

1- Source Termination Resistors.

2- Transmission Lines, Reflections, and Termination.

3- Source Termination Resistor Location And Its Impact On The Signal Integrity Of High Impedance Loads.
 

Offline Codemonkey

  • Regular Contributor
  • *
  • Posts: 235
  • Country: gb
Re: Series Resistor on SPI bus
« Reply #3 on: October 03, 2012, 12:01:38 pm »
Hi Chris,

These series termination resistors are used to prevent glitches and reduce ringing on the digital lines. Signal integrity stuff  ;)


For more on the subject:

1- Source Termination Resistors.

2- Transmission Lines, Reflections, and Termination.

3- Source Termination Resistor Location And Its Impact On The Signal Integrity Of High Impedance Loads.

Did you actually look at the schematic he linked to ? The resistors in question are in series with all the SPI signals, not between them and GND, so I doubt they are termination resistors. I'd agree with the other posters, that they are for either protection or slew rate limiting.
 

alm

  • Guest
Re: Series Resistor on SPI bus
« Reply #4 on: October 03, 2012, 01:37:34 pm »
Codemonkey, before you posted the snippy reply to Jad.z, did you consider the difference between source and load termination? Especially since two of the three titles mention 'source termination'?
 

Offline Codemonkey

  • Regular Contributor
  • *
  • Posts: 235
  • Country: gb
Re: Series Resistor on SPI bus
« Reply #5 on: October 03, 2012, 01:55:29 pm »
Codemonkey, before you posted the snippy reply to Jad.z, did you consider the difference between source and load termination? Especially since two of the three titles mention 'source termination'?

Nope, I looked at the schematic where its quite obvious that they've stuck the resistors on those pins (SPI + Reset) at the slave end, not the master (so not source termination) - to either protect them from spikes coming in from the SPI connector or to slew rate limit them.
 

alm

  • Guest
Re: Series Resistor on SPI bus
« Reply #6 on: October 03, 2012, 02:23:10 pm »
Fair enough. Locating three series resistors at the load end and one at the source end would be very odd for termination. Based on the PCB layout, protection for when the SPI header is used instead of the dsPIC seems to be the most likely explanation, although I'm sure they will also limit the slew rate.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 7695
  • Country: de
  • A qualified hobbyist ;)
Re: Series Resistor on SPI bus
« Reply #7 on: October 03, 2012, 02:37:30 pm »
The series resistors are supressing ringing and preventing trouble with the SPI peripherals if the SPI is also used as ISP.
« Last Edit: October 03, 2012, 02:42:47 pm by madires »
 

alm

  • Guest
Re: Series Resistor on SPI bus
« Reply #8 on: October 03, 2012, 08:55:35 pm »
Which of the SPI pins are also used for ICSP in this dsPIC33 part?
 

Offline creeg2Topic starter

  • Newbie
  • Posts: 4
Re: Series Resistor on SPI bus
« Reply #9 on: October 06, 2012, 12:18:39 am »
Thanks for the replies everyone.

I'd agree that they look like protection resistors more than bus termination resistors.  Since this is a dev board schematic, I'd assume they'd develop it to be particularly robust to show off the product flawlessly.

I'll put in some 0 ohm resistors to start with and then change it if needed.
 

Offline jeremy

  • Super Contributor
  • ***
  • Posts: 1079
  • Country: au
Re: Series Resistor on SPI bus
« Reply #10 on: October 06, 2012, 03:13:02 am »
When I do AVR work, I always put resistors on the SPI lines so that the ISP programmer (also over SPI) takes precedence over other peripherals. see: http://avrprogrammers.com/avr-isp-spi.php
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: Series Resistor on SPI bus
« Reply #11 on: October 08, 2012, 10:48:19 pm »
Can you guys talk more about the ringing and slew rate issues? I've got an SPI display in one of my projects and whenever new bits get sent to the display, there's a whole bunch of nasty noise that shows up on the 3.3v power rail. The digital stuff doesn't seem to mind too much, but I'm also sampling some analog signals while this is happening and the ADC is picking up the power supply noise as if its part of the signal. Why would SPI activity cause this?

The attached scope trace shows the 3.3v power rail (AC coupled) through three screen repaints.
 
The following users thanked this post: Sjoertdb

alm

  • Guest
Re: Series Resistor on SPI bus
« Reply #12 on: October 08, 2012, 10:51:28 pm »
Is the 3V3 rail correctly decoupled, i.e. bypass caps near all of the power pins?
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: Series Resistor on SPI bus
« Reply #13 on: October 08, 2012, 11:42:12 pm »
Is the 3V3 rail correctly decoupled, i.e. bypass caps near all of the power pins?
Well, this thing lives on a breadboard and there are essentially three different components: 1) a cpu board with the power supply, 2) the spi display, and 3) a sensor board. The CPU board has a 100uF cap right next to the 3.3v regulator and the mcu itself is decoupled at each power pin. The spi display board has some decoupling caps near a level-shifting buffer. I don't really need the buffer, but the display was built to work with 5v. The sensor board has decoupling caps around each sensor (2 pressure sensors). There's also a 555 and a quad op amp living on the board and neither of those are decoupled (I'm not sure how to decouple a 555 anyway).

It might have something to do with how things are placed on the breadboard. I recently rebuilt it and it didn't have the noise problem before.

 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: Series Resistor on SPI bus
« Reply #14 on: October 09, 2012, 12:02:29 am »
The 3.3v crap essentially mirrors the spi clock for the display. The yellow trace is 3.3v (AC coupled), the blue trace is SCK:

 

alm

  • Guest
Re: Series Resistor on SPI bus
« Reply #15 on: October 09, 2012, 12:15:29 am »
Troubleshooting signal integrity on a solderless breadboard is a waste of time in my opinion. Might very well be coupling between those long wires, try moving suspect wires and see if the noise on the power rail changes.
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: Series Resistor on SPI bus
« Reply #16 on: October 09, 2012, 12:31:46 am »
What are the size of the caps you are using to decouple the MCU?  They'll need to be something like 100nF ceramic caps.  You might even use a couple of caps of different sizes (100nF and 10nF, for example.)  Smaller caps will help with the higher frequencies so you might experiment with different sizes.

You can try the series resistor trick too to reduce the slew rate. 

A ferrite bead at each of the MCUs supply pins can help keep high frequency noise out as well.  This keeps noise from coming out of the MCU due to fast switching as well as keeping noise from getting in.  Check out section 2.1 of this document.

All of this assumes that the problem you are trying to solve is ground bounce and/or Vcc sag.  This could be caused by your SPI bus having a fair amount of capacitance (a lot of SPI devices on the bus, for example.)  Driving this capacitance demands large amounts of current which can cause temporary hick-ups in the supply rails.  If you can't reduce the capacitance then decoupling caps are what usually solve this problem.
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: Series Resistor on SPI bus
« Reply #17 on: October 09, 2012, 01:10:28 am »
Troubleshooting signal integrity on a solderless breadboard is a waste of time in my opinion.
You're probably right. I just re-did some wiring and things changed. Unfortunately, it's all I have to work with for now. What I really need is a function generator so I can put a known signal into the ADC without having to debug the analog circuitry at the same time.
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11537
  • Country: my
  • reassessing directives...
Re: Series Resistor on SPI bus
« Reply #18 on: October 09, 2012, 01:36:04 am »
ahh the breadboard! the heaven of stray inductance, capacitance and resistance! (at least expert guys told me)
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: Series Resistor on SPI bus
« Reply #19 on: October 09, 2012, 01:47:38 am »
What are the size of the caps you are using to decouple the MCU?
I've got what ST recommends for the STM32F103 part--100nF ceramics next to the power pins and a 4.7uF ceramic next to the analog VDD pin.

Quote
You can try the series resistor trick too to reduce the slew rate.
I did! And it works. I put a 1K resistor on the SCK line going to the display and that cut the noise on the power rail by 50%. I hope that a decent layout with a proper PCB will clear up the problem entirely, but for now, since all I've got is a breadboard, resistors will help.

Quote
A ferrite bead at each of the MCUs supply pins can help keep high frequency noise out as well.
I was planning to use a ferrite bead on the VDD (analog) supply for the PCB version. You recommend putting them in front of all the mcu power pins?

Quote
All of this assumes that the problem you are trying to solve is ground bounce and/or Vcc sag.  This could be caused by your SPI bus having a fair amount of capacitance (a lot of SPI devices on the bus, for example.)  Driving this capacitance demands large amounts of current which can cause temporary hick-ups in the supply rails.  If you can't reduce the capacitance then decoupling caps are what usually solve this problem.
I've only got one device using SPI: this display from Adafruit. This noise thing is the second issue I've had with it. The first is that while others have gotten it to run at a 10MHz clock, mine seems to get lost at anything over 2MHz. Maybe this is just the breadboard getting in the way again, or maybe there's some problem with my particular copy.
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: Series Resistor on SPI bus
« Reply #20 on: October 09, 2012, 02:23:35 am »
Quote
I was planning to use a ferrite bead on the VDD (analog) supply for the PCB version. You recommend putting them in front of all the mcu power pins?

Yes, this is to prevent the noise generated by the MCU from being coupled back onto the power rails.  A ferrite bead on the analog supply is a good idea too, of course.

Quote
I've only got one device using SPI: this display from Adafruit. This noise thing is the second issue I've had with it. The first is that while others have gotten it to run at a 10MHz clock, mine seems to get lost at anything over 2MHz. Maybe this is just the breadboard getting in the way again, or maybe there's some problem with my particular copy.

Keep in mind that the series resistor is going to affect the maximum edge rate.  1k may be too big.
 

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3932
  • Country: 00
Re: Series Resistor on SPI bus
« Reply #21 on: October 09, 2012, 06:13:38 am »
Well, this thing lives on a breadboard and there are essentially three different components:

Your oscilloscope probing technique does not inspire confidence. I can't see a probe ground connection.
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: Series Resistor on SPI bus
« Reply #22 on: October 09, 2012, 06:22:37 am »
Your oscilloscope probing technique does not inspire confidence. I can't see a probe ground connection.



Look closely. ;-)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf