SPI MISO needs pull resistor?

Started by mantonakakis, June 14, 2019, 12:14:30 PM

mantonakakis

So I'm using a low-power accelerometer break-out board that only has a SPI interface (Analog ADXL362, breakout via SparkFun; nice low-power accel, btw, 270nA in wake-on-shake mode!).
So far I don't have any real trouble with it, but when I sleep the M0, flashmem, radio, etc., I've come to expect ~8uA drawn from battery.

Instead, what I'm seeing is anywhere from 70-200uA, depending on where I touch the hardware. I noticed that if I touch the MISO pin, it drops to 8uA, I tried using a 1MOhm resistor to either pull up or pull down the MISO pin, which brought the sleep current back down to 8uA, and doesn't seem to affect the wake-on-shake functionality. So far I haven't tried taking readings this way, but with such a big resistor I don't imagine it would make an impact.

I'm guessing this external pull resistor shouldn't be needed, though, so maybe it's just a pin configuration that I need to change?

Felix

Interesting, so this is ONLY when you add the accel in the setup?

mantonakakis

Yes. For example, I have used a Moteino M0 + FLASH + RFM95 (with jumper wires for LMIC usage for the RFM RST, DIO1, and DIO2). If I add an external reed switch as my "sensor", and use it as an interrupt, e.g. wake up and report a change in switch state, everything works great. The M0 internal pullup is ~40kOhm, i.e. it draws >80uA at 3.3V when the interrupt pin is pulled low, so I instead use a much larger external pullup resistor, and get ~8uA sleep current. Theoretically I shouldn't use much larger than 1MOhm for this, but 4.7M seemed to work well.

If I get rid of that external switch, and attach the SPI accelerometer (3V3, GND, MISO, MOSI, SCK, SS on 10, accel interrupt output to 11), I get that higher sleep current, 70-200uA. The datasheet says that absolute worst-case current usage of the accelerometer is ~5uA @3.3V and 400Hz (yes, very low power!), and the way I'm using it, should be <300nA. I pulled down MISO with 1MOhm, and got the system back down to ~8uA, no other changes, with the wake-up functionality still working properly.

I am not very knowledgeable on serial communications, but it seems that once I finish talking to the accel, MISO is left to float, which was what I suspected was the issue. For example, I could touch the insulation on the MISO wire and get the current to change significantly. Touching the bare MISO pin with my finger immediately brought the current back to 8uA. MOSI doesn't seem to share this issue.

Here's the datasheet for the accel, relevant SPI info starts at the end of pg. 19, in the "invalid commands" section, where it mentions the MISO pin sometimes entering a high-impedance state: https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL362.pdf

This guy's answer seems to be relevant as well: https://electronics.stackexchange.com/a/234707

Felix

Ok but this sounds like this is specific to the accel (or SPI slave device) itself, would you agree with that?
In any case, I believe it could be resolved by putting the SPI device pins on the SAMD into a high impedance state. (SPI.end() before sleep?)

mantonakakis

Yes, it seems this is related to the accel, but if there is a SAMD fix for it, that's exactly what I was looking for. I will give that a try, thank you!