Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 4 months ago.
SIM 900A is not working with my FRDM K64F ?
I have connected gsm sim 900 module with my frdm k64f
I have initiated gsm serial - rx and tx at the pin D1, D0 DigitalOut dtr at D2 DigitalIn pwr_key at D4 and the common ground
In tera term I am not able to see that Is sim 900 got registered or AT command are working or not ?
Can anybody help me in the same. i had look upon the examples but didnt find the correct one.
Can u just tell me about the beginners command for connecting and initializing the sim 900a with my frdm board ?
Complete code reply is highly appreciated
Thanks in advance !
Assigned to
10 years, 4 months ago.This means that the question has been accepted and is being worked on.
Hi Lerche
Yeah I am from India and SIM 900A works only here I am using baud rate at 9600 and tried at 19200 also but still no change After deep analysis i found that the frdm board is not generating any signal and it is not sending any command to the SIM 900A module. I declare D1,D0 as tx and rx and tried to read the signal on the arduino board but nothing happens This is my code
posted by Jaspreet Singh 22 Jul 2014}while((answer == 0) && ((time(NULL) - previous) < timeout)); return answer; } int8_t sendATcommand2(char* ATcommand, char* expected_answer1, char* expected_answer2, unsigned int timeout){ uint8_t x=0, answer=0; char response[100]; time_t previous; memset(response, '\0', 100); Initialize the string wait_ms(100); while( gsm.readable() != 0) gsm.getc(); Clean the input buffer
gsm.printf("%s \r", ATcommand); x = 0; previous = time(NULL); do{ if(gsm.readable() != 0){ response[x] = gsm.getc(); pc.putc(response[x]); x++; if (strstr(response, expected_answer1) != NULL) { answer = 1; } if (strstr(response, expected_answer2) != NULL) { answer = 2; break; } }
}while((answer == 0) && ((time(NULL) - previous) < timeout)); return answer; }
uint32_t do_list(const char *fsrc) { DIR *d = opendir(fsrc); struct dirent *p; uint32_t counter = 0;
while ((p = readdir(d)) != NULL) { counter++; printf("%s\n", p->d_name); } closedir(d); return counter; } void power_on_off() { pwr_key = 0; wait(2); pwr_key = 1; } void gsm_init() { int cnt = 0; gsm_wake(); pc.printf("\r\nI am 1"); gsm_wake(); while(sendATcommand("AT+CREG?", "+CREG: 0,1", 5) || sendATcommand("AT+CREG?", "+CREG: 0,5", 5) == 0) { pc.printf("\r\nI am 1.5"); sendATcommand("AT+CREG=1", "OK", 10); gsm.printf("OK"); wait(2); ++cnt; pc.printf("\r\nI am 2"); pc.printf("%d", cnt); if(cnt == 4) { pc.printf("GSM registration failed"); return; } } pc.printf("\r\nI am 3"); }
int main() { pc.printf("Hello World \r\n"); gsm.baud(9600); gsm_init(); sendATcommand("AT", "OK", 2); dtr = 0; }
posted by Jaspreet Singh 22 Jul 2014