BGS2-E, download file from FTP (to Flash File System) | Thales IoT Developer Community
June 15, 2015 - 3:19pm, 5330 views
Hello,
I have some questions about FTP client in BGS2.
Is there a way to configure BGS2-E to download file from FTP server to FFS? I mean start the download 'in background' and when it finishes just get the file from FFS.
If it is not possible can anyone describe how the FTP client works?
I assume, from the AT datasheet, that I have to set the FTP client and then get file chunks with AT^SISR command.
Does the BGS2 buffer the file in background (if so, how big is the buffer) or does it just download 1500B chunks of data after each AT^SISR command?
Can anyone provide any example of how to download large files (about 400kB) from FTP?
Marcin
HI,
BGS2 does not allow to download the file directly to the FFS
Any posible exampleto download large file with BGS2 can be:
^SYSSTART
+CREG: 2
+CREG: 1
at+ipr?
+IPR: 9600
OK
at+cmee=2
OK
at^sics=0,conType,GPRS0
OK
at^sics=0,apn,your_APN
OK
at^sics=0,user,your_user
OK
at^sics=0,passwd,your_password
OK
at^siss=1,srvType,FTP
OK
at^siss=1,alphabet,1
OK
at^siss=1,tcpOT,6000
OK
at^siss=1,conId,0
OK
AT^SISS=1,ADDRESS,"ftp://your_server/your_file;type=a"
OK
Define aklso here is your FTP server ***** user and pasword at^siss=1,xxxxxxxxx
at^siso=1 -- open connection
OK
^SISR: 1,1 --connection openend with success
at^sisr=1,800 --800 bytes of buffer. set up as you need, limit is 1500 bytes
^SISR: 1,800 -- read 800 bytes of your file
0000000e000104a46494600010201004800480000ffe1184d45786966000049492a00080000000e000e01020036000000b60000000f0102000f000000ec000000100102000b000000fb0000001201030001000000010000001a01050001000000060100001b010500010000000e010000280103000100000002000000310102001c000000160100003201020014000000320100003b0102001700000046010000130203000100000002000000988202008a0000005d010000a5c4070028000000e7010000698704000100000010020000d4040000566965772066726f6d205261766e65666a656c6465742c206e65787420746f204e616e6f7274616c696b2c20477265656e6c616e64004b4f4e494341204d494e4f4c54410044694d414745205a32300080fc0a001027000080fc0a001027000041646f62652050686f746f73686f70204353322057696e646f777300323030363a30373a32332031303a32313a3436004a656e7320427575726761617264204e69656c73656e00436f70796c6566742c20437265617469766520436f
OK
at^sisr=1,800
^SISR: 1,800
0000000e000104a46494600010201004800480000ffe1184d45786966000049492a00080000000e000e01020036000000b60000000f0102000f000000ec000000100102000b000000fb0000001201030001000000010000001a01050001000000060100001b010500010000000e010000280103000100000002000000310102001c000000160100003201020014000000320100003b0102001700000046010000130203000100000002000000988202008a0000005d010000a5c4070028000000e7010000698704000100000010020000d4040000566965772066726f6d205261766e65666a656c6465742c206e65787420746f204e616e6f7274616c696b2c20477265656e6c616e64004b4f4e494341204d494e4f4c54410044694d414745205a32300080fc0a001027000080fc0a001027000041646f62652050686f746f73686f70204353322057696e646f777300323030363a30373a32332031303a32313a3436004a656e7320427575726761617264204e69656c73656e00436f70796c6566742c20437265617469766520436f
OK
now repeat the las step until you receive a minus (-2 in this case)
at^sisr=1,800
^SISR: 1,-2
OK
^SISR: 1,2 No more data available, data tranfers finished. FTP is closed
at^sisc=1 close your connection
Regards
Alopez
Somewhere over the rainbow!!! Looking for the Oz Land!!!
Hello,
Thanks for reply. I tried similar method to yours but later I discovered the information below.
I have to disagree, BGS2 allows you to download files from FTP directly to internal flash (if the flash is available for use, the BGS2 revision has to be 02.00 as I read on this forum).
It has "Download Client", configured by command AT^SDLC. It can download files using FTP, HTTP or HTTPS protocol.
Download example:
AT^SDLC="cfg","url","ftp://server.addr/file.bin;type=i"
OK
note: ";type=i" is binary download, ";type=a" is ascii download, (see "address" section in AT^SISS description), if you omit the 'type' parameter default **** is ascii which, for example, changes every 0x0A byte to 0x0D 0x0A (adds 1 byte)
AT^SDLC="cfg","user","username"
OK
AT^SDLC="cfg","passwd","user_password"
OK
AT^SDLC="cfg","urc",0
OK
note: "urc" sets debug level, for more debugging change setting to 2 (or 1)
AT^SDLC="cfg","dir","download"
OK
note: directory to store file, VERY IMPORTANT! it has to be set, if you set "" which is default value then starting download gives "+CME ERROR: invalid input value"
AT^SDLC="exec","start"
OK
note: downloading large files will take a while, so setting"urc" to 1 or 2 gives you more info while the download is in progress, you can also check actual download status by AT^SDLC="exec","status"
^SDLC: finished,12348,ftp://********:********@server.addr/file.bin;type=i
note: the file in this example is stored at A:/download/
AT^SFSA="ls","a:/download/"
^SFSA: file.bin
^SFSA: 0
OK
-------
note: setting AT^SDLC="cfg","urc",2 gives you more information about the download process:
AT^SDLC="exec","start"
OK
^SDLC: trace,2,Starting internet connection
^SDLC: trace,1,Internet connection started
^SDLC: trace,2,Start of data transmission
^SDLC: trace,2,Opening file: [A:\download\file.bin]
^SDLC: trace,2,File opened
^SDLC: trace,2,File closed.
^SDLC: trace,1,Stopping internet connection
^SDLC: trace,1,DOWNLOAD FINISHED for URL:ftp://server.addr/file.bin;type=i stored at:download
Regards
Marcin
HI,
Agree, BGS2 Rel 2 allows this procdure
Regards
ALopez
Somewhere over the rainbow!!! Looking for the Oz Land!!!
Does this work with Rel 2 only, or should it work with later releases too? I have trouble setting this up with
Cinterion
BGS2-W
REVISION 03.001
Hello,
This should be working in release 3. Please write more details about the problem.
Best regards,
Bartłomiej