I have very similar issue but just at the beginning of downloading a file. Also, I have a workaround for it but no idea why it works!. Here is what I do:
- Connecting to AP
- Opening SSL socket
- Sending GET request
- Receiving data (using ATPR)
The problem is that only FIRST attempt of ATPR returns some data. Every next ATPR command returns 0 length. The file is large enough so it should return more data.
The workaround is weird. Just adding zero (\0) at the end of GET request string fixes the problem with receiving data. But why?
Below 2 examples with my logs.
1st - the NOT working version:
rtl_uart: >>> INIT
rtl_uart: Baud rate: 38400
rtl_uart: <<< AT COMMAND READY
rtl_uart: >>> ATPN=“SSID”,“PASS”
rtl_uart: <<< [ATPN] OK
at_cmd: [ATPN] SUCCESS
rtl_uart: >>> ATPC=2,dweuiotsa1.blob.core.windows.net,443
rtl_uart: <<< [ATPC] OK
[ATPC] con_id=1
at_cmd: [ATPC] SUCCESS Socket ID: 1
rtl_uart: >>> ATPT=141,1 [47,45,54,20,2F,77,69,66,69,2D,66,69,72,6D,77,61,72,65,2D,74,65,73,74,2F,74,65,73,74,70,6F,62,69,65,72,61,6E,69,61,2E,74,78,74,20,48,54,54,50,2F,31,2E,31,0D,0A,48,6F,73,74,3A,20,64,77,65,75,69,6F,74,73,61,31,2E,62,6C,6F,62,2E,63,6F,72,65,2E,77,69,6E,64,6F,77,73,2E,6E,65,74,0D,0A,41,63,63,65,70,74,3A,20,74,65,78,74,2F,78,6D,6C,2C,20,61,70,70,6C,69,63,61,74,69,6F,6E,2F,78,68,74,6D,6C,2B,78,6D,6C,2C,20,2A,2F,2A,0D,0A,0D,0A]=141
rtl_uart: <<< [ATPT] OK,1
at_cmd: [ATPT] SUCCESS
rtl_uart: >>> ATPR=1,64
rtl_uart: <<< [ATPR] OK,64,1 [48,54,54,50,2F,31,2E,31,20,32,30,30,20,4F,4B,0D,0A,43,6F,6E,74,65,6E,74,2D,4C,65,6E,67,74,68,3A,20,36,36,35,38,0D,0A,43,6F,6E,74,65,6E,74,2D,54,79,70,65,3A,20,61,70,70,6C,69,63,61,74,69,6F,6E]=64
at_cmd: [ATPR] SUCCESS Socket ID: 1, Data: HTTP/1.1 200 OK
Content-Length: 6658
Content-Type: application
rtl_uart: >>> ATPR=1,64
rtl_uart: <<< [ATPR] OK,0,1 =0
at_cmd: [ATPR] SUCCESS Socket ID: 1, No data
rtl_uart: >>> ATPR=1,64
rtl_uart: <<< [ATPR] OK,0,1 =0
at_cmd: [ATPR] SUCCESS Socket ID: 1, No data
rtl_uart: >>> ATPR=1,64
rtl_uart: <<< [ATPR] OK,0,1 =0
at_cmd: [ATPR] SUCCESS Socket ID: 1, No data
…
rtl_uart: >>> ATPD=1
rtl_uart: <<< [ATPD] OK
at_cmd: [ATPD] SUCCESS
2nd - the Working version (with \0 at the end of GET request):
rtl_uart: >>> INIT
rtl_uart: Baud rate: 38400
rtl_uart: <<< AT COMMAND READY
rtl_uart: >>> ATPN=“SSID”,“PASS”
rtl_uart: <<< [ATPN] OK
at_cmd: [ATPN] SUCCESS
rtl_uart: >>> ATPC=2,dweuiotsa1.blob.core.windows.net,443
rtl_uart: <<< [ATPC] OK
[ATPC] con_id=1
at_cmd: [ATPC] SUCCESS Socket ID: 1
rtl_uart: >>> ATPT=142,1 [47,45,54,20,2F,77,69,66,69,2D,66,69,72,6D,77,61,72,65,2D,74,65,73,74,2F,74,65,73,74,70,6F,62,69,65,72,61,6E,69,61,2E,74,78,74,20,48,54,54,50,2F,31,2E,31,0D,0A,48,6F,73,74,3A,20,64,77,65,75,69,6F,74,73,61,31,2E,62,6C,6F,62,2E,63,6F,72,65,2E,77,69,6E,64,6F,77,73,2E,6E,65,74,0D,0A,41,63,63,65,70,74,3A,20,74,65,78,74,2F,78,6D,6C,2C,20,61,70,70,6C,69,63,61,74,69,6F,6E,2F,78,68,74,6D,6C,2B,78,6D,6C,2C,20,2A,2F,2A,0D,0A,0D,0A,00]=142
rtl_uart: <<< [ATPT] OK,1
at_cmd: [ATPT] SUCCESS
rtl_uart: >>> ATPR=1,64
rtl_uart: <<< [ATPR] OK,64,1 [48,54,54,50,2F,31,2E,31,20,32,30,30,20,4F,4B,0D,0A,43,6F,6E,74,65,6E,74,2D,4C,65,6E,67,74,68,3A,20,36,36,35,38,0D,0A,43,6F,6E,74,65,6E,74,2D,54,79,70,65,3A,20,61,70,70,6C,69,63,61,74,69,6F,6E]=64
at_cmd: [ATPR] SUCCESS Socket ID: 1, Data: HTTP/1.1 200 OK
Content-Length: 6658
Content-Type: application
rtl_uart: >>> ATPR=1,64
rtl_uart: <<< [ATPR] OK,64,1 [2F,6F,63,74,65,74,2D,73,74,72,65,61,6D,0D,0A,43,6F,6E,74,65,6E,74,2D,4D,44,35,3A,20,75,30,45,4E,32,71,51,74,61,6D,31,41,62,76,44,47,55,47,58,78,71,41,3D,3D,0D,0A,4C,61,73,74,2D,4D,6F,64,69,66]=64
at_cmd: [ATPR] SUCCESS Socket ID: 1, Data: /octet-stream
Content-MD5: u0EN2qQtam1AbvDGUGXxqA==
Last-Modif
rtl_uart: >>> ATPR=1,64
rtl_uart: <<< [ATPR] OK,64,1 [69,65,64,3A,20,54,75,65,2C,20,32,34,20,4D,61,79,20,32,30,32,32,20,31,37,3A,31,39,3A,35,39,20,47,4D,54,0D,0A,45,54,61,67,3A,20,30,78,38,44,41,33,44,41,39,41,31,33,45,38,39,31,43,0D,0A,53,65,72]=64
at_cmd: [ATPR] SUCCESS Socket ID: 1, Data: ied: Tue, 24 May 2022 17:19:59 GMT
ETag: 0x8DA3DA9A13E891C
Ser
rtl_uart: >>> ATPR=1,64
rtl_uart: <<< [ATPR] OK,64,1 [76,65,72,3A,20,57,69,6E,64,6F,77,73,2D,41,7A,75,72,65,2D,42,6C,6F,62,2F,31,2E,30,20,4D,69,63,72,6F,73,6F,66,74,2D,48,54,54,50,41,50,49,2F,32,2E,30,0D,0A,78,2D,6D,73,2D,72,65,71,75,65,73,74,2D]=64
at_cmd: [ATPR] SUCCESS Socket ID: 1, Data: ver: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-
rtl_uart: >>> ATPR=1,64
rtl_uart: <<< [ATPR] OK,64,1 [69,64,3A,20,66,64,64,66,31,63,39,32,2D,64,30,31,65,2D,30,30,34,34,2D,36,35,64,65,2D,39,35,62,63,66,30,30,30,30,30,30,30,0D,0A,78,2D,6D,73,2D,76,65,72,73,69,6F,6E,3A,20,32,30,30,39,2D,30,39,2D]=64
at_cmd: [ATPR] SUCCESS Socket ID: 1, Data: id: fddf1c92-d01e-0044-65de-95bcf0000000
x-ms-version: 2009-09-
rtl_uart: >>> ATPR=1,64
rtl_uart: <<< [ATPR] OK,64,1 [31,39,0D,0A,78,2D,6D,73,2D,6C,65,61,73,65,2D,73,74,61,74,75,73,3A,20,75,6E,6C,6F,63,6B,65,64,0D,0A,78,2D,6D,73,2D,62,6C,6F,62,2D,74,79,70,65,3A,20,42,6C,6F,63,6B,42,6C,6F,62,0D,0A,44,61,74,65]=64
at_cmd: [ATPR] SUCCESS Socket ID: 1, Data: 19
x-ms-lease-status: unlocked
x-ms-blob-type: BlockBlob
Date
rtl_uart: >>> ATPR=1,64
rtl_uart: <<< [ATPR] OK,64,1 [3A,20,54,75,65,2C,20,31,32,20,4A,75,6C,20,32,30,32,32,20,31,30,3A,35,39,3A,33,34,20,47,4D,54,0D,0A,0D,0A,54,65,73,74,50,6F,62,69,65,72,61,6E,69,61,31,32,33,34,0D,0A,54,65,73,74,50,6F,62,69,65]=64
at_cmd: [ATPR] SUCCESS Socket ID: 1, Data: : Tue, 12 Jul 2022 10:59:34 GMT
TestPobierania1234
TestPobie
rtl_uart: >>> ATPR=1,64
rtl_uart: <<< [ATPR] OK,64,1 [72,61,6E,69,61,31,32,33,34,0D,0A,54,65,73,74,50,6F,62,69,65,72,61,6E,69,61,31,32,33,34,0D,0A,54,65,73,74,50,6F,62,69,65,72,61,6E,69,61,31,32,33,34,0D,0A,54,65,73,74,50,6F,62,69,65,72,61,6E,69]=64
at_cmd: [ATPR] SUCCESS Socket ID: 1, Data: rania1234
TestPobierania1234
TestPobierania1234
TestPobierani
…
rtl_uart: >>> ATPD=1
rtl_uart: <<< [ATPD] OK
at_cmd: [ATPD] SUCCESS
Few more hints:
- No matter what is the requested length in the ATPR command - only the first attempt work
- I did custom change in the Ameba SDK file atcmd_lwip.c. Instead ETH_MAX_MTU I use 'packet_size".
I changet this:
error_no = atcmd_lwip_receive_data(curnode, rx_buffer, ETH_MAX_MTU, &recv_size, udp_clientaddr, &udp_clientport);
Into this:
error_no = atcmd_lwip_receive_data(curnode, rx_buffer, packet_size, &recv_size, udp_clientaddr, &udp_clientport);
- I use SSL socket
Any ideas?