HTTP POST using 4G library fails - error code 17

Wireless communications in Waspmote, topologies, node types...
B2L_steve
Posts: 18
Joined: Mon Jun 17, 2019 4:26 am
Company: Bio2Lab Pty Ltd

Re: HTTP POST using 4G library fails - error code 17

Post by B2L_steve » Tue Jun 25, 2019 4:31 am

I get the same error sending to a local server - any more ideas? Anyone?

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

Re: HTTP POST using 4G library fails - error code 17

Post by libelium-dev » Tue Jun 25, 2019 9:36 am

Hi,

Could you please share the code used to test with the local server? So we will test here if we can perform the http request.

Regards

B2L_steve
Posts: 18
Joined: Mon Jun 17, 2019 4:26 am
Company: Bio2Lab Pty Ltd

Re: HTTP POST using 4G library fails - error code 17

Post by B2L_steve » Fri Jun 28, 2019 1:04 am

*******************************
code as follows
*******************************
#include <Wasp4G.h>

// APN settings
///////////////////////////////////////
char apn[] = "telstra.m2m";
char login[] = "";
char password[] = "";
///////////////////////////////////////

// SERVER settings
///////////////////////////////////////
char host[] = "httpbin.org";
uint16_t port = 80;
char resource[] = "/post";
char data[] = "varA=1&varB=2&varC=3&varD=4&varE=5";
///////////////////////////////////////

// variables
int error;


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

USB.println(F("********************************************************************"));
USB.println(F("POST method to a test url"));
USB.println(F("You can use this php to test the HTTP connection of the module."));
USB.println(F("The php returns the parameters that the user sends with the URL."));
USB.println(F("********************************************************************"));


//////////////////////////////////////////////////
// 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 POST
////////////////////////////////////////////////

USB.println(F("2. HTTP POST request..."));

USB.println(F("wait 5 seconds..."));
delay(5000);

// send the request
error = _4G.http( Wasp4G::HTTP_POST, host, port, resource, data);


USB.println(F("wait another 10 seconds..."));
delay(10000);

// 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("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:10", RTC_OFFSET, RTC_ALM1_MODE1, ALL_OFF);

USB.ON();
USB.println(F("5. Wake up!!\n\n"));

}


*******************************
serial output as follows
*******************************

[LE910] ==> ERROR CODE: operation not supported
1. 4G module ready...
2. HTTP POST request...
wait 5 seconds...
[LE910] CREG: 0,1
[LE910] CGREG: 0,1
[LE910] GPRS context activation:1
[LE910] IP address:10.114.105.117
wait another 10 seconds...
Failed. Error code: 17
3. Switch OFF 4G module
4. Enter deep sleep...
5. Wake up!!

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

Re: HTTP POST using 4G library fails - error code 17

Post by libelium-dev » Fri Jun 28, 2019 9:03 am

Hi,

Your code has worked in our test.

Please perform just one test more to check the coverage and copy here the output
http://www.libelium.com/development/was ... work-info/

Regards

B2L_steve
Posts: 18
Joined: Mon Jun 17, 2019 4:26 am
Company: Bio2Lab Pty Ltd

Re: HTTP POST using 4G library fails - error code 17

Post by B2L_steve » Wed Jul 03, 2019 7:16 am

Output below:

H#
Start program

*****************************
APN: telstra.m2m
LOGIN:
PASSWORD:
*****************************

[LE910] ==> ERROR CODE: operation not supported
1. 4G module ready
[LE910] CREG: 0,1
[LE910] CGREG: 0,1
[LE910] GPRS context activation:1
[LE910] IP address:10.114.31.105
1.1. Module connected to network
Raw RSSI: 31
1.2. RSSI: -51 dBm
1.3. Network type: LTE
1.4. Operator: Telstra
2. Switch OFF 4G module
3. Enter deep sleep...

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

Re: HTTP POST using 4G library fails - error code 17

Post by libelium-dev » Thu Jul 04, 2019 7:46 am

Hi,

Could you please try to set the apn telstra.wap or telstra.internet? Could you please check with your sim card provider if there is any problem with the sim? Did you try with a sim card from another company?

Is the sim pin disabled?

Do you have another P&S?

Apologies for the inconvenience and all test we are asking. We need to debug the problem remotely since in case we have to repair the module we can't test the data connection in our facilities due to the frequencies used by the Australian module.

Regards

B2L_steve
Posts: 18
Joined: Mon Jun 17, 2019 4:26 am
Company: Bio2Lab Pty Ltd

Re: HTTP POST using 4G library fails - error code 17

Post by B2L_steve » Thu Jul 04, 2019 8:48 am

I have only one P&S unit, sorry.

The sim does not have a pin, and in any case the TCP connection would not have worked if the sim was disabled (see earlier posts)

Using the test script for 4G connection properties:
telstra.wap - same result
telstra.internet - same result
H#
Start program

*****************************
APN: telstra.wap
LOGIN:
PASSWORD:
*****************************
[LE910] ==> ERROR CODE: operation not supported
1. 4G module ready
[LE910] CREG: 0,3
[LE910] CREG: 0,3
[LE910] CREG: 0,3
[LE910] CREG: 0,3
...
[LE910] CREG: 0,3
2. Switch OFF 4G module
3. Enter deep sleep...
4. Wake up!!


Using a sim from a different company with a different network:
optus.wap - same result

optus.internet - does not work at all
H#
Start program

*****************************
APN: optus.internet
LOGIN:
PASSWORD:
*****************************
[LE910] ==> ERROR CODE: operation not supported
1. 4G module ready
[LE910] CREG: 0,3
[LE910] CREG: 0,3
[LE910] CREG: 0,3
[LE910] CREG: 0,3
...
[LE910] CREG: 0,3
2. Switch OFF 4G module
3. Enter deep sleep...
4. Wake up!!

I'm out of ideas...

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

Re: HTTP POST using 4G library fails - error code 17

Post by libelium-dev » Thu Jul 04, 2019 9:33 am

Hi,

Could you please perform the following test again but using the optus sim card? Please make sure you set the correct APN otherwise the network will reject the connection (CREG: 0,3)
https://www.optus.com.au/for-you/suppor ... l-settings
  • AT
  • AT+WS46=25
  • AT+CGDCONT=1,"IP","telstra.m2m"
  • AT+CREG? //to send up to module will return CREG: 0,1 or CREG: 0,5
  • AT+CGREG? //to send up to module will return CGREG: 0,1 or CREG: 0,5
  • AT#GPRS=1
  • AT#HTTPCFG=0,"test.libelium.com",80
  • AT#HTTPSND=0,0,"/test-get-post.php?",6
  • varA=1
In addition, please download the last API v42 and test the examples.
http://www.libelium.com/development/was ... lications/

If it still doesn't work please fill the RMA form and our tech support team will contact you to solve the issue.
https://www.libelium.com/contact/#rma

Regards

B2L_steve
Posts: 18
Joined: Mon Jun 17, 2019 4:26 am
Company: Bio2Lab Pty Ltd

Re: HTTP POST using 4G library fails - error code 17

Post by B2L_steve » Fri Jul 05, 2019 3:39 am

I tried with both sim card and telstra card is getting me further, but still not all the way:

Results with telstra sim card: This appears to connect to the network successfully, receive and IP, but HTTPGET fails.

#######################################
Bridge between USB port and SOCKET1
AT
OK

AT+WS46=25
ERROR

AT+CGDCONT=1,"IP","telstra.m2m"
OK

AT+CREG?
+CREG: 0,1
OK

AT+CGREG?
+CGREG: 0,1
OK

AT#GPRS=1
+IP: 10.116.125.107
OK

AT#HTTPCFG=0,"test.libelium.com",80
OK

AT#HTTPSND=0,0,"/test-get-post.php?",6
ERROR

########################################

Results with optus sim card
Note1. this is a service resold by a company called Spintel which uses the Optus wholesale network. Instructions on this APN were sourced from: https://service.spintel.net.au/index.ph ... -broadband)
Note 2. I am aware this is a 3G network, so also tested the example: 3G 15a: Getting URL - also failed

########################################
H#
Bridge between USB port and SOCKET1

AT
OK

AT+WS46=25
ERROR

AT+CGDCONT=1,"IP","splns999a1"
OK

AT+CREG?
+CREG: 0,3
OK

AT+CGREG?
+CGREG: 0,2
OK

AT#GPRS=1
ERROR

AT#HTTPCFG=0,"test.libelium.com",80
OK

AT#HTTPSND=0,0,"/test-get-post.php?",6
ERROR
#######################################

Will continue testing with the teslstra card as this is the only network which supports 4G...

B2L_steve
Posts: 18
Joined: Mon Jun 17, 2019 4:26 am
Company: Bio2Lab Pty Ltd

Re: HTTP POST using 4G library fails - error code 17

Post by B2L_steve » Fri Jul 05, 2019 4:11 am

Ammending previous comment - Telstra network seems to be the only one on which I can connect to 4G

For the sake of completeness - Module diagnostics results with the telstra sim inserted:

#######################################
H#
Bridge between USB port and SOCKET1
AT
OK

AT+CGMI
Telit //Manufacturer
OK

AT+CGMM
LE910-AU V2 //Model
OK

AT+CGMR
20.00.102 //Version
OK

AT+CSQ
+CSQ: 24,2
OK

AT+COPS=?
+COPS: (2,"Telstra",,"50501",7),(3,"Optus AU",,"50502",7),(3,"vodafone AU",,"50503",7),,(0-4),(0,2) //There are 3 networks available to connect to
OK

AT+COPS=4,2,"50501"
OK //Make sure we will connect to Telstra network

AT+CREG?
+CREG: 0,1 //Yes we will
OK

AT+CGDCONT?
+CGDCONT: 1,"IPV4V6","telstra.m2m","",0,0 //Confirm network details we sill connect to
OK

AT+CGATT=1
OK //Connected successfully

AT+CGPADDR= 1
+CGPADDR: 1,"10.116.82.64" //And this is our IP address
OK

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest