3
\$\begingroup\$

There are two aspects here. The first question is related to R1 below:

enter image description here

The datasheet says: "R1 must be sized to ensure VIL and VIH of the devices are met" but gives no formula. So first question:

(1) How does one determine value of R1?

The datasheet gives maximum SPI SCK frequency for this device as 10MHz for 5V supply as given in Tables 1-1 and 1-2. However, for the read operation on the device where the SDI/SDO are multiplexed, the idea is different because:

enter image description here

The point 2 under the Table above says that the max SCK can be increased by using a pull up resistor. About these things I am wondering the following:

(2) Why is max SCK frequency lower for multiplexed SDI/SDO read operation only? (3) If I connect a pull-up resistor it will certainly form a voltage divider with the R1 in the first picture. How do I determine the value of both of these resistors then?

Finally, since the Table 1-1 and 1-2 give SCK Input Frequency for voltage 1.8V to 2.7V as 1MHz rather than 10MHz which applies to 2.7V to 5.5V.

(4) Why is the max SCK lowered at lower supply voltage?

\$\endgroup\$
2
\$\begingroup\$

How come it hasn't been answered in two years? Anyway...

Value of R1 with Host Controller Hardware SPI

This is actually a quite clever way to use hardware SPI for peripherals that have a shared SDO/SDI line.

You must simply ensure that the voltage drop induced by R1 does not make the digital levels on the SDI/SDO pin of the MCP4131 out-of spec.

Here is how to do it:

  • Take the worst low-level output voltage of your specific MCU (let's call it VOL_MCU, and assume it's 0.6V, like on some PIC MCUs).
  • Look up the input leakage of MCP4131: given page 9 of datasheet: IIL = +/-1µA max.
  • Look up the input leakage of your MCU: IIL_MCU (I assume it's also +/-1µA max).
  • Look up the maximum voltage you must meet for low-level input of MCP4131: given page 9 also: VIL = 0.2VDD = 0.9V (assuming 4.5V supply)

The maximum resistor value (for low level case) is R = U/I = (VIL - VOL_MCU)/(IIL + IIL_MCU) = 150k (in this example).

Do the same for high-level: R = U/I = (VOH_MCU - VIH)/(IIL + IIL_MCU) = ((VDD-0.7) - 0.45*VDD)/2µ ~= 890k (assuming 4.5V supply and VOH_MCU = VDD-0.7)

The lowest value gives you an idea of the limit. But the higher the resistance, the worse the maximum frequency. I'd choose something much lower, like 10k, actually.

To get an idea of the allowable frequency range depending on R1, you can compute the RC time constant with the chosen R1 and C=(stray capacitance of the MCU SDI pin + MC4131 SDO/SDI pin). Apply some safety factor here.

Why is max SCK frequency lower for multiplexed SDI/SDO read operation only?

Certainly because of the way the SDI/SDO pin is internally driven. Since it says only the read is affected, and that a pull-up can improve the speed, we can assume it's because the multiplexed SDI/SDO pin high-level output fet cannot be driven very strongly. Only Microchip can really answer that, but just trust them.

If I connect a pull-up resistor it will certainly form a voltage divider with the R1 in the first picture.

Indeed.

How do I determine the value of both of these resistors then?

You must modify the above low-level R1 calculation formula to ensure that, with this additional pull-up, you still have a low-level voltage within specs. Let's draw the equivalent schematic (calling this pull-up R2):

equivalent schematic

Now, solve this. Since I'm waaaay too lazy, I just did a quick simulation and it told me (with the same assumptions as above regarding VDD, VOL_MCU, etc... and for R1 in the range 1k to 10k) that R2 needs to be greater than 12 times R1 to get a valid low level. Now, the datasheet doesn't say what frequency this will allow you to reach, so you'd need to make some tests anyway.

Also, if you use low resistor values, check you don't exceed maximum output currents given in the datasheets.

Why is the max SCK lowered at lower supply voltage?

This is the case for all MCU/CPUs (overclockers know that well). With higher supply voltages, you can reach higher frequencies because the output fets can be driven stronger: the rise/fall slew rate can be higher when the fet gates are driven with higher voltage, so the rise/fall time is lower and frequency can be higher. This is at the cost of power consumption, of course.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.