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
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.
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'?
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.
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.
The series resistors are supressing ringing and preventing trouble with the SPI peripherals if the SPI is also used as ISP.
Which of the SPI pins are also used for ICSP in this dsPIC33 part?
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.
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.
Is the 3V3 rail correctly decoupled, i.e. bypass caps near all of the power pins?
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.
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:
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.
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.
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.
ahh the breadboard! the heaven of stray inductance, capacitance and resistance! (at least expert guys told me)
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.
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.
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?
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.
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.
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.
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.