0

Fona 3G large FTP file transfer
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Fona 3G large FTP file transfer

by rozzie on Tue Dec 13, 2016 12:30 am

This is more a question for someone with SIMCOM 5320 knowledge than Fona, but I don't know where to post it. If you can provide me a reference as to where to post (or an answer!) it would be greatly appreciated.

One of the most fundamental reasons I've incorporated the Fona 3G into my design is because of the high level capabilities of the SIMCOM 5320, including HTTP and large file transfer via FTP.

I just incorporated an FTP server into my service so that it can deliver OTA software updates to my client via the SIMCOM.

I am now trying to figure out how to get the file into my MCU's memory.

From what I can see and have tried, there seem to be two methods:

1) Directly transfer the file and get a flood of data as it is being downloaded via FTP
2) Transfer it to the SIMCOM's local file system (which is incredibly convenient btw), and then just transfer it from there to the host.

For both, I begin with:
AT+CGSOCKCONT=1,"IP","m2m.com.attz"
AT+CSOCKSETPN=1
AT+CIPMODE=0
AT+NETOPEN
at+cftpserv="my-ftp-server"
at+cftpport=8083
at+cftpun="username"
at+cftppw="password"

Then, for the (1) streaming test, the command I'm using is:
at+cftpget="myfile.hex"

For the (2) test, I use this first command to download, and the second command to extract into host memory:
at+cftpgetfile="myfile.hex",0
at+cftrantx="c:/myfile.hex"

My problem is this: While I am teased by both of the commands, I can't seem to get either of them to transfer an entire file.

The file is close to 700kb in length.

The first test transfers about 4kb and then stops without error.

The second does an amazing job at doing the entire transfer. I have even done an at+fsls to see the file, and at+fsattri="myfile.hex" to see that the entire file was successfully downloaded into the local file system! However, again, when I do the at+ftrantx command to extract the contents of that file, it transfers a few KB and then just stops.

I am hoping I am missing something obvious in terms of a parameter perhaps that says "start" and "length", or somesuch. I can't fathom that SIMCOM would have gone through all the work to allow me to do large transfers into the local chip's file system without me actually being able to touch it.

I feel as though I'm so close to getting this working, but missing something obvious.

Help, or a pointer, would be greatly appreciated.

Thank you!

rozzie
 
Posts: 31
Joined: Wed Apr 27, 2016 4:13 pm

Re: Fona 3G large FTP file transfer

by rozzie on Tue Dec 13, 2016 12:18 pm

A kind soul brought the following to my attention, even though I would still love to know the answers to those questions - particularly pulling data incrementally out of EFS.

Apparently, the "standard practice" now is to use FTPS with TLS auth. I enabled TLS on my ftp server, and tried these commands.

They work quite well, so I'm back in business.

at+cftpsstart
at+cftpslogin="my.ftp.server",portno,"username","password",2
(I'm using 2 because my server does TLS auth)
at+cftpsget="myfile.hex",0,1
at+cftpscacherd
(repeat this cache read for all data)

rozzie
 
Posts: 31
Joined: Wed Apr 27, 2016 4:13 pm

Re: Fona 3G large FTP file transfer

by rozzie on Sun Dec 18, 2016 4:27 pm

I also found the answer to my original question, and it was right there in the SIMCOM doc.

It IS possible to get at+cftrantx to transfer a file out of the EFS in a completely reliable manner.

All I needed to do was to issue this command before the at+cftrantx, which ensured that the 5320 was sending the file properly to UART.
at+catr=1

rozzie
 
Posts: 31
Joined: Wed Apr 27, 2016 4:13 pm

Re: Fona 3G large FTP file transfer

by franklin97355 on Sun Dec 18, 2016 6:40 pm

Thanks for posting your findings. I'll pass this on.

franklin97355
 
Posts: 21423
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: Fona 3G large FTP file transfer

by adafruit2 on Mon Dec 19, 2016 6:25 pm


adafruit2
Site Admin
 
Posts: 18898
Joined: Fri Mar 11, 2005 7:36 pm

Re: Fona 3G large FTP file transfer

by karltsai on Mon Apr 17, 2017 11:09 pm

Hi,
I've found the AT+CFTPSSTART unreliable and doesn't work most of the time:
< AT+CFTPSSTOP
> ERROR
< AT+CFTPSSTART
> ERROR

But occasionally I get it working
< AT+CFTPSSTART
> +CFTPSSTART: 0
> OK
< AT+CFTPSLOGIN="www.xxxyyy.org",21,"test","pass",0
> OK

I can't see any difference of the commands generated before either. Has anyone seen this before?

karltsai
 
Posts: 4
Joined: Mon Oct 24, 2016 7:31 am

Please be positive and constructive with your questions and comments.