I added a debug macro and a lot of serial prints and have found this interesting little piece of information
here is the debug macro and code
Code: Select all
#define BUG_HUNTER
#ifdef BUG_HUNTER
char FunctionTracker[1024];
char PreviousFunction[1024];
char PrePreviousFunction[1024];
#define BugHunt() \
sprintf(PrePreviousFunction,"%s",PreviousFunction);\
sprintf(PreviousFunction,"%s",FunctionTracker);\
sprintf(FunctionTracker,"function = %s",__func__);
#endif
void PrintBugHunt(){
#ifdef BUG_HUNTER
Serial.printf("1st location: %s\r\n",PrePreviousFunction);
Serial.printf("2nd location: %s\r\n",PreviousFunction);
Serial.printf("3rd location: %s\r\n",FunctionTracker);
#endif
}
Here is the one and only place in the code where the CellSetAPN() function is called:
Code: Select all
void CellSettings(){
BugHunt();
char cmd[64];memset(cmd,'\0',64);
//sprintf(cmd,"%sE0",AT);
//Cell_SendCMD_WaitResp(cmd, OK, 250);
Serial.println("Inside CellSettings function 0");
PrintBugHunt();
sprintf(cmd,"%s+%s",AT,THERMAL_PROTECTION);
Cell_SendCMD_WaitResp(cmd, OK, 250);
Serial.println("Inside CellSettings function 1");
PrintBugHunt();
sprintf(cmd,"%s+%s",AT,UART_OUTPUT);
Cell_SendCMD_WaitResp(cmd, OK, 250);
Serial.println("Inside CellSettings function 2");
PrintBugHunt();
sprintf(cmd,"%s+%s",AT,AUTO_TIMEZONE);
Cell_SendCMD_WaitResp(cmd, OK, 250);
Serial.println("Inside CellSettings function 3");
BugHunt();
CellSetAPN(); // SET THE APN FOR THE SIM CARD
}
void CellSetAPN(){
BugHunt();
Serial.println("Inside CellSetAPN function 0");
PrintBugHunt();
char cmd[300];memset(cmd,'\0',300);
sprintf(cmd,"%s+%s\"%s\"",AT,APN_PREFIX,APN);
Cell_SendCMD_WaitResp(cmd, OK, 500);
Serial.println("Inside CellSetAPN function 1");
PrintBugHunt();
if(APN_Auth[0]==AUTH_TYPE_NONE[0]){
sprintf(cmd,"%s+%s%s",AT,APN_AUTH_PREFIX,APN_Auth);
}
else{
sprintf(cmd,"%s+%s%s,\"%s\",\"%s\"",AT,APN_AUTH_PREFIX,APN_Auth,APN_PW,APN_UN);
}
Cell_SendCMD_WaitResp(cmd, OK, 500);
Serial.println("Inside CellSetAPN function 2");
PrintBugHunt();
}
and interestingly here is the debugging print from that
Code: Select all
11:46:03.958 -> Inside CellSetAPN function 0
11:46:03.958 -> 1st location: function = wdt_reset
11:46:03.958 -> 2nd location: function = Cell_Wait_Response
11:46:03.958 -> 3rd location: function = CellSetAPN
11:46:03.958 -> Command to cell = AT+CGSOCKCONT=1,"IP","data.mono"
11:46:04.011 -> Expected Response length = 4
11:46:04.513 -> No return
11:46:04.513 -> Inside CellSetAPN function 1
11:46:04.513 -> 1st location: function = Cell_Wait_Response
11:46:04.513 -> 2nd location: function = wdt_reset
11:46:04.513 -> 3rd location: function = Cell_Wait_Response
11:46:04.513 -> Command to cell = AT+CGAUTH=1,0
11:46:04.513 -> Expected Response length = 4
11:46:05.008 -> No return
11:46:05.008 -> Inside CellSetAPN function 2
11:46:05.008 -> 1st location: function = Cell_Wait_Response
11:46:05.008 -> 2nd location: function = wdt_reset
11:46:05.008 -> 3rd location: function = Cell_Wait_Response