Posts

Showing posts from 2018

u8g2 library usage with STM32 MCU

Image
Several years ago I wrote couple of articles about beautiful library u8glib in context of STM32 microcontrollers. Time moves on and author of this library released newer one, u8g2. u8glib is officially deprecated and not developed anymore. We cannot afford to lose code support for our libraries, time to move to newer library! Differences between these libraries are listed there, also there are a lot of helpful information about u8g2 library. It is not so hard to modify your old u8glib code for newer library. I'll show you how to use this library with Nucleo-F401 board and SSD1306 display, bought on Aliexpress. Display connection is SPI, pins are GND, VCC, SCL(the same as SPI clock), SDA(the same as MOSI), RES and DC. Wiring is: PA5 -> SCL PA7 -> SDA PA9 -> OLED_RES PC7 -> OLED_DC I use CubeMX code generation tool to initialize all the peripheral.  OLED_RES and OLED_DC is just GPIO output. SPI1 initialized with default parameters. u8g2 library has it