Hi everyone,
i'm working on a mobile application in which i need to keep low power as much as i can.
i'd like to wake the processor up only when some data arrive on the Serial.
this is code i write but (of course) it's not working. i'd really appreciate any kind of advice or help.
boolean flag;
void setup()
{
interrupts();
Serial.begin(9600);
pmc_enable_waitmode();
PMC -> PMC_FSMR |= PMC_FSMR_FSTT4; //Set FSTT4 = 1
}
void loop()
{
if(flag)
{
interrupts();
Serial.println("cci tua");
}
}
ISR(URXD_vect)
{
flag = 1;
noInterrupts();
}
See 10.1, Sleep Modes.
It appears you will have to wake on a PCINT, maybe from the RX pin directly, or perhaps tie the RX pin to another pin and wake from a PCINT there.
which datasheet are referring to?
the 10.1 section on the SAM3X datasheet i have, is about system controllers and peripheral mapping
Ah, Due - I missed that. Never mind.
See these instead:
5.5 Low Power Modes
5.6 Wake-up Sources
The wake-up events allow the device to exit the backup mode. When a wake-up event is
detected, the Supply Controller performs a sequence which automatically reenables the core
power supply.
Probably use one of these pins:
WKUPEN0-15 pins
is there anyone who can post some pseudocode? i looked at the datasheet but the code i wrote didnt work