05 | I²C OLED: SSD1306 Wiring and Driver Milestones

Verify the bus response before initializing the display.

Wiring

Use a four-pin I²C module labeled GND, VCC, SCL, and SDA. Shut down and unplug the Raspberry Pi and follow the labels printed on the OLED board.

OLED module pin Raspberry Pi 3 physical pin Signal
VCC 1 3.3 V
GND 6 Ground
SDA 3 GPIO2 / I²C data
SCL 5 GPIO3 / I²C clock

Verify the I²C bus

If I²C is disabled on the header, add the following to the active boot config.txt and reboot.

dtparam=i2c_arm=on

Run the following on the Pi.

ls -l /dev/i2c-*
i2cdetect -l
sudo i2cdetect -y 1 0x3c 0x3d

Use the actual bus number from i2cdetect -l in place of 1 if necessary. Install or include i2c-tools if the scan command is missing. If an enabled bus has no /dev/i2c-* node, check CONFIG_I2C_CHARDEV and whether the i2c-dev module needs loading.

Result Next check
3c or 3d Record the 7-bit address and identify the panel as 128×64 or 128×32
UU Identify the driver using that address
Both show -- Check power, common ground, SDA/SCL, and bus number

The panel can stay dark after acknowledging its address. The driver must initialize it before displaying pixels.

Implement and verify the driver

  1. Define a struct i2c_driver and assign the initialization callback to .probe.
  2. Build against the target architecture and kernel, then deploy to the Raspberry Pi.
  3. Add a matching Device Tree node and confirm that the kernel calls probe().
  4. Send the initialization commands for the panel and draw a checkerboard to verify pixel layout.
  5. Connect a userspace application and display RUNNING or IDLE as its state changes.

The character driver’s .read and the I²C driver’s .probe are both C function pointers. For each, trace when Linux calls it, what it receives, and who cleans up on failure.