Descriptions of the Nondescript

How Not to be An Expert

I had a rather humbling experience over the last few days. I think it taught me something worth sharing. I was trying out a tiny OLED display module for my newest project, and I couldn’t get it to display a damned thing. I had a logic analyzer hooked up to the SPI bus, I could clearly see the transactions my software was sending to the module, and it all looked perfect. Of course it wasn’t.

In the display world, there are at least two flavors of SPI bus: “3-wire” and “4-wire”. In my arrogant “I know all about this” mode, I just assumed 3-wire was a unidirectional bus with SCK (SPI clock), NSS (SPI active-low chip select), MOSI (“master-out, slave-in”), and 4-wire was bidirectional, adding MISO. Not so, and this is the crux of my failure.

I’m truly sorry for the colonizer terminology, which was coined into common SPI bus usage decades before most of us colonizers ever thought about how hurtful it might be.

My display module can be jumpered to support 3-wire or 4-wire, and probably other non-relevant modes as well. I had ordered the 3-wire version, thinking that I don’t have any reason to ask the display anything, so I just need MOSI.

WRONG. The 3-wire form uses weird 9-bit bytes for SPI transactions, where the extra bit is used to indicate if the byte is meant as data or command. This is, in my opinion, an unnatural act with modern MCUs, so I would never want this to avoid having to add one more GPIO pin. I had already wired the GPIO “DC” pin to indicate this on a byte-by-byte basis, and I was even using it properly. It was being ignored.

When I moved the resistor from R2 to R3 position on the back of the module to make the thing expect 4-wire style, my test application worked perfectly – as it would have been since I started if the module were in a mode to be expecting what I was giving it.

Some details for geeks: The MCU I am using is STM32H743VIT6. The display module is ER-OLEDM1.29-1 from the excellent https://BuyDisplay.com. It uses a SSD1315 controller. I’m building this software using Zephyr OS 4.4.0 for an upcoming project, about which I will write quite a bit here soon. (Hint: It’s a general coverage receiver for 1.8MHz to 30MHz, has some real innovations in hardware design and software design, and I’m very excited to be getting hardware back from JLCPCB PCBA fabrication in a couple of weeks time.)