I think the only way to do that is to interrupt on bytes received or poll to determine how much has been accumulated and execute a HSERSETUP OFF once it gets close to its limit.I'm looking, but is there a convenient way on the 20x2 to prevent HSERPTR from wrapping to 0?
w0 = hSerPtr - ptr
If w0 >= $8000 Then
w0 = w0 + 128
End If
SerTxd("Held in buffer = ", #w0, CR, LF )
Do you have details of how to configure it so it doesn't ?An ESP only sends long strings if you tell it to.
Ready
Power-On Message...
<140><226><2><236><18><130>n<236><146>r<130><242>n|<236><12><140><12><142>|rl<140><226>r<146>l<140>l<18><140><12><12><12>l`<2><140><226>r<146>l<236>l<18><140><12><12><12>l`<2><140><226>r<146>l<12><142><158><0><140><12><12>ll`<2>rl<142><130>rl<140><158><226><140>b<12>l<140>br|<12><142>bp`<236>l<236>b<18>lr<140>lb<236><242>n<238><128><18>nn<226><16><2><12><2><140>l<242>p<2><12>l<12><140><12>l<140><142><140><12><140><12><12><142><30><142>l<142><14>l<128><2>n<252><0><140><158><226><140>b<12>l<236><142><28>p<12><12><2><2><140><158><226><140>b<12>l<12><140>bprlrl<CR><LF>
ready<CR><LF>
Reset module
Version Details
WIFIQ<21><17>5<LF>
AT+RST<CR><CR><LF>
<CR><LF>
OK<CR><LF>
WIFI DISCONNECT<CR><LF>
<CR><LF>
. . . [Lots of junk]
AT version:1.2.0.0(Jul 1 2016 20:04:45)<CR><LF>
SDK version:1.5.4.1(39cb9a32)<CR><LF>
v1.0.0<CR><LF>
Mar 11 2018 18:27:31<CR><LF>
OK<CR><LF>
WIFI CONNECTED<CR><LF>
Configure as station
AT+CWMODE=1<CR><CR><LF>
<CR><LF>
OK<CR><LF>
Connect to access point
Got so far...
AT+CWJAP=MySSID","MyPW"<CR><CR><LF>
WIFI DISCONNECT<CR><LF>
Got so far...
AT+CWJAP="MySSID","MyPW"<CR><CR><LF>
WIFI DISCONNECT<CR><LF>
WIFI CONNECTED<CR><LF>
Complete packet
AT+CWJAP="MySSID","MyPW"<CR><CR><LF>
WIFI DISCONNECT<CR><LF>
WIFI CONNECTED<CR><LF>
WIFI GOT IP<CR><LF>
<CR><LF>
OK<CR><LF>
Connected
Connected status
AT+CIPSTATUS<CR><CR><LF>
STATUS:2<CR><LF>
<CR><LF>
OK<CR><LF>
Our IP Address
AT+CIFSR<CR><CR><LF>
+CIFSR:STAIP,"192.168.1.224"<CR><LF>
+CIFSR:STAMAC,"60:01:94:11:0c:95"<CR><LF>
<CR><LF>
OK<CR><LF>
Allow multiple connections
AT+CIPMUX=1<CR><CR><LF>
<CR><LF>
OK<CR><LF>
Start server on port 80
AT+CIPSERVER=1,80<CR><CR><LF>
<CR><LF>
OK<CR><LF>
Waiting for requests...
Request has arrived
0,CONNECT<CR><LF>
<CR><LF>
+IPD,0,427:GET / HTTP/1.1<CR><LF>
Host: 192.168.1.224<CR><LF>
Connection: keep-alive<CR><LF>
Cache-Control: max-age=0<CR><LF>
Upgrade-Insecure-Requests: 1<CR><LF>
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Iridium/2018.11 Safari/537.36 Chrome/71.0.0.0<CR><LF>
DNT: 1<CR><LF>
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8<CR><LF>
Accept-Encoding: gzip, deflate<CR><LF>
Accept-Language: en-US,en;q=0.9<CR><LF>
<CR><LF>
Request is ...
mux=0
url=<TIMEOUT>
processURL
Indicate reply
Full packet
AT+CIPSEND=0,234<CR><CR><LF>
<CR><LF>
OK<CR><LF>
>
Send reply - 234 bytes
Full packet
<CR><LF>
Recv 234 bytes<CR><LF>
<CR><LF>
SEND OK<CR><LF>
Close reply
AT+CIPCLOSE=0<CR><CR><LF>
0,CLOSED<CR><LF>
<CR><LF>
OK<CR><LF>
0,CONNECT<CR><LF>
<CR><LF>
+IPD,0,368:GET /favicon.ico HTTP/1.1<CR><LF>
Host: 192.168.1.224<CR><LF>
Connection: keep-alive<CR><LF>
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Iridium/2018.11 Safari/537.36 Chrome/71.0.0.0<CR><LF>
DNT: 1<CR><LF>
Accept: image/webp,image/apng,image/*,*/*;q=0.8<CR><LF>
Referer: http://192.168.1.224/<CR><LF>
Accept-Encoding: gzip, deflate<CR><LF>
Accept-Language: en-US,en;q=0.9<CR><LF>
<CR><LF>
Request has arrived
AT+CIPCLOSE=0<CR><CR><LF>
0,CLOSED<CR><LF>
<CR><LF>
OK<CR><LF>
0,CONNECT<CR><LF>
<CR><LF>
+IPD,0,368:GET /favicon.ico HTTP/1.1<CR><LF>
Host: 192.168.1.224<CR><LF>
Connection: keep-alive<CR><LF>
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Iridium/2018.11 Safari/537.36 Chrome/71.0.0.0<CR><LF>
DNT: 1<CR><LF>
Accept: image/webp,image/apng,image/*,*/*;q=0.8<CR><LF>
Referer: http://192.168.1.224/<CR><LF>
Accept-Encoding: gzip, deflate<CR><LF>
Accept-Language: en-US,en;q=0.9<CR><LF>
<CR><LF>
Request is ...
mux=0
url=favicon.ico
processURL
Got favicon.ico request
Close reply
AT+CIPCLOSE=0<CR><CR><LF>
0,CLOSED<CR><LF>
<CR><LF>
OK<CR><LF>
Indicate reply
Got so far...
AT+CIPCLOSE=0<CR><CR><LF>
0,CLOSED<CR><LF>
<CR><LF>
OK<CR><LF>
AT+CIPSEND=0,234<CR><CR><LF>
link is not valid<CR><LF>
<CR><LF>
ERROR<CR><LF>
Got so far...
AT+CIPCLOSE=0<CR><CR><LF>
0,CLOSED<CR><LF>
<CR><LF>
OK<CR><LF>
AT+CIPSEND=0,234<CR><CR><LF>
link is not valid<CR><LF>
<CR><LF>
ERROR<CR><LF>
Got so far...
AT+CIPCLOSE=0<CR><CR><LF>
0,CLOSED<CR><LF>
<CR><LF>
OK<CR><LF>
AT+CIPSEND=0,234<CR><CR><LF>
link is not valid<CR><LF>
<CR><LF>
ERROR<CR><LF>
ready
AT+GMR
AT version:1.2.0.0(Jul 1 2016 20:04:45)
SDK version:1.5.4.1(39cb9a32)
v1.0.0
Mar 11 2018 18:27:31
OK
WIFI CONNECTED
AT+CWMODE=1
OK
AT+CWJAP="MySSID","MyPW"
WIFI DISCONNECT
WIFI CONNECTED
WIFI GOT IP
OK
AT+CIPSTATUS
STATUS:2
OK
AT+CIFSR
+CIFSR:STAIP,"192.168.1.224"
+CIFSR:STAMAC,"60:01:94:11:0c:95"
OK
AT+CIPMUX=1
OK
AT+CIPSERVER=1,80
OK
0,CONNECT
+IPD,0,427:GET / HTTP/1.1
Host: 192.168.1.224
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Iridium/2018.11 Safari/537.36 Chrome/71.0.0.0
DNT: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
AT+CIPSEND=0,234
OK
>
Recv 234 bytes
SEND OK
AT+CIPCLOSE=0
0,CLOSED
OK
0,CONNECT
+IPD,0,368:GET /favicon.ico HTTP/1.1
Host: 192.168.1.224
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Iridium/2018.11 Safari/537.36 Chrome/71.0.0.0
DNT: 1
Accept: image/webp,image/apng,image/*,*/*;q=0.8
Referer: http://192.168.1.224/
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
AT+CIPCLOSE=0
0,CLOSED
OK
AT+CIPSEND=0,234
link is not valid
ERROR
Do you have details of how to configure it so it doesn't ?
Got favicon.ico request
Close reply
AT+CIPCLOSE=0<CR><CR><LF>
0,CLOSED<CR><LF>
<CR><LF>
OK<CR><LF>
Indicate reply
Got so far...
AT+CIPCLOSE=0<CR><CR><LF>
0,CLOSED<CR><LF>
<CR><LF>
OK<CR><LF>
AT+CIPSEND=0,234<CR><CR><LF>
link is not valid<CR><LF>
<CR><LF>
ERROR<CR><LF>
If number = 0 Then
If Found("favicon.ico") Then
SerTxd( CR, LF, "Got favicon.ico request", CR,LF )
uptoPtr = savePtr
Gosub CloseReply
Return
End If
End If
CloseReply:
SerTxd( CR, LF, "Close reply", CR, LF )
HSerOut 0, ( "AT+CIPCLOSE=", mux, CR, LF )
Gosub ReceivePacket
Gosub ShowPacket_Indented
Return
SendReply_SendLength:
SerTxd( CR, LF, "Indicate reply", CR, LF )
Yes I believe that's the issue. In AT mode you get back the echoes and responses to AT commands. Plus, unsolicited, whatever is received from the browser, "all of it", prefixed by a "+IPD".EDIT: I keep forgetting this is being done with AT commands so I suppose you were talking about the AT replies.
Request is ...
mux=0
url=<TIMEOUT>
ShowPacket_Truncated:
If fromPtr = uptoPtr Then
SerTxd( "<NOTHING>", CR, LF )
Return
End If
ShowPacket:
indent = 0
; Report the request info we have
SerTxd( CR, LF, "Request is ...", CR, LF )
SerTxd( "mux=", mux, CR, LF)
SerTxd( "url=" )
Gosub ShowPacket_Truncated
Progress, but no joy yet.ShowPacket_Truncated
Our IP Address
AT+CIFSR<CR><CR><LF>
+CIFSR:STAIP,"192.168.1.224"<CR><LF>
+CIFSR:STAMAC,"60:01:94:11:0c:95"<CR><LF>
<CR><LF>
OK<CR><LF>
Allow multiple connections
AT+CIPMUX=1<CR><CR><LF>
<CR><LF>
OK<CR><LF>
Start server on port 80
AT+CIPSERVER=1,80<CR><CR><LF>
<CR><LF>
OK<CR><LF>
Waiting for requests...
Request has arrived
0,CONNECT<CR><LF>
<CR><LF>
+IPD,0,427:GET / HTTP/1.1<CR><LF>
Host: 192.168.1.224<CR><LF>
Connection: keep-alive<CR><LF>
Cache-Control: max-age=0<CR><LF>
Upgrade-Insecure-Requests: 1<CR><LF>
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Iridium/2018.11 Safari/537.36 Chrome/71.0.0.0<CR><LF>
DNT: 1<CR><LF>
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8<CR><LF>
Accept-Encoding: gzip, deflate<CR><LF>
Accept-Language: en-US,en;q=0.9<CR><LF>
<CR><LF>
1,CONNECT<CR><LF>
Request is ...
mux=0
url=<NOTHING>
processURL
Indicate reply
Full packet
AT+CIPSEND=0,234<CR><CR><LF>
<CR><LF>
OK<CR><LF>
>
Send reply - 234 bytes
Full packet
<CR><LF>
Recv 234 bytes<CR><LF>
<CR><LF>
SEND OK<CR><LF>
Close reply
AT+CIPCLOSE=0<CR><CR><LF>
0,CLOSED<CR><LF>
<CR><LF>
OK<CR><LF>
<CR><LF>
+IPD,1,368:GET /favicon.ico HTTP/1.1<CR><LF>
Host: 192.168.1.224<CR><LF>
Connection: keep-alive<CR><LF>
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Iridium/2018.11 Safari/537.36 Chrome/71.0.0.0<CR><LF>
DNT: 1<CR><LF>
Accept: image/webp,image/apng,image/*,*/*;q=0.8<CR><LF>
Referer: http://192.168.1.224/<CR><LF>
Accept-Encoding: gzip, deflate<CR><LF>
Accept-Language: en-US,en;q=0.9<CR><LF>
<CR><LF>
Request has arrived
AT+CIPCLOSE=0<CR><CR><LF>
0,CLOSED<CR><LF>
<CR><LF>
OK<CR><LF>
<CR><LF>
+IPD,1,368:GET /favicon.ico HTTP/1.1<CR><LF>
Host: 192.168.1.224<CR><LF>
Connection: keep-alive<CR><LF>
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Iridium/2018.11 Safari/537.36 Chrome/71.0.0.0<CR><LF>
DNT: 1<CR><LF>
Accept: image/webp,image/apng,image/*,*/*;q=0.8<CR><LF>
Referer: http://192.168.1.224/<CR><LF>
Accept-Encoding: gzip, deflate<CR><LF>
Accept-Language: en-US,en;q=0.9<CR><LF>
<CR><LF>
Request is ...
mux=1
url=favicon.ico
processURL
Got favicon.ico request
Close reply
AT+CIPCLOSE=1<CR><CR><LF>
1,CLOSED<CR><LF>
<CR><LF>
OK<CR><LF>
0,CONNECT<CR><LF>
<CR><LF>
+IPD,0,368:GET /favicon.ico HTTP/1.1<CR><LF>
Host: 192.168.1.224<CR><LF>
Connection: keep-alive<CR><LF>
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Iridium/2018.11 Safari/537.36 Chrome/71.0.0.0<CR><LF>
DNT: 1<CR><LF>
Accept: image/webp,image/apng,image/*,*/*;q=0.8<CR><LF>
Referer: http://192.168.1.224/<CR><LF>
Accept-Encoding: gzip, deflate<CR><LF>
Accept-Language: en-US,en;q=0.9<CR><LF>
<CR><LF>
Indicate reply
Got so far...
AT+CIPCLOSE=1<CR><CR><LF>
1,CLOSED<CR><LF>
<CR><LF>
OK<CR><LF>
0,CONNECT<CR><LF>
<CR><LF>
+IPD,0,368:GET /favicon.ico HTTP/1.1<CR><LF>
Host: 192.168.1.224<CR><LF>
Connection: keep-alive<CR><LF>
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Iridium/2018.11 Safari/537.36 Chrome/71.0.0.0<CR><LF>
DNT: 1<CR><LF>
Accept: image/webp,image/apng,image/*,*/*;q=0.8<CR><LF>
Referer: http://192.168.1.224/<CR><LF>
Accept-Encoding: gzip, deflate<CR><LF>
Accept-Language: en-US,en;q=0.9<CR><LF>
<CR><LF>
AT+CIPSEND=1,234<CR><CR><LF>
link is not valid<CR><LF>
<CR><LF>
ERROR<CR><LF>
Got so far...
AT+CIPCLOSE=1<CR><CR><LF>
1,CLOSED<CR><LF>
<CR><LF>
OK<CR><LF>
0,CONNECT<CR><LF>
<CR><LF>
+IPD,0,368:GET /favicon.ico HTTP/1.1<CR><LF>
Host: 192.168.1.224<CR><LF>
Connection: keep-alive<CR><LF>
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Iridium/2018.11 Safari/537.36 Chrome/71.0.0.0<CR><LF>
DNT: 1<CR><LF>
Accept: image/webp,image/apng,image/*,*/*;q=0.8<CR><LF>
Referer: http://192.168.1.224/<CR><LF>
Accept-Encoding: gzip, deflate<CR><LF>
Accept-Language: en-US,en;q=0.9<CR><LF>
<CR><LF>
AT+CIPSEND=1,234<CR><CR><LF>
link is not valid<CR><LF>
<CR><LF>
ERROR<CR><LF>
Got so far...
AT+CIPCLOSE=1<CR><CR><LF>
1,CLOSED<CR><LF>
<CR><LF>
OK<CR><LF>
0,CONNECT<CR><LF>
<CR><LF>
+IPD,0,368:GET /favicon.ico HTTP/1.1<CR><LF>
Host: 192.168.1.224<CR><LF>
Connection: keep-alive<CR><LF>
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Iridium/2018.11 Safari/537.36 Chrome/71.0.0.0<CR><LF>
DNT: 1<CR><LF>
Accept: image/webp,image/apng,image/*,*/*;q=0.8<CR><LF>
Referer: http://192.168.1.224/<CR><LF>
Accept-Encoding: gzip, deflate<CR><LF>
Accept-Language: en-US,en;q=0.9<CR><LF>
<CR><LF>
AT+CIPSEND=1,234<CR><CR><LF>
link is not valid<CR><LF>
<CR><LF>
ERROR<CR><LF>
; Handle incoming requests
SerTxd( CR, LF, "Waiting for requests...", CR, LF )
; Wait for a packet
Gosub ReceivePacket
Do
SerTxd("[5]")
If TimedOut Then
SerTxd("[6]")
; Wait for a packet
Gosub ReceivePacket
SerTxd("[7]")
Else
SerTxd("[8]")
; Handle a packet when we get it
If Found("\n+IPD,") Then
SerTxd( CR, LF, "Request has arrived", CR, LF )
Gosub ShowPacket
SerTxd("[9]")
Gosub ParseIpdPacket
SerTxd("[1]")
; There may be a request buried in the
; last response so we handle that as if
; a request or wait for another packet
If NotFound("\n+IPD,") Then
SerTxd("[2]")
; Wait for a packet
Gosub ReceivePacket
SerTxd("[3]")
End If
SerTxd("[4]")
Else
SerTxd( CR, LF, "Unknown request", CR, LF )
Gosub ShowPacket
; Wait for a packet
Gosub ReceivePacket
End If
End If
Loop
ParseIpdPacket:
I would expect so. I recall it's only used to parse through the packet and doesn't have any 'dual use' elsewhere. And, even if it does, I don't recall there's any particular reason w1 was chosen.Can I safely redefine "fromptr=w1" so that I can use bit16-bit31? I've tried it, and no apparent harm so far.
Yes, that's the 'no packet so idle for some time' / 'do nothing' part so that's the place for a call to any routine you want to run repeatedly. That's effectively -Another question, and maybe (near) the last one--where does the program idle most of the time? I'm thinking that it's at "Pause MS_10" in ReceivePacket_More--so that would be where I would want to put code which normally processes every 10ms or 100ms.
Do
something
timeOut = timeOut - Nms
Loop Until packetHasArrived Or timeOut = 0
Nothing ? It simply seems to be that you are sending AT commands your ESP-01 firmware does not recognise or support.So what's going wrong here ?.
Nothing ? It simply seems to be that you are sending AT commands your ESP-01 firmware does not recognise or support.
The problem is there is no definitive "ESP-01", no singular AT firmware version. All should implement the core AT commands
It's a whole mish-mash of randomness ...
... In theory one should be able to update any ESP-01 to the latest AT firmware but that can require configuring the programming IDE and even the source code definitions to match the hardware being used before programming, and that isn't necessarily easy. ...
You've already proved it's not that hard( I have managed to download ESP Basic to another 'identical' ESP-thing, and it looks very interesting. )
...
All I want to do is buy a module and use it as described in its manual, not jump through hoops in the dark.
In AT mode, do you get nothing from AT+CWLAP? That should list available APs. If it doesn't, I'd first suspect insufficient power.
(I have to use <Enter> and <Ctrl-j> after my AT commands--no doubt I could set something in puTTY to make it automatic.)
what I expected it to be doing 10 hours ago
The ESP is sold configured as an access point and will give an error if you ask it to scan for other access points in that mode. You have to be in station mode to see available networks.
The problem there is the author seems to have written their code for a specific version of a product and you are using a different version of that product.I wanted to run the 08M2 code that Charles Hampton wrote. A simple project to get me started
The big picture problem is it's often not understood that all products given the same name aren't the exact same product so we end up with authors writing code which won't work with other products and users trying to use products which won't work with that software.
What did you do to get it to work?
Were you able to flash the latest SDK? If so, can you link to the firmware and the instructions? Last time I tried the flasher reported success, but I couldn't communicate with the ESP-01.
Thanks--I did yesterday manage to upload the firmware using old ugly and unwieldy ...
WIFI CONNECTED
WIFI GOT IP
OK
AT+CIFSR
+CIFSR:STAIP,"192.168.2.211"
+CIFSR:STAMAC,"18:fe:34:f9:40:17"
OK
AT+CIUPDATE
+CIPUPDATE:1
+CIPUPDATE:2
+CIPUPDATE:3
+CIPUPDATE:3
+CIPUPDATE:4
ERROR
I again tried to flash the latest firmware, SDK v3.03. Success is reported, but when I close the flashing software, power cycle and connect with puTTY, I get gobbledegook when I power cycle, and no response to typing.
Does anyone see anything evidently wrong with this?
View attachment 23865
(By the way, I'm successfully doing TCP sends to my local TCP listener with the SDK v2 firmware with PICAXE 20M2 with ESP-01, and with ESP8285 and SKD 1.54, using a program based on the Charles Hampton Instructable.)
Why do you update your firmware with windaube and then again with the AT command? Why update at all? What do you think you get that's better than what you had? AT+GMR gives me the same reply as you without the AT update.