Some progress with the code from @ Jay Jay. The exception is mscorlib.dll has gone, but things still are behaving as I would like.
The first pass through the loop works great every time. However, when it’s on its second pass it always fails.
Here’s the output:
AT
OK
OK found...
AT
+RST
OK
OK found...
ets
Jan
8
2013,rst
cause:4,
boot
m
ode:(3,2)
wdt
reset
load
0x40100000
,
len
1320,
room
16
tail
8
chksum
0xb8
load
0x3ffe8000,
len
776,
room
0
tail
8
chksum
0xd9
load
0x3ffe8308,
len
412,
room
0
tail
12
chksum
0xb9
csum
0xb9
2nd
boot
version
:
1.3(b3)
SPI
Speed
:
40MHz
SPI
Mode
:
QIO
SPI
Flash
Size
:
4Mbit
jump
to
run
user1
rl
ÿ
ready
Ready found...
AT+CWMOD
E=3
OK
OK found...
AT
+CWLAP
+C
WLAP:(3,"MY
WIFI
E2
99",-66,"b0:45:19:25:e2:99",6)
+CWLAP:(
4,"NETGEAR",-45,"00:1e:2a:3c:fb:f0",11)
OK
OK found...
AT
+CWJAP="NETGEAR","$$$$$$$$$$$$"
OK
OK found...
AT
+CIFSR
+CIFSR:API
P,"192.168.4.1"
+CIFSR:APMAC,"1a:fe:34:a0:33:a
b"
+CIFSR:STAIP,"192.168.46.34"
+CIFSR:STAMAC
,"18:fe:34:a0:33:ab"
OK
OK found...
AT
+CIPSTART="TCP","ww
w.jasonjames.co.uk",80
CO
NNECT
OK
OK found...
AT
+CIPSEND=191
OK
OK found...
>
> found...
PO
ST
/api/json
HTTP/1
.1
Content-Type:
application/x-www-form-
urlencoded;
charset=UTF-8
Host:
www.jasonjame
s.co.uk
Connection:
Close
Content-Length:
33
Value=27
.18&DeviceId=C3PO&Count=1
SEND
OK
OK found...
+IPD,417:HTTP/1.1
200
OK
OK found...
Cache-Control:
no-cache
Pragma:
no-cache
Content-Length:
108
Content-Type:
application/json;
charset=utf-8
Expires:
-1
Server:
Microsoft-IIS/8.0
X-AspNet-Version:
4.0.30319
X-Powered-By:
ASP.NET
Set-Cookie:
ARRAffinity=f6773f17995880729e4f99a31975fd627a10ff7d78e6036bc2480e516a51d57b;Pa
th=/;Domain=www.jasonjames.co.uk
Date:
Wed,
08
Apr
2015
13:31:47
GMT
Connection:
close
{"Id":73844,"V
+IPD,94:alue":"27.18","DeviceId":"C3PO","Co
unt":"1","CreatedDate":"2015-04-08T13:31:48.6766802+00:00"}CLOSED
AT
+CIPSTART="TCP","ww
w.jasonjames.co.uk",80
AT+CIPSEND=191
busy
p...
CO
NNECT
OK
OK found...
PO
ST
/api/json
HTTP/1
.1
ERROR
ERROR found...
Content-Type:
applicatio
n/x-www-form-urlencoded;
charset=UTF-8
Host:
www.j
ERROR
ERROR found...
asonjame
s.co.uk
ERROR
ERROR found...
Connection:
Close
ERROR
ERROR found...
Content-Length:
33
ERROR
ERROR found...
ERROR
ERROR found...
Value=77.34&
DeviceId=C3PO&Count=1
It look like the AT+CIPSEND is not waiting for AT+CIPSTART to finish before it sends the data. The call is wrapped in an AutoResetEvent, but it seems as though the call resets immediately and the next command is executed before it should be. As such the comms get out of sync and the outcome is an error.
Any ideas how I can wait for the first call to correctly finish before sending the second call, especially as it works for the first iteration?