Hello,
Regarding battery powered projects that use I2C or SPI sensors - what are you supposed to do to sleep the microcontroller? Are you suppose to disable these peripherals, and then re-enable and re-initialize them when you wake?
I've been working on an mBED project, and it seems I2C sensors I don't worry about disabling I2C when I sleep. I just go to sleep and there's not really much additional current consumption. And when I wake I'm able to read sensor data without explicitly re-initializing. I don't know if the library is doing that for me or if I2C implementation just doesn't require disabling and re-starting after sleep.
But I recently tried a accelerometer that runs on SPI, and I keep getting 300uA sleep current (normal is 4uA). Is there a lot of variation in how libraries for I2C and SPI work - where one library might disable the bus for you when you sleep, but another won't? Or is I2C inherently different from SPI in terms of sleep current consumption when the peripheral is left on?
If you're curious, these are my I2C and SPI examples:
I2C:
SPI: