[HL8548] +KFTPSND - check when tx buffer is empty

Hi,

Indeed, I forgot 1 empty parameter in my first message. The kftpsnd command is at+kftpsnd=1,"",“filename”,0,0, to write a file on root directory.

Here’s the command I send after HL reset.

at&k3 //Activate RTS/CTS
at&r1 //CTS drop as required by flow control
at&c1 //DCD is high when HL is in data mode, low otherwise
at+ksync=3,2 //GPIO2=1 when network is available

ate1
atq0
ats0=0
atv1
at&d0

Then, when I need to connect to FTP (with reply from HL8548) :

at+kcnxcfg=1,"GPRS","apn","login","password"
OK
at+kpattern=_EOF_
OK
at+kftpcfg=1,"address","login","password",21,0,0
+KFTPCFG: 1
OK
at+kcnx=1
OK
+KCNX_IND: 1,4,1
+KCNX_IND: 1,1,0
+KFTP_IND: 1,1

Once it’s connected, I write a small file :

at+kftpsnd=1,,"","small_file.txt",0,0
//wait for DCD high
CONNECT //Sometimes, it is received while the datas are being transmitted, it seems there is a small delay between entering data mode and this message.
//Send data (46 bytes)
_EOF_
OK
//Closing file
+KFTP_IND: 1,2,46

However, if I try to send a longer file (2048 bytes, in my case), it doesn’t work unless I add a delay :

at+kftpsnd=1,,"","2048B_file.txt",0,0
//wait for DCD high
CONNECT //Same as above
//Send data (2048 bytes)
_EOF_
OK
//Closing file
//No KFTP_IND is received, when I check the file on the FTP server, just the first n bytes are written. (n is different each times)

//Trying to open a new file
at+kftpsnd=1,,"","2048B_file_part2.txt",0,0
//wait for DCD high
CONNECT //Same as above
//Do not send new datas, but wait for a few seconds
_EOF_
OK
//Closing file 
+KFTP_IND: 1,2,0
//remaining datas (2048-n) are in 2048B_file_part2.txt. The size of this file is 2048-n, instead of the size reported by +KFTP_IND: 1,2,0

I’m using the last firmware rev available on the website (RHL85xx.5.5.23.0.201610311418.x6250_7).