I am integrating a BME680 temperature, pressure and humidity sensor using SPI.

When I only use 33 Ohms series resistors, the system works fine. However, when adding Schmitt triggers (NL27WZ17DFT2G), ESD diodes (CM1224-04SO), and termination resistors, the sensor isn't recognized anymore, despite very low communication speeds (sub-MHz) over a meter of pairs each twisted with a ground wire.

What might be causing an issue in my system and what would be the best way to go about checking what's wrong?

Master side:

enter image description here

Sensor side:

enter image description here


3 Answers 3


You have the data pins wrong.

MOSI is output from MCU and should go to data input DI on the sensor.

Also the Schmitt trigger input requires least around 0.7×VCC supply which is around 2.31V (the value with 3.3V supply is not stated so beware).

Assuming the chip output is ideal, the 33R+100R resistor divider means there is at most 2.48V at input of next chip.

The chip needs to drive 3.3V into 133 ohm load which is 24.8mA.

But the chip is not ideal, in fact it is guaranteed to not drop more than 0.7V if supply is 3.0V and output current is 24mA.

It is possible that after the output voltage drops inside the chip and input threshold is not reached so there is not enough margin. It may work in room temperature but might not over full temperature range and manufacturing tolerance.

  • \$\begingroup\$ Thanks Justme. 1/ My understanding is that MOSI, SCK and SS are outputs from the MCU, and therefore enter the input of the driver of the MCU side, and then the input of the driver on the sensor side. MISO is the opposite. Is my logic wrong? 2/ Does that mean I should power the BME above 3.3V? How do I make sure to then protect the MCU pins which are not more than 3.3V tolerant? Level shifters? \$\endgroup\$
    – Tommy95
    Commented Jun 13 at 19:19
  • \$\begingroup\$ @Tommy95 Your logic is not wrong, the connections just do not follow your logic. MOSI is output from MCU, it must go to input of sensor, DI, but it doesn't. You have DO&DI swapped. \$\endgroup\$
    – Justme
    Commented Jun 13 at 19:20
  • \$\begingroup\$ Oh, gotcha, so it's MISO to SDO and MOSI to SDI. What a silly mistake, I'm off to scratching and rewiring the traces of my PCB then... Thanks Justme \$\endgroup\$
    – Tommy95
    Commented Jun 13 at 19:27
  • 1
    \$\begingroup\$ @Tommy95 And no you should not run these at 5V - the 133 ohm load ar 5V means 37mA current which exceeds the ratings. Also running it at 5V means 3.3V from MCU or may not be enough for the Schmitt input to see it high. \$\endgroup\$
    – Justme
    Commented Jun 13 at 19:35
  • \$\begingroup\$ So your advice, Justme, would be to lower the values ot the resistors? What would be a pragmatic way to determine their ideal value? I am also looking for a way to generate as little heat as possible as the sensor performs temperature measurements. \$\endgroup\$
    – Tommy95
    Commented Jun 14 at 15:47

LVCMOS logic lines aren't good to terminate, at least not that way.

The problem is the output is loaded down too much by the terminator, and the input threshold fails.

This is necessarily the case for source-load termination (100Ω input into 100Ω line with 100Ω terminator, halves the source voltage), i.e. the voltage range becomes 0/50% VCC, or 25/75% if midpoint terminated (i.e. use a 2 x 200Ω voltage divider from VCC to signal to GND). Whereas the CMOS input thresholds are typically 30/70%, so there's no margin left for component variation, induced noise, etc.

If you have a very low impedance source (bus driver, or several gates in parallel for that matter), you can get near full VCC on the line, but this takes a lot of power, too, and line resistance has a bigger impact (not that this will matter for most couple-meter links you'd be running SPI out to).

There is a compromise option: use an RC terminator, where C is slightly larger than the cable's total (lumped-equivalent) capacitance, and R equals Zo. There will still be some overshoot on the edge, but it's damped and can be made small enough not to activate clamp/ESD diodes.

Another option is to use a suitable line receiver. There are some single-ended standards, mostly archaic at this point I think, but one interesting device is the 74HC7014 which has a fixed, relatively precise 60% VCC input threshold, with hysteresis. A split terminator of say 180Ω up, 270Ω down, would do nicely, and any HC/LVC/etc. driver will do for the transmitter.

Otherwise, a comparator can be used as an overly precise line receiver.

Twisted pair is also not the best option for single-ended signals. You could start addressing this by driving complementary levels (with a pair of inverters, say, but the extra propagation delay to one line is not the best), but you still need a differential receiver. Note an LVCMOS input has no CM rejection and depends completely on its noise margin to function reliably. Best is to use a RS-422 transmitter/receiver pair, which will confer industrial-level EMC immunity.

You may also want some filtering on the signals. As a general rule, only use as much bandwidth as you need. For SPI of a few Mbps, a modest RC or LC (L should be a ferrite bead in this case) can roll off response above say 5 or 10MHz, and this accounts for a fair part of conducted EMI and most/all RFI. Do mind the return-trip propagation delay, you may need to buffer or reclock MISO at the MCU for example, or even use an independent SPI receiver and buffer and return the peripheral's SCK signal to the MCU (so that delays are matched round-trip).


The Schmitt triggers you have are open drain, which means they need a pull up. I only see pull downs on the sensor side.
I would change those 100Ω pull downs to 1kΩ pull ups. The chip can only sink 24mA, and with 100Ω and 3.3V ( if they were connected properly) it would try to sink 33mA. It's not recommended to run a device at or beyond its limits.
1kΩ would make it 3.3mA, which is much better for the device.

  • \$\begingroup\$ No they aren't. The "17" used here is push-pull, the "07" which the link goes to is open-drain. \$\endgroup\$
    – Justme
    Commented Jun 13 at 18:20
  • \$\begingroup\$ @Justme Serves me right for trusting the link. :) \$\endgroup\$
    – Aaron
    Commented Jun 13 at 18:24
  • \$\begingroup\$ I fixed the link now, points to manf data sheet not distrib. Were you going to revise your answer? \$\endgroup\$
    – TonyM
    Commented Jun 13 at 18:50
  • \$\begingroup\$ So sorry for this error, Aaron, thanks for the time taken to answer and for correcting it \$\endgroup\$
    – Tommy95
    Commented Jun 13 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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