0

FONA FTP from SD card
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: FONA FTP from SD card

by adafruit_support_mike on Thu Jan 10, 2019 5:46 am

Error code 1,64 is a timeout, and error code 1,77 is an error with a specific operation.

Post the code you're using between CODE tags and we'll see what we can find.

adafruit_support_mike
 
Posts: 56474
Joined: Thu Feb 11, 2010 2:51 pm

Re: FONA FTP from SD card

by JerrySantaCruz on Thu Jan 10, 2019 9:33 pm

Hi Eric,

the problem is that after you send the FTPPUT=1 you get two replies. fona.sendCheckReply gets the first one, but then you have to use fona.getReply to get the second one.

fona.sendCheckReply("AT+FTPPUT=1","OK" , 10000); //this opens the FTP session
fona.getReply("+FTPPUT:1,1,1360",30000);

You'll find the meaning of your error codes (64 and 77) in the SIM800 command manual here: https://learn.adafruit.com/adafruit-fon ... /downloads

Good luck!

Jerry

JerrySantaCruz
 
Posts: 30
Joined: Tue Aug 16, 2016 4:46 pm

Re: FONA FTP from SD card

by blong99 on Sun Jan 13, 2019 11:35 pm

I have successully done FTP on a project using a SIM900 chip not SIM800.

Currently trying to use the same code in another Arduino project for the SIM800 now but need a new SIM as old SIM provider is unreliable
and that just adds to my development hassles.

The FTPPUT=1 command and its response is a pain . The SIM 900 works fine and responds quickly (a few seconds).

Bear with me a few days (waiting for SIM card to arrive from company for whom I am doing the development)
and then would be happy to share my completed code when it works.

Also I am uploading a file from the SD card and not using readLine.

The FTPPUT,1,1,1360 response is NOT always 1360 .... the 3rd argument "1360" is max bytes that can be taken by provider in
one chunk. My code on sim900 loops the file from SD card in chunks of "whatever" and then sends final leftover bytes as well.
i.e. chunk 1 at 1300, chunk 2 at 1300, etc etc, then final chuck at (e.g.) 754 bytes and gets confirmation of each chunk.

In my case my provider gives 1300 as 3rd argument. (I do not live in USA but am in Thailand).

blong99
 
Posts: 8
Joined: Thu Oct 18, 2018 9:02 pm

Re: FONA FTP from SD card

by blong99 on Thu Jan 17, 2019 12:41 am

Got the SIM card but having no joy ...

Sure the FTPPUT=1 responds with OK but no second reply. i.,e. the 1,1,1360 entry

Also the fona.getReply is protected ??? how to use this ??

blong99
 
Posts: 8
Joined: Thu Oct 18, 2018 9:02 pm

Re: FONA FTP from SD card

by blong99 on Wed Jan 23, 2019 6:39 pm

I have now come to the conclusion that the SIM800 will NOT do FTP.

I tested 2 boards and both hang on the FTPPUT=1 command. They never receive a 2nd reply with the maximum bytes that can be uploaded from the network. One can even test by making the FTP login incorrect and you should get back proper error codes. This does not happen either.

I also tried FTPGET=1 and same problem.

FTP is important as Arduino users measure sensors and make dataloggers and want to send data to Cloud so can download onto PC's etc.

The card is basically power and a serial port... nothing fancy in terms of hookup and in the past I had used a SIM900 shield and it worked well.

So I switched my project to SIM 900 and lo and behold my exact software worked fine. The FTPPUT=1 command has a 2nd response within a few seconds as it should ! This cost me days of development wasted and a fair bit of re-engineering to switch from SIM800 Adafruit breakout to a SIM900 shield.

I therefore challenge Adafruit to test FTP on the board and add FTP to the library for the SIM800. I am an experienced programmer (40+ years) and have been working on Arduino for about last 5 years.

The only small possibility is that some form of setup command is needed for SIM800 that is NOT needed on SIM900 but I feel this is small chance. I would say the firmware which does everything but make coffee (i.e. bluetooth, FM radio etc) is dodgy. Note that I am testing on GSM network in Thailand which is European standard and am not in USA.

I also found on the net other users of SIM800 chips that have experienced firmware problems. For instance the SIM800L chip was even stated by manufacturers (China) as a lemon and only meant for local use (China). Supposedly the SIM800H etc are OK .

blong99
 
Posts: 8
Joined: Thu Oct 18, 2018 9:02 pm

Re: FONA FTP from SD card

by blong99 on Mon Feb 11, 2019 4:42 am

I would appreciate some comment from TECH SUPPORT
on my queries/problems about FONA FTP.

blong99
 
Posts: 8
Joined: Thu Oct 18, 2018 9:02 pm

Re: FONA FTP from SD card

by adafruit_support_mike on Sat Feb 16, 2019 2:53 am

We haven't done any work with the SIM800's FTP commands.

Here in the US, FTP is generally regarded as a security hole. Most servers don't enable it, and many firewalls and ISPs block it by default. If your testing shows that the commands in the SIM800 reference don't work over a network that supports FTP from other cellular devices, you're probably correct that it doesn't work.

We've found the same thing is true for the SIM800's SSL features: the documentation says they should work, but we've never seen anyone post working code.

adafruit_support_mike
 
Posts: 56474
Joined: Thu Feb 11, 2010 2:51 pm

Re: FONA FTP from SD card

by blong99 on Wed Feb 27, 2019 10:18 pm

Mike

It seems to me that developers need a way of taking logged data from an SD card and getting it up on a server via a SIM card system.... i.e.. not use a WiFi connection.

Other that FTP how can one accomplish this ?? HTTP ??

blong99
 
Posts: 8
Joined: Thu Oct 18, 2018 9:02 pm

Re: FONA FTP from SD card

by adafruit_support_mike on Thu Feb 28, 2019 3:59 am

HTTP will work, yes. The SIM800 supports POST queries.

adafruit_support_mike
 
Posts: 56474
Joined: Thu Feb 11, 2010 2:51 pm

Re: FONA FTP from SD card

by blong99 on Thu Feb 28, 2019 11:06 pm

Has this been tested by Adafruit ?

Any examples of file upload ?

blong99
 
Posts: 8
Joined: Thu Oct 18, 2018 9:02 pm

Re: FONA FTP from SD card

by JerrySantaCruz on Fri Mar 01, 2019 2:58 pm

Hi all,

I successfully sent files from an SD card with FONA 800 using FTP put with AT+ commands. The setup is a Mega, an adafruit datalogging shield and a FONA 800.

The FONA sends data to an FTP server made with a Raspberry Pi and pureFTP.
This posts explains how to setup the Raspberry Pi as a "sacrificial FTP server": viewtopic.php?f=31&t=102463

I hope this helps,

Jerry

JerrySantaCruz
 
Posts: 30
Joined: Tue Aug 16, 2016 4:46 pm

Re: FONA FTP from SD card

by blong99 on Fri Mar 01, 2019 11:21 pm

Jerry

Thanks for post ...

My software works fine on SIM900 shield BUT on Fona 800 it stalls at the FTPPUT = 1 command ... browse back in my prev posts Wed Jan 23, 2019 11:39 pm

The program sequence requires getting an answer like FTTPUT=1,1300 after it sends back an OK. the 1300 is the max bytes that can be sent in a chunk from your file. This never comes back from FONA board but is back in a few seconds using SIM900 board.

the SIM800 has bad reputation among users especially SIM800L which was a lemon.

Do you have code snippet of your FTP program ?

blong99
 
Posts: 8
Joined: Thu Oct 18, 2018 9:02 pm

Re: FONA FTP from SD card

by adafruit_support_mike on Sat Mar 02, 2019 2:18 am

blong99 wrote:Has this been tested by Adafruit ?

Yes.

blong99 wrote:Any examples of file upload ?

In the 'fonatest' sketch that comes with the FONA library.

adafruit_support_mike
 
Posts: 56474
Joined: Thu Feb 11, 2010 2:51 pm

Re: FONA FTP from SD card

by JerrySantaCruz on Mon Mar 04, 2019 1:16 pm

Hi Blong,

It's been a while, but I think that I had to tweak the Adafruit library and move a function to public so I could use it in my code. The function is fona.getReply and I use it to get the second response from FTPPUT=1. I remember it was a pain to make it work. Below and example of my last working code.

fona.sendCheckReply("AT+FTPPUT=1","OK" , 10000); //this opens the FTP session
fona.getReply("+FTPPUT:1,1,1360",30000);

I hope this helps!

Jerry

JerrySantaCruz
 
Posts: 30
Joined: Tue Aug 16, 2016 4:46 pm

Please be positive and constructive with your questions and comments.