Firmware Upload Procedure


The network host should use the following procedure in order to upload an application firmware file into the DS:

First, it is necessary to verify if the NetLoader is already running. This is done by sending the Echo (X) command [application firmware/ NetLoader] and checking the m flag in the reply data (see how the NetLoader is started). If the NetLoader is not started yet then the following steps should be taken:
The network host should login (if not logged in yet) using the Login (L) command;
Next, the network host should send Jump To Netloader (N) command. This will start the NetLoader
It is better to verify that the NetLoader is, indeed, running, by sending another Echo (X) command and checking the status of the m flag.
Once the NetLoader is started the network host should send Start Over (Q) command to reset the data upload process.
Then, the network host should issue as many Data Block (D) commands as necessary to upload the entire firmware file.
When the upload is completed the host should send the Verify and Start Firmware (E) command to start the newly loaded firmware. The host should wait about 2 seconds (to allow the firmware to start) before proceeding to the next step.
As the last step of the procedure it is better to issue the Echo (X) command again to verify that the new firmware is, indeed, running.

The above procedure is, of course, simplified, as it does not take into account all kind of possible errors that can potentially arise practically on every step of the firmware upload. The "entity" performing the upgrade should carefully analyse the result of every step in the above procedure and correctly react to different error codes returned by the DS.

Also, the procedure above doesn't show the use of the Select In Broadcast Mode (W) command that provides a way to program the DS whose IP-address is unreachable (see broadcadt UDP programming for explanation). The NetLoader also support a similar command (see Select In Broadcast Mode (W) command ). Important point to realize is that since the NetLoader is a separate firmware component the Select In Broadcast Mode (W) command should be used twice:

The W command should be used to first time before sending the Login (L) command and Jump To Netloader (N) command. This will pre-select the DS for broadcast access while still in the application firmware.*
The W command should be used the second time when the NetLoader starts, before starting the file upload (Start Over (Q) command, Data Block (D) commands, and Verify and Start Firmware (E) command)*. 

* These commands should, of course, be sent as UDP broadcasts in this case.