Go to menu

Troubleshooting an SH1106-based SPI display

2024-09-21

Some time ago I was wrangling a one-off embedded project, where I needed a small display. I had two SPI-based displays and none of them worked. I almost went mad debugging, so I shelved the project.

Now, returning to it some months later, I finally looked into the SH1106 datasheet (which is a non-searchable PDF for some reason) and noticed this snippet:

The serial interface is initialized when CS is high. A falling edge on CS enables the serial interface and indicates the start of data transmission.

I naively thought both that the Arduino HAL for my STM32F1 would enable some internal pullup on CS (chip select), but also that keeping CS effectively tied to ground wouldn’t be a problem, since I thought “start of transmission” triggers on a CLK edge, and is only gated on CS. I was clearly wrong on both counts, since adding a pullup to CS fixed the issue.