Upload Data Block (D) command [Release 3.5]


(see command description format info here)

Function:Uploads a 128-byte data block into the data FLASH memory of the DS
Can be issued through:Network (broadcasts ignored*, login required). UDP only, TCP/Telnet not supported.
Command format:Dnnddd..dd, where nn: data block number in binary format (exactly 2 bytes), ddd..dd- 128 bytes of data in binary format
Possible replies:A, D, C, S, 0, F
First introduced:Earlier than "baseline" V3.51, not supported by Release3 firmware branch
See also:NetLoader


This command is only used on second-generation Devices (i.e. it is implemented on Release3.5 firmware only).

Upload Data Block command sends a 128-byte block of data to the data FLASH memory of the DS. This command is used for application firmware upgrades through the network.

Upgrade starts with Reset Upload Process (Q) command . After that, Upload Data Block is used necessary number of times until entire application firmware file is uploaded block by block. The first command sent should have its nn field set to 0x00 0x00, next- 0x00 0x01, etc. Each command should supply exactly 128 bytes of data. If the file cannot be split into N full 128-byte blocks the last block should be padded with any data. Once entire file has been uploaded two additional commands should be used: Set Programming Request Flag (N) , followed by Reboot (E) . After the DS emerges from reset the Monitor will copy new firmware file from the data FLASH into the program FLASH.  

This command requires prior login using the Login (L) command (programming session must be opened). Denied (D) reply code is returned if the programming session is not in progress or if it doesn't belong to the sender of the command- the DS remembers the IP-address of the network host that opens the programming session and requires that all subsequent commands (that require prior login) are sent from the same IP.

Error (C) reply code is returned if command length wasn't exactly 131 byte in length (command code + 2-byte block number + 128 bytes of data). Bad Sequence (S) reply code is issued if data blocks were not consecutive (for example, after block 3 came block 5). The DS replies with Out-of-range (O) reply code if file size has exceeded data FLASH capacity. Failed (F) reply code is returned if there was an error writing into the data FLASH. OK (A) reply code is returned when the block is received properly and all is right. This code is always followed by next block number -- 2 bytes in network byte order (High endian format).

Upload Data Block command is different from all other commands in that its fields are of binary type (all other commands are ASCII strings). 

* Without prior selection using Select In Broadcast Mode (W) command.