FTP

Proprietary u-blox AT commands. FTP AT commands set can be used for sending and receiving files over the available bearer, transparently retrieving and storing them in the file system. Standard file and directory management operations on the remote FTP server are as well possible. The FTP client requires an active connection to work. Some products require additional commands to provide connectivity to the application.

If not specified, the default CID (<cid>=1) is used. If not specified and the protocol type is IPv4v6, then the preferred protocol type is IPv4.

See +CGACT AT command for activating a PDP context.

Basically, two AT commands are necessary for an FTP client service: one AT command (+UFTP) to configure the FTP profile, a second AT command to execute a specific FTP command (+UFTPC). The final result of an FTP command will be notified through the +UUFTPCR URC whereas data will be provided through +UUFTPCD URC.

When these commands report an error which is not a +CME ERROR, the error code can be queried using the +UFTPER AT command.

The UFTP configuration resources are allocated when for the first time an UFTP command is entered, use the +UFTP=30,0 command to release these resources when no more needed.

FTP service configuration +UFTP

+UFTP

Modules

LEXI-R10401D-01B LEXI-R10801D-01B LEXI-R10801D-51B LEXI-R10001D LEXI-R10011D SARA-R10

Attributes

Syntax

PIN required

Settings saved

Can be aborted

Response time

Error reference

partial

No

No

No

-

+CME Error

Description

Sets up a parameter for FTP service, or resets a parameter to its factory-programmed value. The set/reset command needs to be executed for each single <op_code>. The read command returns the current setting of all the FTP parameters, one per line (i.e. the FTP profile). The FTP parameter values set with this command are all volatile (not stored in non-volatile memory).

If the set command is issued without <param1> parameter, the corresponding <op_code> parameter is reset to the default value.

When the FTP client is using secure connection, only explicit mode is supported (ftpes://). In the explicit mode the secure connection will be established after the FTP connection (before login) on the same port of the control channel.

When the FTP client is using secure connection, the FTPS server may request that the session data of the control channel connection should be reused to establish secure connection on the data channel. In this case the session resumption feature for the FTPS client should be configured via +USECPRF AT command.

Syntax

TypeSyntaxResponseExample

Generic syntax

Set

AT+UFTP=<op_code>[,<param1>[,<param2>]]

OK

AT+UFTP=7,21

OK

FTP server IP address

Set

AT+UFTP=0[,<IP_address>]

OK

AT+UFTP=0,"192.168.1.0"

OK

FTP server name

Set

AT+UFTP=1[,<server_name>]

OK

AT+UFTP=1,"ftp.server.com"

OK

Username

Set

AT+UFTP=2[,<username>]

OK

AT+UFTP=2,"user_test"

OK

Password

Set

AT+UFTP=3[,<password>]

OK

AT+UFTP=3,"PWD"

OK

Account

Set

AT+UFTP=4[,<account>]

OK

AT+UFTP=4,"test"

OK

Inactivity timeout

Set

AT+UFTP=5,<timeout>[,[<linger_cmd>],[<linger_data>]]

OK

AT+UFTP=5,0,0,0

OK

FTP mode

Set

AT+UFTP=6[,<FTP_mode>]

OK

AT+UFTP=6,1

OK

FTP server port

Set

AT+UFTP=7[,<FTP_server_port>]

OK

AT+UFTP=7,30

OK

FTP control connection security

Set

AT+UFTP=8[,<FTP_secure>[,<usecprf_profile_id>]]

OK

AT+UFTP=8,1,2

OK

Timer trigger configuration for Direct Link

Set

AT+UFTP=9,<timer_trigger>

OK

AT+UFTP=9,500

OK

Data length trigger configuration for Direct Link

Set

AT+UFTP=10,<data_length_trigger>

OK

AT+UFTP=10,1024

OK

Character trigger configuration for Direct Link

Set

AT+UFTP=11,<character_trigger>

OK

AT+UFTP=11,13

OK

FTP data connection security

Set

AT+UFTP=12[,<FTP_secure>[,<usecprf_profile_id>]]

OK

AT+UFTP=12,1,2

OK

FTP context id

Set

AT+UFTP=20,<cid>[,<preferred_protocol_type>]

OK

AT+UFTP=20,2

OK

Manage the UFTP configuration resources

Set

AT+UFTP=30,<ope_type>

OK

AT+UFTP=30,0

OK

Read

AT+UFTP?

+UFTP: 0,<IP_address>

+UFTP: 1,<server_name>

+UFTP: 2,<username>

+UFTP: 4,<account>

+UFTP: 5,<timeout>,<linger_cmd>,<linger_data>

+UFTP: 6,<FTP_mode>

+UFTP: 7,<FTP_server_port>

+UFTP: 8,<FTP_secure>[,<usecprf_profile_id>]

+UFTP: 9,<timer_trigger>

+UFTP: 10,<data_length_trigger>

+UFTP: 11,<character_trigger>

+UFTP: 12,<FTP_secure>[,<usecprf_profile_id>]

+UFTP: 20,<cid>[,<preferred_protocol_type>]

OK

+UFTP: 0,"216.239.59.147"

+UFTP: 1,""

+UFTP: 2,"username"

+UFTP: 4,"account"

+UFTP: 5,0,0,0

+UFTP: 6,0

+UFTP: 7,21

+UFTP: 8,0

+UFTP: 9,500

+UFTP: 10,1024

+UFTP: 11,13

+UFTP: 12,0

+UFTP: 20,2

OK

Test

AT+UFTP=?

+UFTP: (list of supported <param_tag>s)

OK

+UFTP: (0-12,20)

OK

Defined values

ParameterTypeDescription

<op_code>

Number

FTP parameter:

  • 0: FTP server IP address

  • 1: FTP server name

  • 2: FTP username

  • 3: FTP password

  • 4: FTP additional user account

  • 5: FTP inactivity timeout period and linger time

  • 6: FTP mode

  • 7: remote FTP server listening port

  • 8: control connection security

  • 9: timer trigger

  • 10: data length trigger

  • 11: character trigger

  • 12: data connection security

  • 20: PDP context id

  • 30: Manage the UFTP configuration resources

Allowed values:

  • LEXI-R10401D-01B / LEXI-R10801D-01B / LEXI-R10801D-51B / LEXI-R10001D / LEXI-R10011D / SARA-R10 - 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 20, 30

<IP_address>

String

FTP server IP address. The default value is an empty string. For IP address format reference see the IP addressing.

<server_name>

String

FTP server name (e.g. "ftp.server.com"). The maximum length is 128 characters. The default value is an empty string.

<username>

String

User name (the maximum length is 30 characters) for the FTP login procedure. The default value is an empty string.

<password>

String

Password (the maximum length is 30 characters) for the FTP login procedure. The default value is an empty string.

<account>

String

Additional user account (if required) for the FTP login procedure. The maximum length is 30 characters. The default value is an empty string.

<timeout>

Number

Inactivity timeout period in seconds. The range goes from 0 to 86400 s; 0 means no timeout (the FTP session will not be terminated in the absence of incoming traffic). The default value is 30 s.

<linger_cmd>

Number

Linger time for command socket in seconds. The range goes from 0 to 120 s; 0 means linger time is not set. The default value is 60 s.

<linger_data>

Number

Linger time for data socket in seconds. The range goes from 0 to 120 s; 0 means linger time is not set. The default value is 60 s.

<FTP_mode>

Number

FTP mode:

  • 0 (default value): active

  • 1: passive

<FTP_server_port>

Number

Remote FTP server listening port; it must be a valid TCP port value. The range goes from 1 to 65535; the default value is 21.

<FTP_secure>

Number

Enables / disables the secure option of FTP client service:

  • 0 (default value): no SSL/TLS encryption

  • 1: enable SSL/TLS encryption of FTP (control channel or data channel).

<usecprf_profile_id>

Number

USECMNG profile (number). Defines the USECMNG profile which specifies the SSL/TLS properties to be used for the SSL/TLS connection. The range goes from 0 to 4. If no profile is set a default USECMNG profile is used (see USECMNG section).

<timer_trigger>

Number

Enhanced direct link sending timer trigger (in milliseconds); valid range is 0 (factory-programmed value), 100-120000; 0 means trigger disabled.

<data_length_trigger>

Number

Enhanced direct link data length trigger in bytes, valid range is 0 (factory-programmed value), 3-2048; 0 means trigger disabled.

<character_trigger>

Number

Enhanced direct link character trigger, the value represents the ASCII code (in base 10) of the character to be used as character trigger. The allowed range is -1, 0-255, the factory-programmed value is -1; -1 means trigger disabled.

<cid>

Number

Specifies the PDP context that will be used for the FTP data. For the parameter range see product <cid> number. For more details on the default value of the parameter (where supported), see FTP.

<preferred_protocol_type>

Number

In the case of a context id with IPv4v6 PDP type, this value specifies which IP protocol type will be used:

  • 0: IPv4

  • 1: IPv6

For more details on the default value of the parameter (where supported), see FTP.

<ope_type>

Number

Operation type:

  • 0: Release all UFTP configuration resources

<param1>

Number / String

Type and supported content depend on related <op_code> (details are given above). If <param1> is not specified the value of the corresponding parameter <op_code> is reset to default value.

<param2>

Number / String

Type and supported content depend on related <op_code> (details are given above). If <param2> is not specified the value of the corresponding parameter <op_code> is reset to default value.

Notes

  • The information text response to the read command does not display the password.

  • The FTP server IP address and the FTP server name are mutually exclusive. If value for <op_code>=0 is specified by user, then value for <op_code>=1 is reset or vice versa.

  • Some network operators do not allow incoming connections. Due to these limitations introduced by network operators it is possible to encounter problems using FTP active mode. If the FTP active mode fails to exchange files, try the passive mode to solve the problem.

  • Some network operators do not allow FTPS. In this case the AT+UFTPC=1 command (FTP login) will return a failure response via +UUFTPCR URC after an SSL timeout of 30 s.

FTP command +UFTPC

+UFTPC

Modules

LEXI-R10401D-01B LEXI-R10801D-01B LEXI-R10801D-51B LEXI-R10001D LEXI-R10011D SARA-R10

Attributes

Syntax

PIN required

Settings saved

Can be aborted

Response time

Error reference

partial

No

No

No

-

+CME Error

Description

Triggers the FTP actions corresponding to the <op_code> parameter. The final result code indicates if sending the command request to the FTP process was successful or not. The +UUFTPCR (FTP command result) URC returns to the user the final result of the FTP command previously sent with +UFTPC. As well, the +UUFTPCD FTP unsolicited data URC provides the data requested by the user (e.g. file or directory lists) and received from the FTP server.

The timing before the +UUFTPCR URC is issued on the AT terminal also depends by the DNS resolution. For further details about the estimated response time related to the DNS resolution, see the +UDNSRN AT command.

Syntax

TypeSyntaxResponseExample

General syntax

Set

AT+UFTPC=<op_code>[,<param1>[,<param2>[,<param3>]]]

OK

AT+UFTPC=4,"data.zip","data.zip"

OK

FTP logout

Set

AT+UFTPC=0

OK

AT+UFTPC=0

OK

FTP login

Set

AT+UFTPC=1

OK

AT+UFTPC=1

OK

Delete the file from the FTP server

Set

AT+UFTPC=2,<filename>

OK

AT+UFTPC=2,"mytest"

OK

Rename a file of FTP server

Set

AT+UFTPC=3,<filename>,<new_filename>

OK

AT+UFTPC=3,"old_name","final_name"

OK

Retrieve the file from the FTP server

Set

AT+UFTPC=4,<remote_filename>,<local_filename>[,<retrieving_mode>]

OK

AT+UFTPC=4,"data.zip","data.zip"

OK

Store the file on the FTP server

Set

AT+UFTPC=5,<local_filename>,<remote_filename>[,<number_of_byte>]

OK

AT+UFTPC=5,"data.zip","data.zip",30

OK

Retrieve a file from the FTP server using direct link mode

Set

AT+UFTPC=6,<remote_filename>[,<number_of_byte>]

CONNECT

file content

DISCONNECT

OK

AT+UFTPC=6,"data.zip",30

CONNECT

…​data…​

DISCONNECT

OK

Send a file to the FTP server using the direct link mode

Set

AT+UFTPC=7,<remote_filename>[,<number_of_byte>]

CONNECT

DISCONNECT

OK

AT+UFTPC=7,"data.zip",30

…​ incoming data …​

+++ (user terminates the direct link)

DISCONNECT

OK

Change the remote working directory to the specified one

Set

AT+UFTPC=8,<directory_name>

OK

AT+UFTPC=8,"data_folder"

OK

Create a directory on the FTP host

Set

AT+UFTPC=10,<directory_name>

OK

AT+UFTPC=10,"new_data_folder"

OK

Remove the directory from the remote FTP server

Set

AT+UFTPC=11,<directory_name>

OK

AT+UFTPC=11,"data_folder"

OK

Information of a file or a directory

Set

AT+UFTPC=13[,<file_directory_name>]

OK

AT+UFTPC=13,"data_folder"

OK

List the filenames in a specified directory

Set

AT+UFTPC=14[,<file_directory_name>]

OK

AT+UFTPC=14,"data.zip"

OK

Retrieve the FOTA update file

Set

AT+UFTPC=100,<remote_filename>[,<fw_download_status>]

OK

AT+UFTPC=100,"data.zip"

OK

URC

+UUFTPCR: 100,<stored_byte> / <total_byte>

+UUFTPCR: 100,202752 / 1103692

URC

+UUFTPCD: 100,<stored_byte>,<total_byte>

+UUFTPCD: 100,131072,1000000

Test

AT+UFTPC=?

+UFTPC: (list of supported <op_code>s)

OK

+UFTPC: (0-5,8,10,11,13,14,100)

OK

URC

+UUFTPCD: <op_code>,<ftp_data_len>,<ftp_data>

+UUFTPCD: 13,16,"16 bytes of data"

URC

+UUFTPCR: <op_code>,<ftp_result>[,<md5_sum>]

+UUFTPCR: 1,1

Defined values

ParameterTypeDescription

<op_code>

Number

FTP command request. Allowed values:

  • 0: FTP logout; terminates the FTP session by performing a logout.

  • 1: FTP login; connects to the FTP server using the parameters of the current FTP profile (set via AT+UFTP command).

  • 2: deletes the file from the FTP server.

  • 3: renames the file. This AT command just sends requests to the FTP process.

  • 4: retrieves the file from the FTP server.

  • 5: stores the file on the FTP server.

  • 6: retrieves a file from the FTP server using direct link mode. This command handles the initial steps of the FTP protocol for retrieving a file; after that it will establish a transparent end-to-end communication with the data connection TCP socket via the serial interface. After the CONNECT result code, the file content will be directly sent to the serial interface. When the data transfer is completed, the module will automatically exit from direct link mode (no need to send +++ sequence).

  • 7: sends a file to the FTP server using the direct link mode. This command handles the initial steps of the FTP protocol for sending a file; after that it will establish a transparent end-to-end communication with the data connection TCP socket via the serial interface. After the CONNECT result code, the user can send the file content via the serial interface. Once finished, the user must wait at least 2 s before sending the +++ sequence to switch off the direct link mode. This operation may take a few seconds because the command also handles the final steps of the FTP protocol.

  • 8: changes the working directory to the specified one.

  • 9: RFU.

  • 10: creates a directory on the FTP host.

  • 11: removes the directory from the remote FTP server.

  • 12: RFU.

  • 13: information of a file or a directory. The URC +UUFTPCD returns the information of the specified file or directory from the FTP server.

  • 14: lists the filenames in a specified directory. The URC +UUFTPCD returns the list of the filenames received from FTP server. If the directory name is omitted, the list of the files names of current working directory is requested.

  • 100: retrieves the FOTA update file. The downloaded file will not be accessible to the user. During the download of the FOTA update file the +UUFTPCR: 100,<stored_byte> / <total_byte> URC or the +UUFTPCD: 100,<stored_byte>,<total_byte> URC (where supported) will provide the status of the download. At the end of the download file the +UUFTPCR: 100,<ftp_result>[,<md5_sum>] URC will provide the operation result. The <md5_sum> parameter will display the MD5 checksum of the downloaded file.

<filename>

String

Filename to be deleted/renamed from the FTP host. For the limit of the length of the string, see Command line.

<new_filename>

String

New filename. For the limit of the length of the string, see Command line.

<remote_filename>

String

Remote filename to be retrieved from the FTP host or stored in it. The maximum parameter length is 256 characters.

<local_filename>

String

Local filename (module file system) text string to be stored/sent on the file system. For the limit of the length of the string, see the File system limits.

<retrieving_mode>

Number

Allowed values:

  • 0 (default value): the file is retrieved from beginning.

  • 1: restart the data retrieving from the last data received during the previous download interrupted due to error.

<number_of_byte>

Number

Represents the number of bytes already sent to the FTP server or received from it.

  • During a file retrieval the server writes the file from the offset indicated with this parameter.

  • During a file storing the server sends the data from the value indicated with this parameter.

<directory_name>

String

Directory name on the FTP server. For the limit of the length of the string, see Command line.

<file_directory_name>

String

Path file/directory name to be listed. If not specified, the current directory list is requested. For the limit of the length of the string, see Command line.

  • <param1> optional parameter; the text string of the path (file or directory) to be name listed. If not specified, the list of the files names of current working directory is requested.

<fw_download_status>

Number

Manages the firmware package download status:

  • if omitted trigger the firmware package download from an FTP server

  • 0: suspend the firmware package download from an FTP server

  • 1: resume the firmware package download from an FTP server

<ftp_data_len>

Number

Amount of data in bytes

<ftp_data>

String

Data available from the FTP server in the ASCII [0x00,0xFF] range. The starting quotation mark shall not be taken into account like data, the first byte of data starts after the first quotation mark. The total number of bytes is <ftp_data_len>. At the end of the byte stream, another quotation mark is provided for user convenience and visualization purposes.

<ftp_result>

Number

Allowed values:

  • 0: fail

  • 1: success

<md5_sum>

String

MD5 checksum of the FOTA update file downloaded via +UFTPC=100 AT command. This parameter is issued only for +UFTPC=100 AT command.

<stored_byte>

Number

Amount of stored bytes

<total_byte>

Number

Amount of total bytes of the FOTA update file to be stored

<param1>

String

Content depend on related <op_code> (details are given above)

<param2>

String

Content depend on related <op_code> (details are given above)

<param3>

String

Content depend on related <op_code> (details are given above)

Notes

  • If <op_code>=7 (send a file to the FTP server using the direct link mode) the user must switch off the direct link mode (sending +++ to the serial interface) when the data stream is finished. This operation may take up to 10 s because the command also handles the final steps of the FTP protocol.

  • The number of parallel FTP connections in direct link mode is usually limited by the maximum number of AT terminals that can be used in parallel.

LEXI-R10401D-01B / LEXI-R10801D-01B / LEXI-R10801D-51B / LEXI-R10001D / LEXI-R10011D / SARA-R10

  • Only the following commands are supported:

  • Only one direct link connection at a time can be activated. When considering the number of active direct links, take into account also the connection established by the +USODL AT command, the UHTTP direct link mode (see parameters http_command=6 and http_command=7 in +UHTTPC command), the UMQTT binary mode (see parameter op_code=9 in +UMQTTC to publish a binary message to a topic), the +USOWR AT command for binary mode, the +FREAD AT command, and the +ULSTFILE AT command for listing FS files (see parameter op_code=0).

FTP error +UFTPER

+UFTPER

Modules

LEXI-R10401D-01B LEXI-R10801D-01B LEXI-R10801D-51B LEXI-R10001D LEXI-R10011D SARA-R10

Attributes

Syntax

PIN required

Settings saved

Can be aborted

Response time

Error reference

full

No

No

No

-

+CME Error

Section A.7.1

Description

This command retrieves the error class and code of the last FTP operation.

Syntax

TypeSyntaxResponseExample

Action

AT+UFTPER

+UFTPER: <error_class>,<error_code>

OK

+UFTPER: 1,1

OK

Defined values

ParameterTypeDescription

<error_class>

Number

Value of error class. Values are listed in Section A.7.

<error_code>

Number

Value of class-specific error code (reply code if <error_class> is 0). The values are listed in Section A.7.1.

Last updated: Jan 13, 2025
Need help?Contact Support
Questions?Contact us