Go Down

Topic: wakeup from wait mode through Serial (Read 609 times) previous topic - next topic

aureliusss

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.
Code: [Select]

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();
}

CrossRoads

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.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

aureliusss

which datasheet are referring to?
the 10.1 section on the SAM3X datasheet i have, is about system controllers and peripheral mapping


CrossRoads

#4
Nov 20, 2013, 07:39 pm Last Edit: Nov 20, 2013, 07:44 pm by CrossRoads Reason: 1
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
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

aureliusss

is there anyone who can post some pseudocode? i looked at the datasheet but the code i wrote didnt work

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy