RFM95 Sleep Mode



  • I noticed that the RFM95 driver has function to put the radio to sleep...
    do I need to check anything else prior to the call?

    LOCAL bool RFM95_sleep(void);
    

    what is required to re-awake the radio after this function is called...
    do I just set the mode back to RX or Standby?
    Any delays needed to awake the radio?

    also, why is it tagged as LOCAL? is it not intended to be used in project code??

    Using an M0 processor 2.1 code base

    Thanks


  • Hardware Contributor

    better use transportinit and transportpowerdown.

    LOCAL is simply a define for static 😉



  • As the sleep function are NOT implemented yet for the M0 SAMD processor in MyHwSAMD.ccp, is using transportinit and transportpowerdown the proper way to allow the core to shut down the radio to sleep and re awake??

    I ask because I do not see this being done in the MyHwATMega328.cpp sleep functions...

    My goal it to cut power down to a minimum with the M0 processor ...


  • Hardware Contributor

    yep but you asked the proper way to shutdown and reinit the radio 😉
    so imho the proper way is using the transport layer function as they include the settings in transportinit for example.
    for transportpowerdown sure it does not change a lot. but it's better for habits, depending on the use.

    for atsam, or 328p, sleep modes this is about the hardware layer, so the corresponding functions.
    regarding atsam, for the moment, you need to write your own sleep functions. and use the transport layer for radio.
    i know there are still some stuff in arduino core too about this, you can also use rocketstream lib for sleep modes.
    or you can also do a PR if you've done something https://www.mysensors.org/download/contributing 🙂



  • Thanks...

    I'm using RocketStream lib. LowPower sleep for now...

    when I wake up, I get some messages from the TSF, not sure what they are telling me...
    it appear to not like the message it received...

    My Current Code....

    https://github.com/trlafleur/Soil_Moisture_Sensor_MS_R1.1-RFM95
    

    thanks

    *** Going to Sleep ***
    *** Wakeing From Sleep at: 17:11
    TSF:MSG:READ,0-0-76,s=255,c=3,t=0,pt=1,l=4,sg=1:1
    !TSF:MSG:LEN,4!=32
    TSF:MSG:READ,0-1-76,s=255,c=3,t=0,pt=1,l=5,sg=0:1
    !TSF:MSG:LEN,4!=12
    TSF:MSG:READ,0-2-75,s=255,c=3,t=0,pt=1,l=4,sg=1:1
    !TSF:MSG:LEN,4!=32
    TSF:MSG:READ,0-3-76,s=255,c=3,t=0,pt=1,l=4,sg=1:1
    !TSF:MSG:LEN,4!=32
    TSF:MSG:READ,0-4-75,s=255,c=3,t=0,pt=1,l=4,sg=1:1
    !TSF:MSG:LEN,4!=32
    TSF:MSG:READ,0-5-75,s=255,c=3,t=0,pt=1,l=4,sg=1:1
    !TSF:MSG:LEN,4!=32
    TSF:MSG:READ,0-6-75,s=255,c=3,t=0,pt=1,l=4,sg=1:1
    !TSF:MSG:LEN,4!=32
    TSF:MSG:READ,0-7-75,s=255,c=3,t=0,pt=1,l=4,sg=1:1
    !TSF:MSG:LEN,4!=32
    TSF:MSG:READ,0-9-76,s=255,c=3,t=0,pt=1,l=5,sg=0:1
    !TSF:MSG:LEN,4!=12
    TSF:MSG:READ,0-10-75,s=255,c=3,t=0,pt=1,l=5,sg=0:1
    !TSF:MSG:LEN,4!=12
    *** Going to Sleep ***
    


  • @lafleur

    I have been using the transportinit() and transportpowerdown(), as suggested and it has been working fine if I was just sending data...

    But when I needed to receive data from the controller, I was never receiving any data from the controller, even if I allowed a RX window of 20 sec or more.

    On Wake up, If I remove the call to transportinit(), all work fine again... TX and RX work just fine...

    What going on here?? Why is system working without the need to call transportinit() as you suggested.

    using a SAMD processor M0
    IDE 1.8.1
    MySensor 2.1.1

    My current code base:

    https://github.com/trlafleur/Soil_Moisture_Sensor_MS_R1.1-RFM95
    
    /* **************** System Sleep ******************* */
    void systemSleep()
    {
        debug1(PSTR("\n*** Going to Sleep ***\n"));
        wait (100);
        // put led's, radio and flash to sleep
        // Turn off LED's
        // Put Flash to sleep
        // Put Radio and transport to Sleep
        transportPowerDown();              // Shut down radio and MySensor transport
        
        interrupts();                      // make sure interrupts are on...
        LowPower.standby();                // SAMD sleep from LowPower systems
        
           //  .... we will wake up from sleeping here if triggered from an interrupt
        interrupts();                       // make sure interrupts are on...                                      
    }
    
    /* **************** System Wake-up from Sleep ******************* */
    void systemWakeUp() 
    {                                          
        
        //  re enable LED's if needed
        // wake up Flash if needed
    
        // wake up MySensor transport and Radio from Sleep
        //transportInit();
                                  // as MySensor had NO sleep or Watch Dog for SAMD, this will
                                            // wake us up so that we can send and receive messages
        while (!isTransportReady()) {       // Make sure transport is ready
        _process(); 
        interrupts();                       // make sure interrupts are on...
    }
    

Log in to reply
 

Suggested Topics

  • 1
  • 2
  • 1
  • 2
  • 6
  • 3

58
Online

11.4k
Users

11.1k
Topics

112.6k
Posts