Skip to content
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

Recieve transmissions for 1 day, nothing for 3 days, receive transmissions again. #192

Open
kevin192291 opened this issue Jul 2, 2021 · 2 comments

Comments

@kevin192291
Copy link

Hello,
I have a board and it is setup to transmit every 4 hours, then go to sleep. Everything was great for 1 day
then the board seemed to stop transmitting. I restart it, things go well again for another day and stop again.

I tried to leave it running and after 3 days of no transmissions I received a message just this morning.
I am wondering if it has anything to do with this: #27

Any insight would be greatly appreciated!

@HeadBoffin
Copy link

Are you using ABP or OTAA?

@kevin192291
Copy link
Author

kevin192291 commented Jul 28, 2021

Are you using ABP or OTAA?

I am using OTAA.

Here is my code with all of the boring stuff omitted:

void setup() {
  Serial.begin(9600);
  ...just a bunch of init stuff here
  
  LoRaWAN.begin(AS923);
  //LoRaWAN.setAntennaGain(3.0);
  LoRaWAN.joinOTAA(appEui, appKey, devEui);
  LoRaWAN.onReceive(receiveCallback);
  Serial.println("Leaving Setup");
}

void loop(void) {
  if (!LoRaWAN.busy())
  {
        if (CountDown)
        {
            CountDown--;
            
            if (!CountDown)
            {
                Serial.end();
                USBDevice.detach();
            }
        }

        if (!LoRaWAN.linkGateways())
        {
            if (CountDown)
            {
                Serial.println("REJOIN( )");
            }
            Serial.println("Rejoining...");
            LoRaWAN.rejoinOTAA();
        }
        
        if (LoRaWAN.joined())
        {
          Serial.println("LoRaWAN Joined");
            if (CountDown)
            {
              Serial.print("Count Down: ");
              Serial.println(CountDown);
            }

            .... a bunch of LPP stuff here
            
            if (LoRaWAN.getMaxPayloadSize() > myLPP.getSize()) {
              LoRaWAN.sendPacket(myLPP.getBuffer(), myLPP.getSize());
              myLPP.reset();
              digitalWrite(powerPin, HIGH);
              digitalWrite(gpsEnPin, LOW);
              Serial.println("Going To Sleep USB will end now zzz...");
              STM32L0.stop(sleepTime);
            } else {
              Serial.println("Can't send too large of a packet in the start, lets just say hi!");
              LoRaWAN.beginPacket();
              LoRaWAN.write(0x68);
              LoRaWAN.write(0x69);
              LoRaWAN.endPacket();
              myLPP.reset();
              digitalWrite(powerPin, HIGH);
              digitalWrite(gpsEnPin, LOW);
              Serial.println("*NOT* Going To Sleep USB will end now zzz...");
            }
            
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants