Imp Firmware Update - Constant Rebooting

I’m new to Arduino and Electric Imp and having been messing around with it for a few months now. All has been running fine for quite some time now, until the other day. All of a sudden I can’t communicate with my Imp like I use to. Was sending commands from a website to throw some switches on a device.

Now I keep getting messages about firmware update, and the device seems to keep connecting and disconnecting. Can’t get it to stay connected etc.

Keep getting this in the log:

[Agent] Alpha Imp DISCONNECTED from agent
2013-12-10 18:21:21 UTC-4: [Status] Device booting; 0.55% program storage used
2013-12-10 18:21:21 UTC-4: [Agent] Alpha Imp CONNECTED to agent.
2013-12-10 18:21:21 UTC-4: [Status] firmware update triggered
2013-12-10 18:21:28 UTC-4: [Status] Device booting; 0.55% program storage used
2013-12-10 18:21:28 UTC-4: [Agent] Alpha Imp CONNECTED to agent.
2013-12-10 18:21:28 UTC-4: [Agent] Alpha Imp DISCONNECTED from agent
2013-12-10 18:21:28 UTC-4: [Status] firmware update triggered

My code is as follows (sorry for nooby code):

Agent:

// Log the URLs we need
server.log("Turn Valve On: " + http.agenturl() + “?valve=0”);
server.log("Turn Valve Off: " + http.agenturl() + “?valve=1”);

function requestHandler(request, response) {
try {
// check if the user sent led as a query parameter
if (“valve” in request.query) {
// if they did, and valve=1… set our variable to 1
if (request.query.valve == “1” || request.query.valve == “0”) {
// convert the valve query parameter to an integer
local valveState = request.query.valve.tointeger();
// send “valve” message to device, and send valveState as the data
device.send(“valve”, valveState);
if (valveState == 1){
response.send(200, “OK, the valve is now ON”);
}else{
response.send(200, “K, the valve is now OFF”);
}
}
}
if (“lcd” in request.query) {
// if they did, and valve=1… set our variable to 1
if (request.query.lcd == “1” || request.query.lcd == “0”) {
// convert the valve query parameter to an integer
local lcdState = request.query.lcd.tointeger();
// send “valve” message to device, and send valveState as the data
device.send(“lcd”, lcdState);
if (lcdState == 1){
response.send(200, “OK, the LCD Info is now ON”);
}else{
response.send(200, “OK, the LCD Info is now OFF”);
}
}
}
if (“switch3” in request.query) {
// if they did, and valve=1… set our variable to 1
if (request.query.switch3 == “1” || request.query.switch3 == “0”) {
// convert the valve query parameter to an integer
local switchState = request.query.switch3.tointeger();
// send “valve” message to device, and send valveState as the data
device.send(“switch3”, switchState);
if (switchState == 1){
response.send(200, “OK, the ATX Power is now ON”);
}else{
response.send(200, “OK, the ATX Power is now OFF”);
}
}
}
}
catch (ex) {
response.send(500, "Internal Server Error: " + ex);
}
}

device.onconnect(function() {
server.log(“Alpha Imp CONNECTED to agent.”);
});

device.ondisconnect(function() {
server.log(“Alpha Imp DISCONNECTED from agent”);
});

// register the HTTP handler
http.onrequest(requestHandler);

Device:

// configure the imp (best practice)
imp.configure(“iGarden Api”, [], []);
hardware.pin1.configure(PWM_OUT, 0.02,0.075);
hardware.pin2.configure(PWM_OUT, 0.02,0.075);
hardware.pin9.configure(PWM_OUT, 0.02,0.075);

// create a global variabled called led,
// and assign pin9 to it
valve <- hardware.pin1;
lcd <- hardware.pin2;
atxPower <- hardware.pin9;

// configure led to be a digital output
valve.configure(DIGITAL_OUT);
lcd.configure(DIGITAL_OUT);
atxPower.configure(DIGITAL_OUT);

// function Arduino Communication
function atxPowerCall(arduinoMsg) {
server.log("ATX Power " + arduinoMsg);
atxPower.write(arduinoMsg);
}

// function Valve
function setValve(valveState) {
server.log("Set Valve: " + valveState);
valve.write(valveState);
}
// function LCD
function setLCD(lcdState) {
server.log("Set LCD: " + lcdState);
lcd.write(lcdState);
}

// register a handler for “led” messages from the agent
agent.on(“valve”, setValve);
agent.on(“lcd”,setLCD);
agent.on(“switch3”,atxPowerCall);

Any help would be appreciated.

Very strange; looked in the logs and your device has the old 25.2 version, but despite being told repeatedly to get the update is not getting the hint. I’ve temporarily told it to be happy with the old version but would be interested to know what your wireless setup looks like (ie which router?)

I am get this behavior as will
2013-12-11 05:12:11 UTC-5: [Exit Code] imp OS upgraded

2013-12-11 05:12:11 UTC-5: [Status] Device booting; 2.02% program storage used

2013-12-11 05:12:11 UTC-5: [Status] firmware update triggered

2013-12-11 05:12:17 UTC-5: [Exit Code] imp OS upgraded

2013-12-11 05:12:18 UTC-5: [Status] Device booting; 2.02% program storage used

2013-12-11 05:12:18 UTC-5: [Status] firmware update triggered

2013-12-11 05:12:24 UTC-5: [Exit Code] imp OS upgraded

2013-12-11 05:12:24 UTC-5: [Status] Device booting; 2.02% program storage used

2013-12-11 05:12:24 UTC-5: [Status] firmware update triggered

MAC: 0c:2a:69:02:33:9b

Network
Wireless -> Pfsense->internet
Note wireless ap is just a AP Pf does dhcp and routing for me

Thanks
Jeff

Hi Hugo,

Thanks for the reply. I have a pretty basic wireless setup. Using Bell Fibre Op and the router/modem that came with it. I haven’t changed any of those settings and have been fully able to use the imp until the Firmware issue started to show. Otherwise, I’ve been happily using the imp to control things in my shop… and having a great time doing so! :slight_smile:

I’m kinda stuck at this point and beyond the scope of my knowledge. What should be my next step in trouble shooting? Does my code look okay?

Have any further suggestions? Maybe de-commission and re-commission the imp? I have all my code backed up, and don’t mind doing a fresh start if you can help there? How do I update to latest firmware if not this way?

Oh… and even though you have told it to be happy with the old version… I’m still having same issue.

Please email info@electricimp.com and we’ll investigate (usually this means we get your imp back for analysis and send you a new one)