A 128 × 64 SSD1306 OLED on the STM32 NUCLEO-F446RE

A 128 × 64 SSD1306 OLED on the STM32 NUCLEO-F446RE — photograph from the project archive.

This STM32 project initializes a small I2C OLED, draws text and then exercises simple graphics. The folder title says SSD1366, but the firmware, driver header and supplied display datasheet identify the controller as SSD1306.

How the project works

The main program initializes the SSD1306, clears its buffer, writes text in two font sizes and calls SSD1306_UpdateScreen to transfer the contents to the display. It then draws a circle, a border and horizontal separator lines.

The separation between drawing and updating is central to this driver: changing the buffer does not by itself refresh the physical OLED. The included photograph shows the display connected to the Nucleo bench setup.

Hardware and configuration

ItemIn the supplied code
Target boardNUCLEO-F446RE
I2C1 SCL / SDAPB8 / PB9
Configured display128 × 64 pixels
Driver address constant0x78, corresponding to 7-bit address 0x3C

Working with the supplied code

Open the supplied STM32 project and check its generated clock and I2C configuration before adapting the display code. Confirm the OLED module’s power and logic requirements and the address used by its hardware.

The header also contains an alternative 0x7A address as a comment. Use the address format expected by the HAL-facing driver; mixing a seven-bit address with a shifted constant is a common source of failed initialization. The archive’s pinout illustration is labeled for another Nucleo variant, so use the firmware’s PB8/PB9 configuration and the F446RE board manual as the final connection reference.

Source code and project files

Browse this project on GitHub. The files below are useful starting points for the sketches and references discussed in this post.

Download the used libraries (ZIP, 14.7 MB).

The main source references a ControllersTech OLED tutorial; the project includes ST HAL code and the SSD1306 driver’s own notices.

These notes describe the archived source and project media. The sketches have not been rebuilt or tested on hardware for this article.

Scroll to Top