Hi Everyone,
I have a problem at hand that is confusing me quite a bit. So here is a general description of my setup:
ATMega328P at 3.3v and 8mhz hooked up to a MMA8452Q breakout from sparkfun via i2c and interrupt (INT0).
The 328p sets up the 8452Q accelerometer and then goes into sleep. The 8452q will send an interrupt signal via INT0 when it detects a tap. The 328p wakes up when it detects an interrupt (rising) on a external interrupt. It will then access register 0x0C to determine that the interrupt is generated by a tap. Then, it reads register 0x22 to see which direction the tap came from (XYZ). If the direction is X, Y, or Z, it will trigger a LED to turn on for 50ms and go back to sleep.
The 328p is functioning correctly. It sleeps at around 0uA(it's probably somewhere around 1uA, but my multimeter can't measure it). However, the 8452q is not. I have set the rate at 50hz and the datasheet says that the current draw should be ~24uA. When first powered up, the total current draw of the MCU and the 8452Q is 26uA. But if I tap it once, the LED turns on, then off, and the current of the whole system no longer goes back down to 26 uA. It stays at around 351 uA. I am very confused at what is causing this.
I think that the 8452Q is still waiting for the MCU to read some register, which causes it to use so much current. The problem is that I don't know what register.
Can anyone explain what is going wrong and maybe help me figure out a solution? If you need anymore info, just ask.