2 firmware upload – example, 3 binary data to ascii data function – DekTec DTM-3200 IP-ASI Converter User Manual
Page 31

DTM-3200 – OEM Ethernet TSoIP Converter
User Manual
31
4.5.2 Firmware upload – Example
If a file consisting of 1000 bytes must be sent in packets of 150 data-bytes, there are going to be 7
parts. The first six parts are 150 bytes long and the last part consists of 100 bytes. The table below
shows the content of the communication messages. Each line represents a message and the lines
are shown in chronological order.
Category
(hex)
Setting
(hex)
Read/write
(I
2
C / RS-XXX)
Index
(hex)
Data
Description
Abort
80
04
00 / ‘W’
0000 1 (0x01)
Reply
80
04
00 / ‘W’
0000 1 (0x01)
Number of parts
80
07
00 / ‘W’
0000 7 (0x07)
Reply
80
07
00 / ‘W’
0000 7 (0x07)
Part size
80
08
00 / ‘W’
0000 150 (0x96)
Reply
80
08
00 / ‘W’
0000 150 (0x96)
Remaining
80
09
00 / ‘W’
0000 100 (0x64)
Reply
80
09
00 / ‘W’
0000 100 (0x64)
File part
80
02
00 / ‘W’
0001 File bytes: 0 - 149
Reply
80
02
00 / ‘W’
0001 1 (0x0001)
File part
80
02
00 / ‘W’
0002 File bytes: 150 - 299
Reply
80
02
00 / ‘W’
0002 2 (0x0002)
File part
80
02
00 / ‘W’
0003 File bytes: 300 - 449
Reply
80
02
00 / ‘W’
0003 3 (0x0003)
File part
80
02
00 / ‘W’
0004 File bytes: 450 - 599
Reply
80
02
00 / ‘W’
0004 4 (0x0004)
File part
80
02
00 / ‘W’
0005 File bytes: 600 - 749
Reply
80
02
00 / ‘W’
0005 5 (0x0005)
File part
80
02
00 / ‘W’
0006 File bytes: 750 - 899
Reply
80
02
00 / ‘W’
0006 6 (0x0006)
File part
80
02
00 / ‘W’
0007 File bytes: 900 - 999
Reply
80
02
00 / ‘W’
0007 7 (0x0007)
Update device
80
03
00 / ‘W’
0000 1
Reply
80
03
00 / ‘W’
0000 –
Progress
80
05
01 / ‘R’
0000 –
Update
Reply
80
05
01 / ‘R’
0000 50 (0x00)
at 0%
Progress
80
05
01 / ‘R’
0000 –
Update
Reply
80
05
01 / ‘R’
0000 50 (0x32)
at 50%
Progress
80
05
01 / ‘R’
0000 –
Update
Reply
80
05
01 / ‘R’
0000 100 (0x64)
at 100%
Error
80
06
01 / ‘R’
0000 –
Update
Reply
80
06
01 / ‘R’
0000 0 (0x00)
successful
4.5.3 Binary data to Ascii data function
To convert the program data (File bytes) to ASCII the following function could be used.
unsigned int BinToAsc128(unsigned char* bin_data, unsigned int len, char* returnData)
{
unsigned int bytes_todo, i;
bytes_todo = len;
while(bytes_todo > 0)