In german language "Krimskrams".
A user has problem with STM32F411 and OLED-display (I²C) and thinks he solved it with a "reset pin".
I'm lazy and STLink is still connected to a STM32G431 board. So I use this for a test.
Instead of Adafruit GFX etc. I'm using U28g library from Oli Kraus for monochrome displays.
Here is the sketch:
Code: Select all
//-----------------------------------------------------------------------------
// Board: STM32G431CBU6 (WeactStudio "long type")
// https://github.com/stm32duino/Arduino_Core_STM32/blob/main/variants/STM32G4xx/G431C(6-8-B)U_G441CBU/PeripheralPins.c
// https://github.com/stm32duino/Arduino_Core_STM32/blob/main/variants/STM32G4xx/G431C(6-8-B)U_G441CBU/variant_generic.h
// DAC: PA4, PA5
// I2C: PA8 (SDA), PA9 (SCL)
// UART1: PA3 (RX), PA2 (TX)
// LED: PC6
//
// https://github.com/olikraus/u8g2/wiki/u8g2setupcpp#ssd1306-128x64_noname
// Reference with functions: https://github.com/olikraus/u8g2/wiki/u8g2reference
//-----------------------------------------------------------------------------
#include <U8g2lib.h> // version U8g2@2.34.22
U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, PA9, PA8 );
void setup() {
Serial.begin(19200);
delay(2500);
Serial.print("\n\n ----- Test OLED-Display 124x64 Pixel SH1106/SSD1306 and STM32G431CBU6 ----- \n");
u8g2.setI2CAddress(0x3C * 2);
u8g2.begin();
u8g2.setFont(u8g2_font_ncenB08_tr);
}
void loop() {
u8g2.clearBuffer();
u8g2.drawStr(10,10,"STM32G431CBU6");
u8g2.drawStr(10,25,"OLED 124x64");
u8g2.setCursor(10, 50);
u8g2.print(millis()/1000);
u8g2.sendBuffer();
delay(1000);
Serial.printf("bygone time: %d s\n",millis()/1000);
}
Global variables use 3052 bytes (9%) of dynamic memory, leaving 29716 bytes for local variables. Maximum is 32768 bytes.
1.3inch display is from AliExpress with that typical chinese description:
Display Mode 1.3" OLED
Type TFT
wide supply range: DC 3V-5V
Support for multiple operation modes: 3-wire SPI, 4-wire SPI, IIC
internal drive chip: SH1106 (operation and SSD1306 same)
Of course he's selling only a I²C version and display has 4 pins. I'm simply trying I²C-standard adress 0x3C, there is no info in offer. I don't need a delay() after U8g2.begin() and also no reset pin.