[CCC DEV] Sleep (when time permits)

Matt Jadud matt at jadud.com
Mon Jun 13 16:24:27 BST 2011


Hi all,

I know Christian and Omer did some explorations regarding the
implementation of sleep on the Arduino port of the TVM. I have a
question or two about it.

1. Does it preserve RAM? (I assume that because the TVM wakes and
resumes execution without crashing that the RAM state must be
preserved.)

2. What happens to peripherals / pin states at sleep-time? (For
example, if a pin is driven HIGH, does it drop LOW at the point of
sleep?)

3. What happens to peripherals at wake-time? (For example, if a pin
was HIGH, will it come back HIGH?)

I'm particularly curious about numbers 2 and 3. I'd like to deploy a
prototype temperature monitor into the field; the deadline for
completion would be July 3. Ideally, we'd be able to implement the
following behavior:

1. Wake on interrupt. (Use a Maxim DS3234 or similar to wake once
every hour, say.)
2. Power up SD card, sensors.
3. Read / record data.
4. Sleep.

What I'm wondering is whether or not we should have internal
interrupts in the VM so we can

wait.for.interrupt(AVR.SLEEP)

and

wait.for.interrupt(AVR.WAKE)

or similar. I'm not sure if that's the right idea, but my concern is
whether or not we need to give the developer the ability to write a
PROC that executes before sleep and after wake. Or, somewhere in their
code, to be able to use the sleep/wake state as a trigger for some
behavior. Is that something we would want/need?

In this particular case, I can do everything I need with INT0. I can
wait for the INT0 interrupt to wake the processor (which will start my
pipeline), and I can close things down myself after writing at the end
of the pipeline. I can even force the issue, and put the processor to
sleep at the end of the pipeline, so... that's probably not an issue,
either.

Anyway. I thought I'd share that. Now, back to working on slides...

Cheers,
Matt



More information about the developers mailing list