

10:00 pm

August 8, 2016

Hi,
I am trying to write a basic VI that performs some tasks (logging or just writing an RTC value to serial for now). When I power down the Arduino programmatically with the Sleep Mode Power Down vi, I can wake it up fine on INT0 (Pin2), but once I want to resume reading the RTC: nothing. I suspect the I2C bus has to be re-enabled. This link touches on the topic (search for "Waking I2C" on the page), but I fail to see how to implement the Wire.begintransmission followed by wire.endtransmission with the current API to re-enable I2C communication with the slave (RTC).
// wake slave up Wire.beginTransmission (SLAVE_ADDRESS); Wire.endTransmission (); delay (5); // give it time to recover Wire.beginTransmission (SLAVE_ADDRESS); bla bla...
Thx
ldbm.
Hardware: Uno, RT1307
PS: is there a way to enable other Arduino sleep modes (where for instance Timer1 on Arduino would still be powered). They are just a different switch while coding directing into the Arduino environment. Thx.
2:13 pm

March 12, 2015

You can use I2C Write Byte with write mode set to "Begin and End". This will do a beginTransmission(), clock a byte, then endTransmission(). Having the byte clocked should not matter for waking up.
Also, for the Arduino sleep modes, the Compiler only implements SLEEP_MODE_PWR_DOWN but you can make your own APIs by following the help manual to implement other sleep modes if desired.
5:20 pm

August 8, 2016

Thx Steffan,
I did try that, but no success yet. I will give it another go.
On some examples, it seems like a good idea to not use the Disable / Enable Interrupt while the main code has awaken, but rather to destroy the Interrupt (on the interrupt Service routine), and re-define the Interrupt before going to sleep. Do you agree ? Or the Disable Enable good enough? Thx.
ldbm.
8:58 pm

March 12, 2015

I dont think you need to destroy and re-define the I2C interrupts if thats what you are referring to. There is some info here about an I2C slave powering down and waking back up: http://www.gammon.com.au/power
Seems like you should call begin again after wakeup. Best think to do is write a simple sketch in the Arduino IDE to figure out how to wake it up properly then port it over.
105
1 Guest(s)
