Handshake, post once, then disconnect/failign

boron
Tags: #<Tag:0x00007f1ca8a55368>

#1

I have a handful of Borons (6) that are all having the same problem. When power cycled they boot up, handshake, post data one time, then disconnect from the cellular network (LED shifts to blinking green).

They’re all installed in the same rural area, so it might be something environmental, but the fact that they’re all able to post upon first boot makes it seem like there might be something else. Does anyone else have experience with this sort of issue and/or ideas on troubleshooting?

Thanks,
Aaron


#2

Could be your code blocking.
Hard to say without knowing the code tho’


#3

@scruff,

I’m pastign my main code below. I can’t think of what it would be in firmware - I have ~50 other units with identical code that are not experiencing this problem.

#include <ModbusMaster.h>

#include "CloudFunctions.h"
#include "Constants.h"
#include "Json.h"
#include "Modbus.h"
#include "Register.h"

//setup AT&T sim card 
STARTUP(cellular_credentials_set("soracom.io", "sora", "sora", NULL));

ModbusMaster node(METER_ADDRESS);
Modbus* slave;

void setup() {
	//Initialize methods
	Constants::Initialize();
	RegisterList::Initialize();
	CloudFunctions::Initialize();
	Particle.keepAlive(CELL_KEEP_ALIVE);

	//Serial printing for testing purposes
	Serial.begin(SERIAL_PORT);
	Serial.println("Initializing response");

	//initiate slave 
	slave = new Modbus();
	node.begin(BAUD_RATE);
}

// loop() runs over and over again, as quickly as it can execute.
void loop() {
	//reads and adds data from slave to json object
	for(int i = 0; i<NUMBER_OF_REGISTERS; i++){
		int result = slave->readRegisters(node, RegisterList::list[i]->Register_Address, RegisterList::list[i]->Register_Type);
		ReadData data(RegisterList::list[i]->Register_Name, result);
		Json::add(data);
	}

	if(!slave->hasError){
		//Success case!
		Json::serializeSuccess();
		//its the clean up song!
		delete(slave);
		slave = new Modbus();
		delay(CYCLE_DELAY);
	}else{
		//Failure case :(
		//Waits 1 second and then retries entire loop again for max 5 times
		slave->addToFailureCount();
		delay(FAILURE_DELAY);
	}
	//Loop starts over totally after max retries
	if(slave->failureCount==FAILURE_LIMIT){
		Json::serializeFailure();
		//don't forget to take out the garbage!
		delete(slave);
		slave = new Modbus();
		delay(CYCLE_DELAY);
	}
}

#4

Where is CELL_KEEP_ALIVE defined?
Try adding this

#define CELL_KEEP_ALIVE 30

#5

@ScruffR,

Ah, I didn’t include that . CELL_KEEP_ALIVE is defined in constants.h, I currently have it set to 120


#6

You can try adding SYSTEM_THREAD(ENABLED) too.
That behaviour could come from some of the included libraries blocking the cloud task.

BTW, I also can’t see the statment that activates the external SIM.