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

LoRaWan Dropout Issues #208

Open
jlut93 opened this issue Dec 12, 2022 · 2 comments
Open

LoRaWan Dropout Issues #208

jlut93 opened this issue Dec 12, 2022 · 2 comments

Comments

@jlut93
Copy link

jlut93 commented Dec 12, 2022

Hi,

I have a few Grasshopper LoRaWAN boards operating in some remote locations, transmitting room temperature and humidity every 10 min.

I find that they transmit to the gateway for about a week and then they stop transmitting. When I pick up the sensor and reset they rejoin the gateway OK and carry on transmitting until I get the issue again. I think that it is hanging somewhere in the code

At the moment the transmitting code is inside an if statement:

if (!LoRaWAN.busy() && LoRaWAN.joined())
code here
end

Is this if statement robust enough to ensure that the code won't hang if the packet send fails? Is there something else that I can include?
Thanks

@GrumpyOldPizza
Copy link
Owner

Good questions. I have zero idea why it should hang. There is just not enough information for me ...

I'll add some logging to SRAM logic to the next drop. This way you could look at the state after the system failed and go from there.

@jlut93
Copy link
Author

jlut93 commented Dec 12, 2022

Ok thanks.

This is the code inside the if statement:

void measure()
{
union {
float ival;
byte bval[4];
} int32AsBytes;

SHT31D result;

digitalWrite(sensorPWR, HIGH);
delay(1);
result = sht3xd.readTempAndHumidity(SHT3XD_REPEATABILITY_LOW, SHT3XD_MODE_CLOCK_STRETCH, 50);
batteryLevel = STM32L0.getVDDA();

digitalWrite(sensorPWR, LOW);

displayVbatSerial();
displayResultSerial(result);
LoRaWAN.beginPacket(3);

int32AsBytes.ival = result.t;
for(int i = 0; i <= 3; i++) // reverse for big-endian
{
LoRaWAN.write(int32AsBytes.bval[i]);
}
int32AsBytes.ival = result.rh;
for(int i = 0; i <= 3; i++) // reverse for big-endian
{
LoRaWAN.write(int32AsBytes.bval[i]);
}
int32AsBytes.ival = batteryLevel;
for(int i = 0; i <= 3; i++) // reverse for big-endian
{
LoRaWAN.write(int32AsBytes.bval[i]);
}
LoRaWAN.write(lowByte(buttonPressed));
LoRaWAN.write(lowByte(thisNodeNumber));
LoRaWAN.endPacket();
}

There is a timeout for the sht3xd.readTempAndHumidity function, but I don't think I can add any more

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