Interfacing SIM900A HTTP URL command sequence - Page 1
Forum section: electronics / beginners

author: Vindhyachal.takniki
author_rank: Frequent Contributor
timestamp: June 06, 2020, 01:56:56 pm
content: 1. I am interfacing SIM900A with MCU. Need to hit a http url (URL has data embedded into it, so I made it my code). This is to be repeated every 5 mins.2. Here is initialization algo which I have written & implemented in C, this is done one time in code:Code:1. send_command("AT" , "OK" , 5000);If "Ok" not received or no response till 5000ms then send go to START,else "OK" received then proceed2. send_command("AT+CFUN=0" , "OK" , 5000);If "Ok" not received or no response till 5000ms then send go to STARTelse "OK" received then proceed3. send_command("AT+CFUN=1" , "OK" , 5000);If "Ok" not received or no response till 5000ms then send go to STARTelse "OK" received then proceed4. send_command("AT+CPIN?" , "READYOK" , 5000);If "READYOK" not received or no response till 5000ms then send go to STARTelse "READYOK" received then proceed5. send_command("AT+HTTPTERM" , "OK" or "ERROR" , 5000);If no response for 5000ms then goto STARTelse if "OK" then proceedelse if "ERROR", then also proceed, it means that HTTP was terminated earlier also6. send_command("AT+SAPBR=0,1" , "OK" or "ERROR" , 5000);If no response for 5000ms then goto STARTelse if "OK" then proceedelse if "ERROR", then also proceed, it means that GPRS was terminated earlier7. send_command("AT+SAPBR=3,1,"Contype","GPRS"" , "OK" , 5000);If "OK" not received or no response till 5000ms then send goto STARTelse "OK" received then proceed8. send_command("AT+SAPBR=3,1,"APN","airtelgprs.com"" , 5000);If "OK" not received or no response till 5000ms then send goto STARTelse "OK" received then proceed9. send_command("AT+SAPBR=1,1" , 5000);If "OK" not received or no response till 5000ms then send goto STARTelse "OK" received then proceed10. send_command("AT+SAPBR=2,1" , 5000);If "OK" not received or no response till 5000ms then send goto STARTelse "OK" received then proceed11. send_command("AT+HTTPINIT" , 5000);If "OK" not received or no response till 5000ms then send goto STARTelse "OK" received then proceed12. send_command("AT+HTTPPARA="CID",1" , 5000);If "OK" not received or no response till 5000ms then send goto STARTelse "OK" received then proceed3.This is when I hit HTTP URL and read response, this is repeated in loop:Code:1. send_command("AT+HTTPPARA="URL","http://xxxxx" , 5000);If "OK" not received or no response till 5000ms then send goto HIT_HTTP_URLelse "OK" received then proceed2. send_command("AT+HTTPACTION=0" , 5000);If "OK" not received or no response till 5000ms then send goto HIT_HTTP_URLelse "OK" received then proceed3. send_command("AT+HTTPREAD" , 5000);If "XYZ" not received or no response till 5000ms then send goto HIT_HTTP_URLelse "XYZ" received then data success//"XYZ" is response read from server on successfully hitting the server4. I have implemented in C with MCU and can see data hit on server which i can access5. Is it right sequence or I am missing something in it? ANy code suggestion on it?ANy missing command, or wrong timeouts?

author: Vindhyachal.takniki
author_rank: Frequent Contributor
timestamp: June 08, 2020, 06:29:13 am
content: moveup....