I have some OLED Displays here but I can’t get them working, unfortunately with none of the libraries I found in the core library folder (adafruits ssd1306, OLED_I2C are both not working). I could get the u8g2 working either…
Only with the OLED_I2C library something is shown on the Displays (0.96″ OLED and 0.49″ OLED): only some random dots appearing…
question 1:
am I doing something wrong?
question 2:
should this library also works wir an 0.66″ Display (64×48 dots)?
This is my code:
#include <OLED_I2C.h>
OLED myOLED(SDA1, SCL1, PB8);
extern uint8_t TinyFont[];
void setup()
{
myOLED.begin();
myOLED.setFont(TinyFont);
myOLED.clrScr(); //clear Display
}
void loop()
{
myOLED.print("Hello W.", 10,10);
myOLED.update();
delay(1000);
}
https://www.ebay.de/itm/White-Blue-0-49 … 2749.l2649
0.66″ Display:
https://www.ebay.de/itm/0-66inch-OLED-D … 2749.l2649
0.96″ Display:
https://www.ebay.de/itm/0-96-6Pin-12864 … 2749.l2649
They all run on 3.3V, so I don’t think it has something to do with the voltages… ![]()
in “HW_STM32_defines.h”:
// *** Hardwarespecific defines ***
#define cbi(reg, bitmask) *reg &= ~bitmask
#define sbi(reg, bitmask) *reg |= bitmask
#define pulseClock cbi(P_SCK, B_SCK); asm ("nop"); sbi(P_SCK, B_SCK)
#define fontbyte(x) cfont.font[x] #define bitmapbyte(x) bitmap[x]
#define bitmapdatatype unsigned char*
#define SDA1 PB11
#define SCL1 PB10
#define SDA PB7
#define SCL PB6
#define TWI_SPEED TWI_SPEED_400k // Set default TWI Speed
#define TWI_SPEED_100k 208
#define TWI_SPEED_400k 101
#define TWI_DIV TWI_DIV_400k // Set divider for TWI Speed (must match TWI_SPEED setting)
#define TWI_DIV_100k 1
#define TWI_DIV_400k 0
Don’t you get some warnings during building the project?
I see an active electronic component on the back side of the first board, what can it be?
If it is a voltage regulator, that may cause some trouble.
Have you checked the I2C pins for any useful signal with scope?
Try out Adafruit_SSD1306 (in the STM32 F1 library folder!) Take the “ssd1306_128x64_i2c_STM32” example.
Connection is on I2c Port 1 (edit!)
I adapted the library years ago, seems that there were many changes in I2c since them.
Output is VERY slow now…but it works. (If i have time, I’ll examine it) CORRECTED: See next post
OLED_I2C (also in library F1 folder) is totally broken – even changing HWIRE to Wire. But you can use soft-i2c: Choose any other pin than SDA/SCL or SDA1/SCL1, for example:
OLED myOLED(PA4, PA3); Wire.setClock(400000);If you don’t need speed and using any free pins, use the other one (as I explained)
On a 128×64 monochrome display I prefer to save my SPI port(s) and doing it “soft”


