Hello,
I'm using Moteino R4 with LoRa module RFM96 (915Mhz) and 4Mbit flash chip.
MCU's pins are not connected to any peripherals.
I want to get lowest values of power consumption in sleep mode.
I've noticed that if I use test code MCU doesn't wakeup after timeout:
#include "LowPower.h"
#include <SPIFlash.h>
#include <SPI.h>
#include <RH_RF95.h>
SPIFlash flash(8, 0xEF30);
RH_RF95 driver;
void setup()
{
Serial.begin(9600);
Serial.println(">>>>> server init ok");
}
void loop()
{
Serial.println(">>> hello!");
delay(1000);
Serial.println(">>> go sleep");
Serial.flush();
flash.sleep();
driver.sleep();
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
Serial.println(">>> wakeup!");
delay(1000);
}
Also it consumes about 5mA in this sleep mode which is quite high.
Once I commented strings:
flash.sleep();
and
driver.sleep();
it starts to wakeup.
This code works ok with Anarduino MCU which is a clone of Moteino (I suppose).
Anyway - I need put flash to sleep for decrease power consumption.
Where I'm wrong?
Please advice.
Thanks.
Initialize both the radio and flash before sleeping
thank for answer.
but I've tried to add
flash.initialize();
driver.init();
into setup section and loop section and nothing happened - MCU just hangs after start.
also I've tried code
FreezeTest.ino
from
https://lowpowerlab.com/forum/index.php/topic,652.msg4286.html#msg4286
it hangs on:
Quote
SPI Flash Init OK ... UniqueID (MAC): D7 65 58 5 63 18 46 28
Sleeping
Waking
Quote from: d00m178 on May 19, 2016, 12:21:50 PM
thank for answer.
but I've tried to add
flash.initialize();
driver.init();
into setup section and loop section and nothing happened - MCU just hangs after start.
I think it should be driver.initialize() not driver.init()
as far I know for <RH_RF95.h> module - it has only one init method and in calls "init".
anyway - seems it hangs on SPI wakeup function - flash.wakeup();
Can you remove the RFM95 reference and just try it without it. I don't know if that library uses timers in a way that would interfere with the sleep timers.
sure.
it doesn't work again - doesn't wakeup.
this is my code
#include "LowPower.h"
#include <SPIFlash.h>
#include <SPI.h>
SPIFlash flash(8, 0xEF30);
void setup()
{
Serial.begin(9600);
Serial.println(">>>>> server init ok");
if (flash.initialize())
{
Serial.print("SPI Flash Init OK ... UniqueID (MAC): ");
flash.readUniqueId();
for (byte i=0;i<8;i++)
{
Serial.print(flash.UNIQUEID[i], HEX);
Serial.print(' ');
}
Serial.println();
}
else
Serial.println("SPI Flash Init FAIL! (is chip present?)");
Serial.println(">>>>> go to sleep");
//SPIFlash sleep/wakeup testing
flash.sleep();
Serial.println("Sleeping");
Serial.flush();
LowPower.powerDown(SLEEP_2S, ADC_OFF, BOD_OFF);
Serial.println("Waking");
Serial.flush();
flash.wakeup();
Serial.println("Flash awake");
}
void loop()
{
delay(1000);
}
output is:
>>>>> server init ok
SPI Flash Init OK ... UniqueID (MAC): D7 65 58 5 63 18 46 28
>>>>> go to sleep
Sleeping
Waking
BTW - I've bought this Moteino in Feb, so it should be new version.
I thought you said the MCU doesn't wakeup .. so which is it?
I'm not so concerned with the SPIFlash since the idle current is very low already.
well
this is a test code that shows that MCU hangs on flash.wakeup(); instruction.
as I said - I want to get lowest values of power consumption in sleep mode.
so I need disable SPI flash - bring it to sleep.
but it doesn't work.
this is another test code, a bit simplest:
#include "LowPower.h"
#include <SPIFlash.h>
#include <SPI.h>
SPIFlash flash(8, 0xEF30);
void setup()
{
Serial.begin(9600);
Serial.println(">>>>> server init ok");
if (flash.initialize())
{
Serial.print("SPI Flash Init OK ... UniqueID (MAC): ");
flash.readUniqueId();
for (byte i=0;i<8;i++)
{
Serial.print(flash.UNIQUEID[i], HEX);
Serial.print(' ');
}
Serial.println();
}
else
Serial.println("SPI Flash Init FAIL! (is chip present?)");
}
void loop()
{
Serial.println(">>> hello!");
delay(1000);
Serial.println(">>> go sleep");
Serial.flush();
flash.sleep();
LowPower.powerDown(SLEEP_2S, ADC_OFF, BOD_OFF);
Serial.println(">>> wakeup!");
flash.wakeup();
delay(1000);
}
output is:
>>>>> server init ok
SPI Flash Init OK ... UniqueID (MAC): D7 65 58 5 63 18 46 28
>>> hello!
>>> go sleep
>>> wakeup!
and then it hangs.
Ok i will look into this when I get a change. I think this was reported before but I can't remember if there was a resolution.
Thank you.
There is a topic with similar issue:
https://lowpowerlab.com/forum/index.php?topic=857.0
but actually I don't understand is it fixed with resistors or no.