Request from host, Write command, Firmware – Rainbow Electronics AT89C5132 User Manual
Page 16: Dfu suffix

16
AT89C5132
4256A–USB–06/03
Request from Host
Write Command
The write command is 6 bytes long. In order to reach the USB specification of the Con-
trol type transfers, the write command is completed with 26 (=32-6) non-significant
bytes. The total length of the command is then 32 bytes, which is the length of the
Default Control Endpoint.
Firmware
The firmware can now be downloaded to the device. In order to be in accordance with
the Flash page size (128 bytes), X non-significant bytes are added before the first byte
to program. The X number is calculated to align the beginning of the firmware with the
Flash page. X = start_address [32]. For example, if the start address is 00AFh (175d), X
= 175 [32] = 15.
DFU Suffix
The DFU suffix of 16 bytes are added just after the last byte to program. This suffix is
reserved for future use.
Figure 5. Example of Firmware Download Zero Length DFU_DNLOAD Request
The Host sends a DFU_DNLOAD request with the wLength field cleared to 0 to the
device to indicate that it has completed transferring the firmware image file. This is the
final payload packet of a download operation.
This operation should be preceded by a Long Jump address specification using the cor-
responding Flash command.
bmRequestType
bRequest
wValue
wIndex
wLength
Data
0010 0001b
DFU_DNLOAD (1)
wBlock
Interface (4)
Length
Firmware
Command Identifier
data[0]
data[1]
data[2]
data[3]
data[4]
Description
Id_prog_start
01h
00h
start_address
end_address
Init Flash programming
OUT
Prog_Start + (EP0 fifo length - 6) x 00h
SETUP
DFU_DNLOAD
OUT
X offset bytes + Firmware Packet 1
OUT
Firmware Packet 2
OUT
Firmware Packet n + DFU suffix
IN
ZLP