Skip to content

I2C bus left in incorrect state when going to sleep #414

Open
@sslupsky

Description

@sslupsky

There is an issue with the I2C bus state when using low power deep sleep. The problem occurs when the sleeping. When the I2C master goes to sleep, the SCL and SDA lines are pulled low while the MCU is sleeping. This causes excessive power consumption during sleep because of the I2C pull up resistors. The next time the master wakes up, the SCL and SDA lines are pulled high and stay that way until the next I2C transaction. This cycle repeats. Here is the sketch. In this example, the rtc alarm event fires every 10 seconds.

void loop() {
  Watchdog.reset();
  if ( rtcTick >= heartBeatTick ) {
    heartBeatTick += HEARTBEAT_PERIOD;
    hostWire.beginTransmission(2);
    hostWire.write("Blink");
    hostWire.endTransmission();
  }
  LowPower.deepSleep();
}

void rtcAlarmEvent() {
// RTC alarm wake interrupt callback
  rtcTick += RTC_ALARM_PERIOD;
  rtc.setAlarmEpoch( rtcTick );  //  Set the time for the next RTC Alarm
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions