From a serial protocol to an OLED on the SG2000 / Pine64 Oz64 — Reference Notes
2026-11-04
Protocol
Platform
Device & Code
| Wires | SCL (clock) + SDA (data), half-duplex |
| Topology | multi-drop; master/slave; multi-master allowed |
| Addressing | 7-bit (112 usable), 10-bit extension |
| Speed | 100 k / 400 k / 1 M / 3.4 M |
| Typical devices | sensors, EEPROM, RTC, expanders, ADCs, SSD1306 OLED |
0x3C; on the wire the write frame is 0x78 (0x3C << 1, same on every bus).0x04000000 … 0x04040000 → Linux i2c-0 … i2c-4.IC_CON(0x00), IC_TAR(0x04), IC_DATA_CMD(0x10), IC_ENABLE(0x6C), IC_STATUS(0x70), IC_TX_ABRT_SOURCE(0x80)./dev/i2c-N, i2cdetect, ioctl(fd, I2C_SLAVE, 0x3C).0x03001000, tools cvi-pinmux/duo-pinmux).| Header pin | Pad | IIC3 | IIC4 |
|---|---|---|---|
| 1 | — | 3V3 | 3V3 |
| 3 | XGPIOB[20] |
IIC3_SDA | IIC4_SCL |
| 5 | XGPIOB[21] |
IIC3_SCL | IIC4_SDA |
| 9 | — | GND | GND |
I2C1_* names are generic RPi symbol labels — ignore.0x04030000 reads IC_STATUS = 0 — the block’s clock is runtime-gated when idle.remoteproc (no cv181x-c906_1 DT node, only rtos_cmdqu), so little-core images build but do not load here.0x00 = command, 0x40 = data.0xAE,0xD5,0x80,0xA8,0x3F,0xD3,0x00,0x40,0x8D,0x14, 0x20,0x00,0xA1,0xC8,0xDA,0x12,0x81,0xCF,0xD9,0xF1,0xDB,0x40,0xA4,0xA6,0x2E,0xAF).0x21 0 127, 0x22 0 7) then stream 1024 0x40 bytes.| Rung | Mechanism | Status |
|---|---|---|
Linux i2c-dev |
kernel driver, /dev/i2c-3 |
verified |
| Linux raw mmap | bit-bang B20/B21 | verified |
| Arduino bit-bang | MMIO on the C906L | built (no remoteproc on image) |
Arduino Wire |
vendor csi_iic |
reasoned — pin map does not fit |
| FreeRTOS (DesignWare) | MMIO + task + clock enable | reasoned |
| FreeRTOS (bit-bang) | MMIO bit-bang + task | reasoned |
examples/i2c-c/ssd1306.h is transport-agnostic; each rung supplies a oled_write_fn. The upper layer is identical everywhere.3c detected, pads restored).0x9fe00000.State which is which. It is the difference between an experiment and a claim.
i2cdetect -y -r 3; explain -r vs -y../linux-i2c-dev /dev/i2c-3 "text"; modify ssd1306.h../linux-mmap-bitbang "text"; compare on an analyser.Discuss: why data changes only while SCL is low; why the clock is open-drain; when bit-banging is the right call; where the driver/transport boundary belongs.
CS 4250 · I²C on the SG2000 — Reference Notes