Series Resistor on SPI bus - Page 1
Forum section: electronics / projects

author: creeg2
author_rank: Newbie
timestamp: October 03, 2012, 01:12:18 am
content: 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.pdfI 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

author: TerminalJack505
author_rank: Super Contributor
timestamp: October 03, 2012, 02:08:26 am
content: 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.

author: Jad.z
author_rank: Regular Contributor
timestamp: October 03, 2012, 10:37:18 am
content: Hi Chris,These series termination resistors are used to prevent glitches and reduce ringing on the digital lines. Signal integrity stuffFor 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.

author: Codemonkey
author_rank: Regular Contributor
timestamp: October 03, 2012, 12:01:38 pm
content: Quote from: Jad.z on October 03, 2012, 10:37:18 amDid 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.

author: Unknown
author_rank: Unknown
timestamp: October 03, 2012, 01:37:34 pm
content: 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'?

author: Codemonkey
author_rank: Regular Contributor
timestamp: October 03, 2012, 01:55:29 pm
content: Quote from: alm on October 03, 2012, 01:37:34 pmNope, 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.

author: Unknown
author_rank: Unknown
timestamp: October 03, 2012, 02:23:10 pm
content: 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.

author: madires
author_rank: Super Contributor
timestamp: October 03, 2012, 02:37:30 pm
content: The series resistors are supressing ringing and preventing trouble with the SPI peripherals if the SPI is also used as ISP.

author: Unknown
author_rank: Unknown
timestamp: October 03, 2012, 08:55:35 pm
content: Which of the SPI pins are also used for ICSP in this dsPIC33 part?

author: creeg2
author_rank: Newbie
timestamp: October 06, 2012, 12:18:39 am
content: 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.

author: jeremy
author_rank: Super Contributor
timestamp: October 06, 2012, 03:13:02 am
content: 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

author: andyturk
author_rank: Frequent Contributor
timestamp: October 08, 2012, 10:48:19 pm
content: 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.

author: Unknown
author_rank: Unknown
timestamp: October 08, 2012, 10:51:28 pm
content: Is the 3V3 rail correctly decoupled, i.e. bypass caps near all of the power pins?

author: andyturk
author_rank: Frequent Contributor
timestamp: October 08, 2012, 11:42:12 pm
content: Quote from: alm on October 08, 2012, 10:51:28 pmWell, 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.

author: andyturk
author_rank: Frequent Contributor
timestamp: October 09, 2012, 12:02:29 am
content: 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:

author: Unknown
author_rank: Unknown
timestamp: October 09, 2012, 12:15:29 am
content: 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.

author: TerminalJack505
author_rank: Super Contributor
timestamp: October 09, 2012, 12:31:46 am
content: 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 ofthis 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.

author: andyturk
author_rank: Frequent Contributor
timestamp: October 09, 2012, 01:10:28 am
content: Quote from: alm on October 09, 2012, 12:15:29 amYou'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.

author: Mechatrommer
author_rank: Super Contributor
timestamp: October 09, 2012, 01:36:04 am
content: ahh the breadboard! the heaven of stray inductance, capacitance and resistance! (at least expert guys told me)

author: andyturk
author_rank: Frequent Contributor
timestamp: October 09, 2012, 01:47:38 am
content: Quote from: TerminalJack505 on October 09, 2012, 12:31:46 amI'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.QuoteI 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.QuoteI 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?QuoteI've only got one device using SPI:this displayfrom 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.

author: TerminalJack505
author_rank: Super Contributor
timestamp: October 09, 2012, 02:23:35 am
content: QuoteYes, 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.QuoteKeep in mind that the series resistor is going to affect the maximum edge rate. 1k may be too big.

author: Bored@Work
author_rank: Super Contributor
timestamp: October 09, 2012, 06:13:38 am
content: Quote from: andyturk on October 08, 2012, 11:42:12 pmYour oscilloscope probing technique does not inspire confidence. I can't see a probe ground connection.

author: andyturk
author_rank: Frequent Contributor
timestamp: October 09, 2012, 06:22:37 am
content: Quote from: Bored@Work on October 09, 2012, 06:13:38 amLook closely. ;-)