All blocks
Connectivity
I2C
Two-wire bus for sensors and small displays
Not yetLoading the 3D view…
- SDA
- SCL
Key facts
Two I2C controllers, each master or slave, with 7-bit and 10-bit addresses.
Standard (100 kbit/s) and Fast (400 kbit/s) mode; the datasheet adds up to 800 kbit/s if the pull-ups are strong enough.
In master mode you queue up to eight commands (write, read, stop...) and the hardware runs the whole transaction.
SDA and SCL are open-drain: the bus needs pull-up resistors, and the internal 45 kΩ ones are weak.
In our labs
No lab uses this block yet.
Key registers
I2C_SCL_LOW_PERIOD_REGoffset 0x0000| Bits | Field | What it does |
|---|---|---|
| 8:0 | I2C_SCL_LOW_PERIOD | How long SCL stays low, in module clock cycles. |
I2C_CTR_REGoffset 0x0004| Bits | Field | What it does |
|---|---|---|
| 5 | I2C_TRANS_START | Start running the queued commands. |
| 4 | I2C_MS_MODE | 1 makes the controller a master. |
| 0 | I2C_SDA_FORCE_OUT | 0 for open-drain SDA. |
I2C_SR_REGoffset 0x0008| Bits | Field | What it does |
|---|---|---|
| 4 | I2C_BUS_BUSY | The bus is busy. |
| 3 | I2C_ARB_LOST | Another master won the bus. |
| 0 | I2C_RESP_REC | The last ACK bit: 0 ACK, 1 NACK. |
I2C_DATA_REGoffset 0x001C| Bits | Field | What it does |
|---|---|---|
| 7:0 | I2C_FIFO_RDATA | Read from the RX FIFO, write to the TX FIFO. |
I2C_COMD0_REGoffset 0x0058| Bits | Field | What it does |
|---|---|---|
| 31 | I2C_COMMAND0_DONE | Set when the command has run. |
| 13:0 | I2C_COMMAND0 | First command: op code (1 WRITE, 2 STOP, 3 READ, 4 END, 6 RSTART) and byte count. |
Read the full sectionTechnical reference §27