Skip to main content


Returns the error code generated by the last I²C read


Device (from impOS™ 30)


Integer — an I²C Error Code, or the constant NO_ERROR


The error code generated by the most recent operation may be useful in diagnosing a hardware fault when has returned null — its error signal.

I²C Error Codes returned by i2c.readerror() and i2c.write() are listed below.

Error Code Constant Value Description
NO_ERROR 0 Method completed successfully
MASTER_SELECT_ERROR -1 Timeout waiting for bus to be released after sending start
TRANSMIT_SELECT_ERROR -2 Timeout while selecting transmit mode
TRANSMIT_ERROR -3 Timeout while sending data
BTF_ERROR -4 Timeout waiting for data transfer to complete
STOP_ERROR -5 Timeout waiting for stop condition to be detected
ADDR_CLEAR_ERROR -6 Timeout waiting for address flag to be cleared
ADDR_RXNE_ERROR -7 Timeout waiting for address to be read
DATA_RXNE_ERROR -8 Timeout waiting for data to be read
SLAVE_NACKED_ERROR -9 Slave NACKs the send (impOS™ release 34 and up)
MASTER_RECEIVE_SELECT_ERROR -10 Timeout while selecting multibyte receive mode
RECEIVE_ERROR -11 Timeout during multibyte read
RESELECT_ERROR -12 Timeout waiting for bus to be released after sending start
NOT_ENABLED -13 Attempt to read or write from an unconfigured peripheral

The values assigned to the constants may change in a future impOS release.