Name:
booti2c
Syntax:

BOOTI2C slot

Slot - is the external EEPROM address and slot number (4 to 7)

Description:

On X2 parts it is possible to update the internal program by copying a new program from an external i2c EEPROM.

The booti2c command can be used to copy a program from an external 24LC128 memory slot into an internal memory slot. The booti2c command is only processed if the program revision number (set by the #revision directive during download) in the 24LC128 memory slot is greater than the revision number currently in the internal program slot. This means that the program copying will only occur once after a new 24LC128 is fitted.

If an EEPROM is not correctly connected, the data returned from the circuit will typically be 0 or 255, therefore these two values are not valid #revision numbers and are ignored.

The booti2c command parameter takes the format of a single data byte, which is the external i2c address and slot number.

Bit7 24LC128 A2
Bit6 24LC128 A1
Bit5 24LC128 A0
Bit4 reserved for future use
Bit3 reserved for future use
Bit2 must be set to 1 for i2c use
Bit1-0 slot number

The lower 2 bits of the slot number (bits 1,0) is copied into the same position within the internal program memory. The data memory is left unchanged. The i2c to internal program copying of slots is therefore mapped as follows (when using an EEPROM with address 0): 

  i2c slot     internal memory slot
4 (%00000100) -> 0 (%00000000)
5 (%00000101) -> 1 (%00000001)
6 (%00000110) -> 2 (%00000010)
7 (%00000111) -> 3 (%00000011)

After a program has been copied the chip automatically resets (so the program in slot 0 starts running).

Therefore if you wish to program an EEPROM with a program that is eventually targeted for updating internal program slot 2 on a different chip, a '#slot 6' directive should be included upon the computer download into the EEPROM. The EEPROM can then be transferred across and connected to the target system.

The type of EEPROM chip must be a device that has a minimum of a 64 byte page buffer. Therefore the EEPROM recommended is a Microchip brand 24LC128 (or 24LC256 or 24LC512). Non-Microchip brands may not operate correctly if they have different timing specifications or page buffer capacity.

Applies To:
20X2, 28X2, 40X2
See Also:
Related Create:
Share:
Print:

Booting another slot program

Check the revision for internal slot 1 and external slot 5 and if required copy external slot 5 to internal slot 1

Code Example:
	booti2c 1	; check EEPROM & update slot 1 if required
Copy Code Submit an Example

Submit Your Own Code!

You must be logged in to submit code examples. Login now.

Comments

  • Login to leave a comment.