In the previous article I described how to scan Elektronika MK-52 (Электроника МК-52) VFD with STM32F108C8T6 and dump to serial port what is being displayed on the VFD. In the last couple of weekends I made some progress with 256x64 16 Grayscale SH1122 based OLED display which looks like a good fit for the original VFD replacement with respect to both dimensions and brightness:
This OLED uses 7 wires SPI interface and works quite stable up to 8MHz. There are a couple of non-essential problems though:
- On-board DC-DC converter does not produce enough current to driver OLED when all pixels are on
- When lowest gray color is used one half of the display looks a bit more dark, probably because 256x64 are actually two separate 128x64 drivers?
SH1122 controller support 16 shades of gray, which could be useful to animate the display when program is running. On the real VDF you can see some flashing digits when you start a program execution. On this OLED we can use gray color for flashing digits and white for solid ones.
There are a few tricks I used to make this OLED work:
- SPI initialized used STM HAL, but then all writes are done using CMSIS for direct register access – works almost 3x times faster
- Font is coded using 0x0F color, so with a simple mask it can be easily converted to any other color
- Frame buffer size is 256x37 – just enough to store font full height and speed-up frame flushing over SPI
Shadow frame buffer stores symbols being displayed, so only changes are rendered
Putting everything together.
This is how OLED look like compare to VFD: