System Commands
Updated 8 June 2009
The following is a summary of I2C system commands, not all devices have all of these commands but most do.
|
Command |
System Command Set |
| 0x55 | Test |
| 0x90 | Read EEPROM |
| 0x91 | Write EEPROM |
| 0x93 | End of EEPROM |
| 0x94 | Sleep |
| 0x95 | Reset |
|
0x98 |
Change Device Address Temporary |
| 0x99 | Change Device Address Permanent |
| 0xA0 | Firmware Version |
Command Format
To help to explain what information to send to the I2C bus the following is used:
<S-addr> start condition - sends a start condition with the
write (even) address
<R-addr> restart - sends a restart with the write address +1
<Stop> condition - sends s stop condition
<number> - sends a byte
<ACK> acknowledge - send acknowledge (1)
<NACK> - send not acknowledge (0)
A typical example to reset a device would be:
<s-addr><0x95><Stop>
Examples are given for the BV4221, USB to I2C convertor, these can be tested by connected the BV4221 to a USB port, using BV-COM and typing in the blue commands.
Test 0x55
< S-addr><0x55><R-Addr><Value..><NACK><Stop>
This command simply returns an incrementing value until NACK is sent by the master prior to stop. This can be useful for testing the interface. It can be used for testing the presence or other wise of a device at a particular address. It is also useful during the development stage to ensure that the I2C is working for that device.
0x42>s 55 r g-3 p
The above command will return 1,2,3 if the device is connected and working correctly.
Read EEPROM 0x90
<S-addr><0x90><EE-Address><R-Addr><data…><Stop>
This command will read one or more bytes from the EEPROM at the address given by EE-Address.
0x42>s 90 0 r g-3 p
The above will fetch 3 bytes from the EERPOM addresses 0, 1 and 2
Write EEPROM 0x91
<S-addr><0x91><EE-Address><data…><Stop>
This command will write one or more, up to a maximum of 30 bytes at any one time, to be written to the EEPROM. Address 0 of the EEPROM is the device address and this cannot be written to by this command. A special command 0x99 is used for this purpose.
0x42>s 91 10 1 2 3 p
The above write 1,2 and 3 to EEPROM addresses 0x10, 0x11 & 0x12
End of EEPROM 0x93
<S-addr><0x93><R-Addr><data><Stop>
The system only uses a small portion of the first part of the EEPROM, the rest of the EEPROM can be used for user data or other purposes depending on the device. This command returns a single byte that will determine the last writeable address of EEPROM, normally 0xFF.
0x42>s 93 r g-1 p
Returns the address of the end of the EEPROM, normally 0xff
Sleep 0x94
S-addr><0x94><Stop>
This will put the IC into sleep mode. Any other command will wake the IC. Depending on the device this can be a considerable power saving.
0x42>s 94 p
Reset 0x95
S-addr><0x95><Stop>
Resets the device, this is equivalent to disconnecting and then connecting the power again.
0x42>s 95 p
Change Device Address Temporary 0x98
<S-addr><0x98><New-Addr><Stop>
This will change the device address with immediate effect and so the next command must use the new address. The address must be a write address (even number) Odd numbers will simply be ignored. The effect will last as long as the device is switched on. Resetting the device will restore the address to its original value. The address is NOT stored in EEPROM.
0x42>s 98 62 p
Changes the device address to 0x62, the device will revert back to 0x42 at reset.
Change Device Address Permanent 0x99
<S-addr><0x99><New-Addr><0x55><0xaa><Current-Addr><Stop>
This command changes the address immediately (the next command will need to use the new address) and permanently (see hardware reset). The address must be a write address (even number) and follow the sequence exactly.
Permanent in this case means that the device will retain this address after power down, i.e. it is stored in EEPROM at location 0. Should anything go wrong the default address can be restored by using a hardware reset.
0x42>s 99 62 55 aa 42 p
Permanently changes the device address to 0x62.
Firmware Version 0xa0
<S-addr><a0><R-Addr><byte><byte><Stop>
This simply returns two bytes that represents the firmware version.
0x42>s a0 r g-2 p
This will return the two firmware bytes.
