Subsection 10.4.5 Register Summary
| Register | Field(s) used | Purpose | Source |
|---|---|---|---|
I2C_CR1 |
PE | Peripheral enable: clear it before writing TIMINGR, set it when done | RM §23.7.1 |
I2C_CR2 |
SADD, RD_WRN, NBYTES, AUTOEND, START | Describes one whole transaction: who, which direction, how many bytes, what to do at the end, and go | RM §23.7.2 |
I2C_TIMINGR |
PRESC, SCLL, SCLH, SDADEL, SCLDEL | SCL timing: PRESC divides I2CCLK by PRESC+1; the other four are counted in units of the prescaled clock | RM §23.7.5 |
I2C_ISR |
TXIS, RXNE, NACKF, TC, STOPF | Status: ready for a byte to send; a byte has arrived; a NACK was received; NBYTES transferred and SCL held LOW (AUTOEND clear); a STOP was sent |
RM §23.7.7 |
I2C_ICR |
NACKCF, STOPCF | Writing a 1 clears NACKF or STOPF in I2C_ISR, which otherwise stay set |
RM §23.7.8 |
I2C_TXDR / I2C_RXDR
|
whole register | The byte going out, and the byte that came in | RM §23.7.10–11 |
GPIOx_MODER |
MODE8, MODE9 | Alternate function mode on PB8 and PB9 | RM §6.4.1 |
GPIOx_OTYPER |
OT8, OT9 | Output type: 1 is open-drain, 0 (reset) is push-pull | RM §6.4.2 |
GPIOx_AFRH |
AFSEL8, AFSEL9 | Which alternate function: AF6 is I2C1 on both pins; written in C as AFR[1]
|
DS Table 15 |
RCC_APBENR1 |
I2C1EN | Enable the I2C1 peripheral clock | RM §5.4.13 |
“RM” is RM0490, the STM32C0x1 reference manual; “DS” is the STM32C031C6 datasheet. The I2C chapter is §23 and the GPIO chapter is §6. Note that the reference manual’s I2C chapter still uses “master” and “slave” where this course says controller and target, so
SADD is documented as the “slave address” field.
