TCP flow control


#1

I’m using a Q24PL001 with the TCP/IP stack through AT commands at 9600 baud, connected to a microcontroller. I’m starting a GPRS bearer, connecting a transparent TCP socket to the server, and then requesting a large chunk of data, around 67K. My command sequence is as follows:

at+wopen=1
at+wipcfg=1
at+wipbr=1,6
at+wipbr=2,6,11,“myaccesspoint”
at+wipbr=2,6,0,“myusername”
at+wipbr=2,6,1,“mypassword”
at+wipbr=4,6,0
at+wipcreate=2,2,“myserver.com”,80
at+wipdata=2,2,2
GET mywebsite/myfile.bin HTTP/1.1
Host: myserver.com

The problem is that only around 20K of the data actually shows up. I get the beginning of the file and the ending but a large portion in the middle is missing. It would appear that the TCP flow control in the modem is not correctly throttling the data and lots of it is getting dropped before it reaches the UART.

At first I thought it might be a flow control problem on my end, but I double checked to make sure that flow control is enabled through AT+IFC=2,2 and that my RTS line is working properly and that I’m not getting any overruns on my UART. I even tried increasing my microcontroller receive buffer to 80K and suspending all background tasks but I still only get the same 20K of data.

Just out of curiosity I tried the same test at 19200 baud and this time I got a bit more data, around 40K, but still nowhere near the full 67K. I can’t really go any higher than 9600 baud anyway without changing my oscillator.

Is there a step that I’m missing somewhere? Do I need to set up TCP window sizes on the modem somehow? The manual does show a AT+WIPOPT command where I can set various options on the TCP socket including WIP_COPT_SND_LOWAT and WIP_COPT_RCV_LOWAT but it doesn’t give any explanation as to what these options are or what they do.

Any ideas?


#2

Hi
The WIP_COPT_SND_LOWAT option refers to the minimum amount of available space that must be available in the emission buffer before WIP_CEV_WRITE event can be generated.This event is an indication that now, the buffer space greater than or equal to WIP_COPT_SND_LOWAT is available, and the data which was pending can now be sent to the peer.

Regards
Paruthiv


#3

Is there any way to access this WIP_CEV_WRITE event through the AT commands? Even if there is I don’t think this will help my problem since it doesn’t sound like WIP_COPT_RCV_LOWAT will have any effect on the TCP window size.

Anyway I managed to get a temporary solution to my problem. I changed my oscillator so now my microcontroller can support 115200 baud. At this speed, I get the entire 67K file without any missing bytes. I’m assuming this works only because 115200 is faster than the GPRS receive speed on the Q24 so TCP flow control becomes unnecessary. This is still not an acceptable solution since I can’t change oscillators on devices that are already in the field so I really need this to work at 9600 baud.

So what exactly is the maximum receive data rate on the Q24? The manual just says “GPRS class 10” but doesn’t give any actual numbers in kbps.

Is there any way to force the Q24 into using a slower GPRS data rate?


#4

You could create an Open-AT application to Make It So…