arduino / arduino/ArduinoCore-samd

I2C bus left in incorrect state when going to sleep

Open
#414 7 comments 0 reactions 0 assignees View on GitHub
waiting for feedback
Dominant language
C
Stars
502
Forks
740
PR merge metrics
No merged PRs in 30d

Description

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
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the provided sketch with hostWire, the RTC alarm callback, and LowPower.deepSleep(). Trace the I2C bus behavior as the MCU enters and leaves deep sleep; done means SCL and SDA do not remain in a state that causes excess sleep power and the next transaction still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.