【问题标题】:Sim900a post request with AT commands does not work for data that is more than 185 characters longSim900a post request with AT commands does not work for data that is more than 185 characters long
【发布时间】:2022-12-02 04:48:17
【问题描述】:

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.

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

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.

This code runs AT commands on my gsm module

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

And from here I am calling the "makePostRequest" function

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

【问题讨论】:

  • Does this limit occur only when issuing the command with your script or also if you manually provide it through a serial terminal? (PS: wrte explicitly code and documentation in your question, by conveniently formatting it in text format, instead of using images. Not only text can be copied-pasted, but imaged could be also removed from hosting sites in the future compromising question consistency).

标签: arduino gsm at-command gprs sim900


【解决方案1】:

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
", "OK",buffer_sim808_rx, ELEMENTS_BUFFER_SIM808, false, 500);

【讨论】:

    猜你喜欢
    • 2016-12-29
    • 1970-01-01
    • 1970-01-01
    • 2022-12-01
    • 2023-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多