Pages: [1]   Go Down
Author Topic: wakeup from wait mode through Serial  (Read 492 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 1
Posts: 160
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27115
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Full Member
***
Karma: 1
Posts: 160
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Full Member
***
Karma: 1
Posts: 160
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

sorry but bump
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 538
Posts: 27115
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: November 20, 2013, 01:44:54 pm by CrossRoads » Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Full Member
***
Karma: 1
Posts: 160
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: