This is an example of using LwM2M and a BC68 to demonstrate differential firmware over the air (DFOTA) update. We use Leshan as a front end and a coap file server to deliver the binaries to the module.
LwM2M Application Note
Before starting please read the Quectel_BC95G_LwM2M_Application_Note_20180808 application note.
For the shake of simplicity we shall use the non-secure mode that doesn’t require the modules (IMEI) to be added to the server.
Leshan Server Front End
To view your device go to the Leshan front end: http://13.237.19.148:8080/#/clients
Setup the CDP address
AT+NCDP=13.237.19.148,5683
OK
at+ncdp?
+NCDP:13.237.19.148,5683
Following the example in section 3.3, the control is from the server web interface.
The Delta Packages
After receiving the delta packages from Quectel we place them to out coap file server. For our example we shall use the following binaries:
DFOTA BINARIES
coap://13.237.19.148:9683/data/BC68JAR02A02A_TO_BC68JAR02A02A_BETA0306.bin coap://13.237.19.148:9683/data/BC68JAR02A02A_BETA0306_TO_BC68JAR02A02A.bin
Initiate DFOTA
Go to our Leshan LwM2M front end http://13.237.19.148:8080/ and enter the appropriate package addresses in the pop-up box after clicking on the /5/0/1 “Write” button, this starts the download. You should be able to see your device (IMEI) on the server and query it as per the instructions.
TIP
to set the CDP server with the IP address, (do a DNS look-up) I got this from ping to the server:1>ping leshan.eclipseprojects.io
Pinging leshan.eclipseprojects.io [23.97.187.154] with 32 bytes of data:
therefore to setup the CDP, for me the command was:
AT+NCDP=23.97.187.154,5683
Note LwM2M uses port 5683.
Module Output Log
From the module we see:
ati
Quectel
BC68
Revision:BC68JAR02A02A
OK
at+csq
+CSQ:17,99
OK
ate1
OK
at+cgpaddr
+CGPADDR:0,10.108.71.16
OK
at+ncdp?
+NCDP:13.237.19.148,5683
OK
at+nping="8.8.8.8"
OK
+NPING:8.8.8.8,52,2679
at+cereg?
+CEREG:0,1
OK
REBOOTING
\s HI2115-ssb-codeloader l\e\s HI2115-codeloader &\e
REBOOT_CAUSE_APPLICATION_AT
Neul
OK
+QLWEVTIND:0 //urc: success registration
at+cscon=1
OK
+CSCON:0
+CSCON:1
+QLWEVTIND:5
FIRMWARE DOWNLOADING // after starting FW update click on "Write" button
FIRMWARE DOWNLOADED
+CSCON:0
+CSCON:1
+CSCON:0
+CSCON:1
FIRMWARE UPDATING // After click on "Exec" button
\s HI2115-ssb-codeloader l\e\s HI2115-codeloader &\e
\s HI2115-ssb-codeloader l\e\s HI2115-codeloader &\e
\s HI2115-ssb-codeloader l\e\s HI2115-codeloader &\e
REBOOT_CAUSE_SECURITY_FOTA_UPGRADE
Neul
OK
FIRMWARE UPDATE SUCCESS
at+cereg?
+CEREG:0,1
OK
+QLWEVTIND:0
ati
Quectel
BC68
Revision:BC68JAR02A02A_BETA0306 //new FW
OK
at+cgdcont?
+CGDCONT:0,"IP","telstra.internet",,0,0,,,,,0,0
OK
at+cgpaddr
+CGPADDR:0,10.108.115.37
OK
+QLWEVTIND:5
FIRMWARE DOWNLOADING
FIRMWARE DOWNLOADED
FIRMWARE UPDATING
\s HI2115-ssb-codeloader l\e\s HI2115-codeloader &\e
\s HI2115-ssb-codeloader l\e\s HI2115-codeloader &\e
\s HI2115-ssb-codeloader l\e\s HI2115-codeloader &\e
REBOOT_CAUSE_SECURITY_FOTA_UPGRADE
Neul
OK
FIRMWARE UPDATE OVER
+QLWEVTIND:0
at+cereg?
+CEREG:0,1
OK
ati
Quectel
BC68
Revision:BC68JAR02A02A // back to original FW
OK