Hi every one,
I'd like to put the SAM3X in sleep mode till something is receveid on the serial port. At section 5.5.3 of the SAM3X datasheet is written
The purpose of sleep mode is to optimize power consumption of the device versus response
time. In this mode, only the core clock is stopped. The peripheral clocks can be enabled. This
mode is entered via Wait for Interrupt (WFI) or Wait for Event (WFE) instructions with LPM = 0 in
PMC_FSMR.26
11057B–ATARM–28-May-12
SAM3X/A
The processor can be awakened from an interrupt if WFI instruction of the Cortex M3 is used, or
from an event if the WFE instruction is used to enter this mode.
do you think that the wakeup from the sleep mode should happen automatically if the interrupt procedure of the serial port is called?
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pmc_enable_sleepmode(0);
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available())
{
Serial.print(Serial.read());
pmc_enable_sleepmode(0);
}
}
this code seems to work, at least it echoes what i write on the serial. The problem is that i can't check the currrent consuption since i don't have a laboratory power supply
thanks Kove,
this stackoveflow post seems to confirm my method. It suggests even to try the backupMode, but the datasheet recommend to use backMode only for long wakepu time (wake up from back up mode takes approximately 0.5 ms that is too long for my application.) .