Try the following:
1- Comment this part of the code and see if the program flow will continue normally.
Code:
else if (strcmp(GSM_DATA, "RING") == 0){
Ring = 1;
GSM_DATA[0] = '\x00';
puts("AT+CLCC");
putch(0x0D);
2- If the program ran normally, then the problem is specifically in the command "AT+CLCC". It may be that the MODEM is still sending some characters, or the MODEM's response is delayed for some reason while you are trying to send it another command.
Hope this helps.
Good Luck
I have changed the code but the same result. I worked with hyperterminal also. It works fine. No problem there. I think problem in my code. I sent you the entire code for your review. Pl go thro' my code and try to find out the problem. I need your help. Pl.
For your information:
The following code works fine. (I have enabled Clip using AT+CLIP=1 to avoid AT+CLCC command. Before this, If I disconnect the call after processing AT+CLCC response (+CLCC : 1,1, ..), I cannot receive "NO CARRIER" message. Now I receive "NO CARRIER" because of "AT+CLIP" command)
Just display the GSM_DATA (No data validation):
void showGSM_DATA(char GSM_DATA[]){ //to show the GSM OUTPUT after eliminating the chars '\r' and '\n'
if (strcmp(GSM_DATA, "OK") == 0){
OK = 1;
if (strcmp(NextCmd, "CMGF") == 0){
strcpy(NextCmd, "CLIP");
puts("AT+CMGF=1");
putch(0X0D);
}
if (strcmp(NextCmd, "CLIP") == 0){
*NextCmd = 0;
puts("AT+CLIP=1");
putch(0X0D);
}
return;
}
if (strcmp(GSM_DATA, "ERROR") == 0){
Error = 1;
*GSM_DATA = 0;
return;
}
if(strlen(GSM_DATA) > 6){
lcd_clear();
lcd_goto(0);
lcd_puts(GSM_DATA);
}
*GSM_DATA = 0;
return;
} // end function showGSM_DATA
*** The following also works fine but only one time(Startup Commands like ATE0, AT+CMGF=1, AT+CLIP=1) and Any Phone/SMS received (After Successful Startup Commands Execution). If I send another SMS/Phone nothing happen. I have to restat the device. GSM Modem working correctly.
Just I add substring function. Thats all:
if(strlen(GSM_DATA) > 6){
substring(0,14,GSM_DATA);
}
void substring(size_t start, size_t stop, char src[]){
int j = 0;
if (start >= stop){
//return substringOfInput;
return;
}
for(i = start;i < stop; i++){
substringOfInput[j] = src
;
j++;
}
substringOfInput[j] = '\x00';
lcd_clear();
lcd_goto(0);
lcd_puts(substringOfInput);
*src=0;
*substringOfInput=0;
j=0;
return;
}
Can you pl help me?