Q2686 TCP sample code

Hi,
I have developed some application on wavecom q2686 module,.
my application is to receive the data from uart and upload the data to FTP server at regular interval .
In this I need to upload the data once in an hour .
I tried to implement this using TCP client sample program provided in the Open AT os . I am able to upload the data , but the problem is after some time IP gets terminated or device gets restarted , so I cant upload the next data , This happens irregularly and do not know why this happens.

How to over come these problems .?

How to make the GPRS enable only when I need to send the data to server…? i.e sim should be subscribed at the starting of the device and GPRS can be able to enable before sending the data and disable it once the data has been sent .
regards
Ravee

"IP gets terminated or device gets restarted "
If this is within an hour, some thing is up probably in your code. What are the IP status messages telling you?

I would open the GPRS each time you send data if its once an hour. It avoids problems like these:
https://forum.sierrawireless.com/t/gprs-maintaining-link-wregc/4655/1
https://forum.sierrawireless.com/t/repeating-gprs-connection/4759/1

If the device is rebooting, then there is definately something wrong in your code. If you have a long stream of data, make sure you are not spending ages handling it in a tight loop. You might need some task delays in it to let the processor do something else. Check the backtraces for any clues.

GPRS providers will not keep an idle link open indefinitely; how long, exactly, depends entirely upon your chosen service subscription with your chosen provider.

Some providers will close the link after a very short period of inactivity - possibly 15 minutes or less.

Apart from this, you must remember that GPRS is a radio link - and it is in the very nature of radio links to experience drop-outs.

Therefore your application must be written to cope with the link becoming unexpectedly unavailable!

and, more importantly, be sure to close it cleanly when you’re done!

which could simply be that you are assuming that the link is up - when it isn’t!

FAQ: FAQ forum/wiki?

FAQ: viewtopic.php?f=7&t=3766&start=15#p18220
and: viewtopic.php?f=7&t=3766&start=15#p18378

Hi,
Thanks for the reply , Here with I have attached my code which I have written for my application .

if something wrong in my code , how can it upload the data few times (i’m uploading once in hour ) and restart occurs after few successful uploads .

And I’m sending maxium of 500bytes .

Still I have not understood about how to switch of GPRS and and switch on ? (any user guide may help) …

And finally I have a small doubt , Since I know the time when the external device is going to send the data to my wave come module through uart , is there any way to send the device(q2686 ) to sleep mode ( radios and processor switched Off) for some time interval and switch it ON/ restart after timer expires …?
I can not use the external interrupt on ON/OFF pin of module becoz its our customized board so I have to go with software method only.
This could help me to save the power becoz in future I may send data once in 2 or 3 hour …

regards
Ravee
Gateway.zip (8.17 KB)

What are the IP status messages telling you? WIP_CEV_ERROR, WIP_CEV_PEER_CLOSE ?
WIP_BEV_CONN_FAILED, WIP_BEV_IP_DISCONNECTED, WIP_BEV_STOPPED?

What do the backtraces tell you about the reboot? See adl_errSubscribe()

Hi,

WIP_BEV_CONN_FAILED, , says connection failure and WIP_BEV_IP_DISCONNECTED says communication terminated , and WIP_BEV_STOPPED displays nothing …

I coudnt see anything in the adl_errSubscribe() ,…

Since I need the connection for max 5 minit , is there any way to send the device(q2686 ) to sleep mode ( radios and processor switched Off) for some time interval and switch it ON/ restart after timer expires …?

regards
Ravee

appli.c -> try making the “custom stack size” bigger - like 64k

64K sounds excessive for the final application, but would certainly let you see what happens when you have “plenty” of stack.

IF it still crashes with 64K stack then that probably incates that it’s either not a stack issue at all, or you are doing something silly that uses a huge amount of stack (eg, allocating large automatic (“local”) buffers)…

Hi BenFT01,
After debugging I have come to know that problem is at refreshing the GPRS links ,
I have tried all the possible (which I could get it and with “Awneil” suggestions) to refresh the link , but could nt …
my tried option present in the below link
[url]https://forum.sierrawireless.com/t/start-and-stop-gprs-bearer-connection/4923/1] ,…

Pls sugget me how to do the proper GPRS refreshing …

regards

Ravee