-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Low Power Mode [Help nedeed] #19
Comments
And this is my code that works to wake-up with interrupt to pin PA1 Rising. ` /**
#include "Arduino.h" #define LED_Pin PA4 void LED_Toogle(){ //Restart the clock after awake void enterStopMode(){ //Set the Regulator in Low Power and can be awake by an interrupt /*
void setup(){ void loop(){
} /** int main(void) |
Hello @FASTSHIFT have been a long time since opened this to ask, this week i got determined to solve it myself. Here i share a Low Power library I made putting together code from various tutorials, I include examples too. this a project file with the library and the example ready. I helps to easy enter the different modes, auto wakeup with rtc and or interrupt on pin PA0. just the Sleep mode seems it is not working. This is the library file |
Hello.
I have been for a while diving in information and looking in the internet before coming to ask.
I am testing out the Low Power Modes in the STM32F03F4P6, at this point I have been able to use the STOPMode and wake-up with a pin Interrupt, in my custom PCB the power goes low to 10uA, really good.
But I want to know how to make it awake every certain amount of time then sleep again, for example to read a sensor, send the data then sleep some minutes and do it again.
I have been trying using the Timer example, not success there. Probably I am missing something important. I read something about this line of code NVIC_SystemLPConfig(NVIC_LP_SLEEPONEXIT, ENABLE); but I really cannot understand the process to follow, if someone can point me in the right direction it will be great.
This is the code I have been trying unsuccessfully.
` #include "Arduino.h"
#define LED_Pin PA4
#define KEY_Pin PA1
void Timer1_Callback(){
pinMode(LED_Pin, OUTPUT);
togglePin(LED_Pin);
TIM_Cmd(TIM1, DISABLE);
InternalClocks_Init(); //Setup the clock after awake
}
void enterStopMode(){
Timer_SetInterrupt(TIM1, 1000000/@1s/, Timer1_Callback);
TIM_Cmd(TIM1, ENABLE);
//I dont know what the below line does but decrease the power by 10uA
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); //Turn on the power management clock
//Set the Regulator in Low Power and can be awake by an interrupt
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
}
//Set Pins to Analog to decrease power usage
void setPinsToAnalog(){
pinMode(PA0, INPUT_ANALOG);
pinMode(PA1, INPUT_ANALOG); //If set to analog Interrupt do not work
pinMode(PA2, INPUT_ANALOG);
pinMode(PA3, INPUT_ANALOG);
pinMode(PA4, INPUT_ANALOG);
pinMode(PA5, INPUT_ANALOG);
pinMode(PA6, INPUT_ANALOG);
pinMode(PA7, INPUT_ANALOG);
pinMode(PA9, INPUT_ANALOG);
pinMode(PA10, INPUT_ANALOG);
pinMode(PB1, INPUT_ANALOG);
pinMode(PF0, INPUT_ANALOG);
pinMode(PF1, INPUT_ANALOG);
}
void setup(){
pinMode(LED_Pin, OUTPUT);
pinMode(KEY_Pin, INPUT_PULLDOWN);
// it is supposed to allow to wakeup with the time but it did not work.
NVIC_SystemLPConfig(NVIC_LP_SEVONPEND, ENABLE);
}
void loop(){
//Just Keep the LED On to measure the running power
digitalWrite(LED_Pin, HIGH);
delay(5000);
digitalWrite(LED_Pin, LOW);
//Go to Sleep
setPinsToAnalog();
enterStopMode();
}
/**
*/
int main(void)
{
InternalClocks_Init(); //Set the internal clock @ 8MHz
Delay_Init();
setup();
for(;;)loop();
} `
The text was updated successfully, but these errors were encountered: