Anyone seeing a problem with software reset not working in 1.6.9?
I have code that does the assembler reset, works in 1.0.6, not in 1.6.9. I use it because I have a DF Robot GSM/GPS card that boots up sometimes with incorrect responses to AT, comes back with "Normal Power Down" or a responds with "yyyy" with umlaut over them, only way to recover seems to be to reset the code. (which you wouldn't think would reset the GPS/GSM card, yet seems to solve the problem).
With 1.6.9, the software reset just hangs the 1284. With 1.0.6, everything restarts as expected.
Serial.println("resetting...");
asm volatile ("jmp 0");
while(1);
Now that I think about it, I don't recall seeing "resetting" in the Serial Monitor, so maybe it's something else.
It definitely hangs in 1.6.9 tho.
// check incoming messages
//NORMAL POWER DOWN - 17 - need a reset if get this
//
//RDY
//+CFUN: 1 - 8
//+CPIN: READY - 12
//+PACSP: 1 - 9
//Call Ready - 10
//GPS Ready - 9 - these two may be swapped
delay(500);
Serial.println("");
Serial.print ("Starting GPS/GSM 'warmup' delay");
Serial.print(" ");
for (x=1; x<=12; x=x+1){
Serial.print (x);
delay(1000);
}
//
// losing some data during the delay?
//
Serial.println("");
Serial.println ("GPS ready for AT?");
y =0;
for (x=0; x<64; x=x+1){
inGPS = Serial1.read();
// 13, 10, 32 ignore CR, LF, Space
if ((inGPS !=13) && (inGPS !=10) && (inGPS !=32)){
dataGPS[y] = inGPS;
y=y+1;
}
}
Serial.print ("received: ");
for (x=0; x<50; x=x+1){
Serial.print (dataGPS[x]);
}
Serial.println("");
Serial.println("");
// FIXed THIS? - waSN'T CATCHing NORMAL POWER DOWN as a failure mode. The R passes the current test. Added check for not-N at the start
if((((dataGPS[0] == 'R') || (dataGPS[0] == '+')) ||((dataGPS[1] == 'R') || (dataGPS[1] == '+')) || ((dataGPS[2] == 'R') || (dataGPS[2] == '+'))) && (dataGPS[0]!='N') ){
Serial.println("yes - sending AT");
Serial1.write((uint8_t*)at,strlen(at));
Serial.print("received: ");
y = 0;
delay(2000);
while (Serial1.available()>0){
inGPS = Serial1.read();
// 13, 10, 32 ignore CR, LF, Space
if ((inGPS !=13) && (inGPS !=10) && (inGPS !=32)){
dataGPS[y] = inGPS;
y=y+1;
}
}
// print response
for (x=0; x<4; x=x+1){
Serial.print (dataGPS[x]);
}
Serial.println("");
Serial.println("");
Serial.println("sending at+cgpspwr=1");
Serial1.write((uint8_t*)cgpspwr, strlen(cgpspwr));
y = 0;
delay(2000);
while (Serial1.available()>0){
inGPS = Serial1.read();
// 13, 10, 32 ignore CR, LF, Space
if ((inGPS !=13) && (inGPS !=10) && (inGPS !=32)){
dataGPS[y] = inGPS;
y=y+1;
}
}
// print response
Serial.print("received: ");
for (x=0; x<14; x=x+1){
Serial.print (dataGPS[x]);
}
Serial.println("");
Serial.println("");
Serial.println("sending at+cgpsrst=1");
Serial1.write((uint8_t*)cgpsrst, strlen(cgpsrst));
y = 0;
delay(2000);
while (Serial1.available()>0){
inGPS = Serial1.read();
// 13, 10, 32 ignore CR, LF, Space
if ((inGPS !=13) && (inGPS !=10) && (inGPS !=32)){
dataGPS[y] = inGPS;
y=y+1;
}
}
// print response
Serial.print("received: ");
for (x=0; x<14; x=x+1){
Serial.print (dataGPS[x]);
}
Serial.println("");
}
else{
Serial.println("resetting...");
asm volatile ("jmp 0");
while(1);
}
The code is looking for a couple of things:
R (implies RDY received)
+ (implies +CFUN received)
yR (implies RDY received) (y is the y umlaut character)
y+ (implies +CFUN received)
yyR (implies RDY received), but not NOR
yy+ (implies +CFUN received)
My testing/monitoring shows these 6 will allow normal commands to be sent, anything else comm's are either hosed, or the device is going into some power down mode. The Reset in 1.0.6 works to recover comm's usually with the next set of messages, sometimes two. With 1.6.9, there is no recovery, the code just stops outputting stuff with
"received: NORMA" if I recall correctly. I'll have to enumerate the "received"s a little more so I can tell which one is sending that out, maybe it's hanging sooner than I thought.
This is the card, the browser I'm on right now won't open any further for me unfortunately. There's links to a Wiki page with some sample code that stinks for this SIM908 module that combines GPS and GSM for location info and texting. I use the 1284P's Serial1 port to talk to it, and Serial to talk to the PC for debugging (on a custom card).
http://www.dfrobot.com/index.php?route=product/search&description=true&search=sim908