I am testing Lorawan class C in RUI interface for Rak3172. However, I could not set the sending period. In Class A, I was sleeping during OTAA_PERIOD. I won’t put it to sleep in Class C, but I couldn’t figure out how to solve it. Can you help me? I would be very happy if you could give an example code of class C otaa.
LoRaWAN Class C means the LoRa transceiver is in RX mode all the time. You cannot get low power current when using Class C.
The lowest I can get in Class C is around 6mA. This is consumed by the LoRa transceiver. The STM32WLE5 will still go into low power mode, but you will not see it in the power consumption.
I understood yes. I don’t need low power consumption right now, I just want to set a transmission period in class c mode. I will be sending downlink data from the AWS cloud system. Can’t uplink be done periodically in Class C? I just want sample code. Thank you @beegee
Of course timed uplinks are possible in all LoRaWAN classes.
The problem in your code is that you define last
inside the loop()
, which means it is initialized to 0 every time loop()
is called, so your criteria is never fulfilled.
Move the definition outside of loop()
.
And your if
looks weird I would never write it like this.
static uint64_t last = 0;
void setup()
{
// usual setup stuff
last = millis():
}
void loop(void)
{
if ((millis() - last) > OTAA_PERIOD)
{
uplink_routine();
last = millis();
}
}
Or more elegant, use a RUI3 timer, like in this example RUI3-LowPower-Example