This command writes data (from 1 to 32 bytes) to the requested EEPROM address. Afterwards, it writes USB FX2 firmware, reads back data from EEPROM and returns it in a reply packet.

Byte

Value

Description

1

0xA9

EEPROM_WRITE command ID

2

AddrHigh

High part of address (address [15:8])

3

AddrLow

Low part of address (address [7:0])

4

size

Number of bytes to write (max 32)

From 5 to size+4

data

Data to write (size bytes)

From size+5 to 64

-

Not used

EEPROM_WRITE Command Packet Layout.

EEPROM Page Size = 64 => ((AddrHigh + AddrLow)%64) < size

From EEPROM 24LC128 Microchip Manual:

"Page write operations are limited to writing bytes within a single physical page, regardless of the number of bytes actually being written. Physical page boundaries start at addresses

that are integer multiples of the page buffer size (or ‘page size’) and end at addresses that are integer multiples of [page size - 1]. If a Page Write command attempts to write across a

physical page boundary, the result is that the data wraps around to the beginning of the current page (over-writing data previously stored there), instead of being written to the next page,

as might be expected. It is, therefore, necessary for the application software to prevent page write operations that would attempt to cross a page boundary."

This section imply that the following condtion should be true to realize a correct write operation: ((AddrHigh + AddrLow)%64) < size.

The ((AddrHigh + AddrLow)%64) is the remainder of ((AddrHigh + AddrLow)/64) operation.

Reply packet contains readback data.

Byte

Description

From 1 to size

Readback result

From size to 64

Not used

EEPROM_WRITE Reply Packet Layout.


  • No labels