Sim900a post request with AT commands does not work for data that is more than 185 characters long

299 Views Asked by At

I am using sim900a GSM module to make a post request to my server. When I send 185 characters long data then an error is thrown.

Error with 185 chars

But when the data length is 184 characters or lesser then it works successfully

Success with 184 chars

I have tested multiple times to verify this and every single time if the data length is 185 characters or more then the data is not sent but if it is lesser than 185 then it works.

runCmd function

This code runs AT commands on my gsm module

makePostRequest func

This function makes post request to my server using AT commands.

makepost call

And from here I am calling the "makePostRequest" function

at datasheet

According to the data sheet of AT commands, we can see that the max size on the httpdata is 1,02,400 bytes. So why does my request fail with just 185 characters?

PS: The gsmSerial is running on a baud rate of 9600. And the limit is not enforced by my server. I have already tested the route with postman

1

There are 1 best solutions below

0
RUBEN ESTRADA MARMOLEJO On

Strings can make that error. I did a program with a SIM808 and ended up making a function to transfir char arrays instead of strings.

bool send_command_for_USART(char* request,char* expected_response,char* buffer_rx, int elements, bool debug, long int time_out){ //code to transmit char array }

And I used it like this:

send_command_for_USART("AT+CGNSINF\r\n", "OK",buffer_sim808_rx, ELEMENTS_BUFFER_SIM808, false, 500);