FTP Upload sim7600

Hello,

I want to upload an image via the FTP protocol using an ESP32 microcontroller, the sim7600 modem and an SD card.

The only alternative I know of is to use the command "AT+CFTPPUT" or "AT+CFTPSPUT" and transmit the file through the serial port (serial2).

sim7600

The "AT+CFTPPUT" and "AT+CFTPSPUT" commands have the condition to modify the file if it contains the <ETX.> and <Ctrl+Z> bytes. Particularly the byte <Ctrl+Z> ("0x1A") the modem interprets it as a end of the FTP data

The problem I have is that the image file has many <ETX.> and <Ctrl+Z> bytes and the FTP communication is end to the first <Ctrl+Z> byte that it finds.

Currently I have fixed the problem by changing the <ETX.> and <Ctrl+Z> bytes to another set of characters, but it is an informal solution and requires extra processing on the server.

I would be grateful if you could help me and find a better solution. Thanks.

Hello again,

Currently I solved the problem of uploading image files via FTP protocol with an ESP32 MCU and an SD card.

The trick is to use the File System (EFS) built into the sim7600 module. Analyzing the EFS I discovered the following structure:

image

In the table above it can be seen that the usable spaces are the directories E: and F: with their corresponding directory ID 3 and 0

The steps to follow to upload a file from an SD card to an FTP server, using the E: directory, is as follows:

// Transfer the image from SD card to EFS
AT+CFTRANRX="e:/image.jpg",200000 // Transfer a image  file to EFS, where 200000 are the bytes to be transmitted
AT+CFTPSSTART // Acquire FTPS protocol stack
AT+CFTPSLOGIN="ftp.myftpserver.com",21,"myaccount@myftpserver.com","password",0 //Login the FTPS server
AT+CFTPSLIST // List the items in the directory on FTPS server
AT+CFTPSPUTFILE="image.jpg",3 // Upload a file in module EFS to FTPS server
// 

Note that in the "AT+CFTRANRX" function the directory E: is used and then in "AT+CFTPSPUTFILE" the directory ID 3 is used. See table above.

The same logic applies to download a file via the FTP protocol using the "AT+CFTPSGETFILE" and "AT+CFTRANTX" functions.

It is recommended to use 115200 baud to transfer information between the SD card and the sim7600 module as fast as possible.

I hope this information is useful for others.

Bye.