I2C Command Mode Interface

The same messages that can be sent over a serial connection (see Command Mode Protocol (Serial Interface)) can be sent over I2C.

When MULTOS detects that a master I2C device is present (pin 18 pulled high on power-up / reset) then it activates MULTOS as a slave I2C device and uses this interface to process all incoming embedded command mode commands.  The default I2C slave address of MULTOS is 0x5F.

The slave I2C interface supports the following registers.

Register

Type

Register Size

Use

Details

0x00

Write

1-3 bytes

Command tag and length

The first byte contains the TAG value.  The second and third bytes (if present) contain the length value as follows.

  • Tag = 0x00-0x3F: no length bytes (length is zero) - register size is 1 byte
  • Tag = 0x40-0x7F: one length byte - register size is 2 bytes
  • Tag = 0x80-0xBF: two length bytes - register size is 3 bytes

0x01

Write

Variable

Command data

This register should be written to the required number of times to ensure that all the data is transmitted.  The maximum number of bytes that should be written per register write is 256.  MULTOS processes the command automatically once all data bytes has been received.

0x80

Read

1 byte

Response tag

 

0x81

Read

1-2 bytes

Response length

The size of this register depends upon the tag value as follows.

  • Tag = 0x00-0x3F: this register must not be read as the response length is zero
  • Tag = 0x40-0x7F: one length byte - register size is 1 byte
  • Tag = 0x80-0xBF: two length bytes - register size is 2 bytes

0x82

Read

Variable

Response data

This register should be read from the required number of times to receive all the response data.  The register size is the minimum of:

This register must not be read if there is no response data. 

  1. The amount of remaining response data still to be read
  2. The maximum amount of response data, defined by the contents of register 0x83

0x83

Write

2 bytes

The maximum amount of response data to return

Power-on initial value equals 0xFFFF.

 

 

The master I2C device must ensure that the correct I2C registers are accessed at the correct time.  If an incorrect register is accessed then this might lead to an I2C lock-up, with the I2C master device waiting for data to be returned from MULTOS which is never sent.