LE910NA FOTA Upgrade 20.00.525 to 20.00.528 and Downgrade to 20.00.252
The FOTA AT command took me a long time to figure out. None of the documentation I read and tried worked. If errors occurred (and they did) I need to figure out how to return to a good state. Below I describe how I do it with a script.
I wrote a script (a delimited string) that I send to the modem. A very simple function is called in the modem when a script is sent. Basically the function is a loop that parses a line from the script and uses a case statement based on the first letter of the string to determine what to do. A string starting with “FAIL2” is sent before an AT command that my fail. For example FAIL2L0, means if there is an errors skip all lines until you reach the a line that starts with L0.
This allows me to remotely query the modem at anytime with any AT commands. The AT command replies are captured and the resulting string returned to me.
The script provides AT commands, timeout value in seconds, “FAIL2” command if they AT command failed.
Script, based on first char of each line.
F - FAIL2, Goto label on failure
T - Set timeout
A - AT Command (Send normally)
W - Write AT command to Telit, don’t wait for reply.
R - Read from Telit, Options to Extend timeout, Exit on OK or on Keyword.
X - Exit from script.
L - is a goto label. Nothing to do, skip to next iteration.
Here are the scripts with my comments.
LE910NA FOTA Upgrade 20.00.525 to 20.00.528
==========Script with Comments==========
AT#SGACT=1,0 // Close Socket so it can be configured for FTP
T=2 // 2 second timeout
AT+CGMR // get firmware version
FAIL2L0 // On Fail Goto Label L0
AT#SCFG=1,1,1460,150,600,50 // Configure Socket for FTP, Increase exchange timeout to 2.5 minutes to keep connection.
AT#SGACT=1,1 // Open Socket
FAIL2L1 // On Fail Goto Label L1
AT#FTPTO=400 // Set FTP timeout, actually times out at 5 minutes
T=120 // Timeout is 300 seconds or 5 mintues.
AT#FTPOPEN=“184.123.123.123:9000","myEmail@myEmail.com”,“MyPassword”,1 // Open FTP Connection to Server
FAIL2L2 // On Fail Goto Label L2
T=2 // 2 second timeout
AT#FTPTYPE=0 // Set FTP to Binary Transfer
T=60 // 60 second timeout
WAT#FTPGETOTA=“LE910_NA1_1G_20.00.525_20.00.528.bin”,1 // Write command to Modem, dont wait for reply. telit output "####### OK
R,t,t,1,#,0, // Read from modem, extend timeout when # received, exit when OK received or timeout.
T=2 // 2 second timeout
AT#FTPCLOSE // Close FTP Connection
AT#SGACT=1,0 // Close Socket, not network needed now.
FAIL2L0 // On Fail Goto Label L0.No additional work to do.
AT // AT+CGDCONT=1 Do this before applying delta file.
T=240 // Timeout is 300 seconds or 5 mintues.
WAT#OTAUP=0,0 // apply delta file, this will cause modem to reboot.
R,f,f,0,6,#OTAEV, // Read response from modem until keyword #OTAEV or timeout.
T=2 // 2 second timeout
AT+CGMR // get firmware version
XIT // Exit - We are done.
L2 // Failed to Open FTP Connection
AT#FTPCLOSE // Close FTP Connection
L1 //
AT#SGACT=1,0 // Close Socket, no network needed now.
L0 //
AT+CGMR // get firmware version
==========End Script with Comments==========
LE910NA FOTA Down Grade 20.00.528 to 20.00.525
==========Script with Comments==========
T=2 // 2 second timeout
AT+CGMR // get firmware version
FAIL2L1 // On Fail Goto Label L1
AT#FTPTO=400 // Set FTP timeout, actually times out at 5 minutes
T=120 // Timeout is 300 seconds or 5 mintues.
AT#FTPOPEN=“123.123.123.123:9000","myEmail@myEmail.com”,“myPassword”,1 // Open FTP Connection to Server
FAIL2L2 // On Fail Goto Label L2
T=2 // 2 second timeout
AT#FTPTYPE=0 // Set FTP to Binary Transfer
T=60 // 60 second timeout
WAT#FTPGETOTA=“LE910_NA1_1G_20.00.528_20.00.525.bin”,1 // Write command to Modem, dont wait for reply. telit output "####### OK
R,t,t,1,#,0, // Read from modem, extend timeout when # received, exit when OK received or timeout.
T=2 // 2 second timeout
AT#FTPCLOSE // Close FTP Connection
AT#FTPTYPE=0 //
AT#SGACT=1,0 // Close Socket, not network needed now.
FAIL2L0 // On Fail Goto Label L0.No additional work to do.
AT+CGDCONT=1 // Do this before applying delta file.
T=240 // Timeout is 300 seconds or 5 mintues.
WAT#OTAUP=0,0 // apply delta file, this will cause modem to reboot.
R,f,f,0,6,#OTAEV, // Read response from modem until keyword #OTAEV or timeout.
T=2 // 2 second timeout
AT+CGMR // get firmware version
AT#SCFG=1,1,300,90,600,1 // Configure socket for small packets
XIT // Exit - We are done.
L2 // Failed to Open FTP Connection
AT#FTPCLOSE // Close FTP Connection
L1 //
AT#SGACT=1,0 // Close Socket, not network needed now.
L0 //
AT#SCFG=1,1,300,90,600,1 // Configure socket for small packets
AT+CGMR // get firmware version
==========End Script with Comments==========
I hope this helps.
Let me know if you are confused or need help.