Wake up rak3172

hello everyone, I have a question: can we wake up the rak3172 with a downlink and possibly put it back into deep sleep? I am interested in any information on the subject.

AT command firmware:

If you use LPMLevel and enable LPM, the RAK3172 will sleep unless you send a packet or a packet is received from the LNS.

AT+LPMLEVEL=2
AT+LPM=1

Custom firmware with RUI3 API:

You have to be careful how you write your code. E.g. if you are running the loop() over and over again, waiting for an event, the RAK3172 cannot go into sleep mode.
I wrote a simple example how you can achieve low power consumption using timers and event callbacks RUI3-LowPower-Example

hello, I did almost the same for the loop, but I put the sleep.all here, it’s correct or not.

  // Envoi du paquet de données
    if (api.lorawan.send(buffsize, m_lora_app_data_buffer, 2, true, 1)) {  // Passer la taille du paquet
      Serial.println("Sending is requested");
      // Arrêter le GPS
      delay(10000);  // Attendre que le GPS s'arrête

      Serial1.println("$PGKC051,0*37<CR><LF>");
      delay(10000);
    } else {
      Serial.println("Sending failed");
    }
  } else {
    Serial.println("Invalid GPS data. Cannot send.");
  }


  //Serial.printf("Try sleep %ums..", OTAA_PERIOD);
  api.system.sleep.all(SMART_FARM_PERIOD);
  //Serial.println("Wakeup..");
}





void loop() {
}

With AT+LPM and AT+LPMLVL there is not really a need for api.system.sleep.all(SMART_FARM_PERIOD);.
I have that command in my loop() and instead use timers (with SMART_FARM_PERIOD as interval with your example), LoRa event callbacks and external triggers to wake up the device.

I don’t understand sorry, you have an example of code it’s more meaningful

Yes, I have examples. All my examples are based on that principle.
I sent a link a few messages ago ==> RUI3-LowPower-Example

yes I saw your example, so in my script I have to delete the “api.system.sleep.all(SMART_FARM_PERIOD);” it is correct ?

Can you share your whole code by private message? I can have a look at it.

If the // Envoi du paquet de données is called by a timer, you can remove the api.system.sleep.all() and instead put it into the loop().

hello, yes it is the timer that supports sending.

Then my proposal should work.

ok I put that in the loop and I test