Problem with sending a frame longer than 61 bytes of length. 4G http method GET

Wireless communications in Waspmote, topologies, node types...
Post Reply
agpp
Posts: 8
Joined: Wed Jun 20, 2018 10:40 am
Company: IMDEA-AGUA

Problem with sending a frame longer than 61 bytes of length. 4G http method GET

Post by agpp » Tue Sep 10, 2019 5:21 pm

Hi,
I have a problem with ¨_4G_http¨ function. I need to send a frame with a length of 246 bytes by using it, but it´s only possible to send successfully a frame with a length of 61 bytes.

If the length of frame is greater than 61 bytes, Waspmote answers with Error code 17.

Code: Select all

J#
----------  Start program   -----------
*****************************
APN: Movistar
LOGIN: telefonica.es
PASSWORD: telefonica
*****************************
1. 4G module ready...
2. Getting URL with GET method...Failed. Error code: 17
3. Switch OFF 4G module
4. Enter deep sleep...
When the length of the frame is less than or equal to 61 bytes, the 4G module works properly:

Code: Select all

J#
----------  Start program   -----------
*****************************
APN: Movistar
LOGIN: telefonica.es
PASSWORD: telefonica
*****************************
1. 4G module ready...
2. Getting URL with GET method...Done. HTTP code: 200
Server response: Frame OK. 
3. Switch OFF 4G module
4. Enter deep sleep... 
I use the API v040 and a script very similar to _4G_06_http_get:

Code: Select all

void setup()
{
  USB.ON();
  USB.println(F("----------  Start program   -----------"));

  //////////////////////////////////////////////////
  // 1. sets operator parameters
  //////////////////////////////////////////////////
  _4G.set_APN(apn, login, password);

  //////////////////////////////////////////////////
  // 2. Show APN settings via USB port
  //////////////////////////////////////////////////
  _4G.show_APN();
}



void loop()
{
  //////////////////////////////////////////////////
  // 1. Switch ON
  //////////////////////////////////////////////////
  error = _4G.ON();

  if (error == 0)
  {
    USB.println(F("1. 4G module ready..."));

    ////////////////////////////////////////////////
    // 2. HTTP GET
    ////////////////////////////////////////////////

    USB.print(F("2. Getting URL with GET method..."));

    PIN_status = _4G.checkPIN();
    
    if ((PIN_status != 0) && (PIN_status < 16))
    {
      PIN_status=_4G.enterPIN(PIN_code);
    }

    if ( (error == 0) && (PIN_status==0) )
    {
      // send the request
      error = _4G.http( Wasp4G::HTTP_GET, host, port, resource);
    }
    
    // Check the answer
    if (error == 0)
    {
      USB.print(F("Done. HTTP code: "));
      USB.println(_4G._httpCode);
      USB.print("Server response: ");
      USB.println(_4G._buffer, _4G._length);
    }
    else
    {
      USB.print(F("Failed. Error code: "));
      USB.println(error, DEC);
    }
  }
  else
  {
    // Problem with the communication with the 4G module
    USB.println(F("1. 4G module not started"));
    USB.print(F("Error code: "));
    USB.println(error, DEC);
  }


  ////////////////////////////////////////////////
  // 3. Powers off the 4G module
  ////////////////////////////////////////////////
  USB.println(F("3. Switch OFF 4G module"));
  _4G.OFF();

  ////////////////////////////////////////////////
  // 4. Sleep
  ////////////////////////////////////////////////
  USB.println(F("4. Enter deep sleep..."));
  PWR.deepSleep("00:00:00:30", RTC_OFFSET, RTC_ALM1_MODE1, ALL_OFF);

  USB.ON();
  USB.println(F("5. Wake up!!\n\n"));
}
Example of frame that I need to send:

Code: Select all

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Current BINARY Frame:
Length: 246
Frame Type:  6
frame (HEX): 3C3D3E06F1380010FDC337DEE16E5F303123003421015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Example of frame that I can send:

Code: Select all

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Current BINARY Frame:
Length: 61
Frame Type:  6
frame (HEX): 3C3D3E0638380010FDC337DEE16E5F30312300342103B6E6474003B6E6474003B6E6474003B6E6474003B6E6474003B6E6474003B6E6474003B6E64740
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Could you help me?

Regards

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: Problem with sending a frame longer than 61 bytes of length. 4G http method GET

Post by libelium-dev » Wed Sep 11, 2019 2:05 pm

Hi,

What is the length of the resource variable? We are trying to find the maximum resource length in the datasheet of the module but it isn't indicated.

Could you please share the output with debug mode 2 enabled? You can enable it inside Wasp4G.h file. Then upload the code to the node again.

Code: Select all

#define DEBUG_WASP4G 	0
You can try to perform the HTTP GET request opening a TCP socket. You can find an example code in the following link
http://www.libelium.com/development/was ... cp-client/

Regards

agpp
Posts: 8
Joined: Wed Jun 20, 2018 10:40 am
Company: IMDEA-AGUA

Re: Problem with sending a frame longer than 61 bytes of length. 4G http method GET

Post by agpp » Wed Sep 11, 2019 3:43 pm

Hi,
Thank you for your suggestion. I will try to perform the HTTP GET request with a TCP socket.

This is my resource variable:

Code: Select all

char resource[] = "/get_frame_biore.php?frame=3C3D3E06F1380010FDC337DEE16E5F303123003421015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740015328B93F02F097384003B6E64740"; 
If I am not mistaken, its length is 519 bytes.


The output with debug mode 2 enabled is:

Code: Select all

J#
----------  Start program   -----------
*****************************
APN: Movistar
LOGIN: telefonica.es
PASSWORD: telefonica
*****************************
[LE910] ==> ERROR CODE: operation not allowed
1. 4G module ready...
2. Getting URL with GET method...[LE910] CREG: 0,2
[LE910] CREG: 0,2
[LE910] CREG: 0,1
[LE910] CGREG: 0,1
[LE910] GPRS context activation:1
[LE910] IP address:10.205.250.84
Failed. Error code: 17
3. Switch OFF 4G module
4. Enter deep sleep...
Regards

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: Problem with sending a frame longer than 61 bytes of length. 4G http method GET

Post by libelium-dev » Thu Sep 12, 2019 11:43 am

Hi,

We have just checked that the maximum resource size is 150bytes and it seems that it can't be configured. Anyway, we are going to investigate in more deep if it is possible to configure it.

Please try to perform the http get request through a TCP socket. In this case, the maximum length is 1500 bytes.

Regards

jot4p
Posts: 192
Joined: Thu Apr 21, 2016 5:19 pm

Re: Problem with sending a frame longer than 61 bytes of length. 4G http method GET

Post by jot4p » Wed Nov 20, 2019 11:14 pm

Hi,

I have the same problem.. It's possible to increase ? and with POST method what is the limit?

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: Problem with sending a frame longer than 61 bytes of length. 4G http method GET

Post by libelium-dev » Thu Nov 21, 2019 9:44 am

Hi,

We recommend performing the HTTP request through a TCP socket. In this case, the limit of the full HTTP request is 1500bytes and you can include headers in the request. You can find an example code in the following link
http://www.libelium.com/development/was ... cp-client/

Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest