Closed henkjannl closed 1 week ago
Just for information:
I remember SSD1306 of different resolution may need slightly different initialization: https://github.com/espressif/esp-idf/pull/12450
Thanks!! It indeed has to do with the difference in initialisation between 128x64 and 128x32 displays.
I modified the code in this way:
esp_lcd_panel_ssd1306_config_t esp_lcd_panel_ssd1306_config = {
.height = 32,
};
esp_lcd_panel_dev_config_t panel_config = {
.bits_per_pixel = 1,
.reset_gpio_num = -1,
.vendor_config = &esp_lcd_panel_ssd1306_config,
};
and now it is showing the 8x8 bitmaps correctly. This helped a lot!
Answers checklist.
IDF version.
ESP-IDF 5.3.1
Espressif SoC revision.
ESP32
Operating System used.
Windows
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
None
Development Kit.
MH-ET minikit
Power Supply used.
USB
What is the expected behavior?
Display images on my OLED display
What is the actual behavior?
Images look distorted
Steps to reproduce.
I have an I²C controlled SSD1306 OLED display with 128x32 pixels.
I tried to get the /peripherals/lcd/i2c_oled/main/i2c_oled_example_main.c example working, but images are distorted and screen updates were very slow. It appeared from the logfile that the I²C clock frequency was too high, and I could not manage to get the clock frequency down. By switching back to the legacy I²C driver, I managed to get the clock frequency at 400.000 Hz as specified in the SSD1306 datasheet. I also tried lower frequencies to no avail.
I also switched back to a more basic example without LVGL: ../components/esp_lcd/test_apps/i2c_lcd/main/test_i2c_lcd_panel.c
When using the
`
esp_lcd_panel_draw_bitmap()`
function, images still look distorted.I modified the test program to clearify the type of distortions:
The aim of the example is to draw 8x8 bitmaps showing a cross-hair driven by the i and j parameters. The example loops i and j from 0 to 7 with short time intervals, and waits longer when the loops are repeated.
The overall screen looks like this:
Since 16 bitmaps fit horizontally and 8 bitmaps fit vertically, it appears the bitmaps are 8 pixels wide and 4 pixels high.
Each bitmap progresses like this as parameters i and j are looped:
The bitmaps are compressed to a 8x4 bitmap, odd rows are shown and even rows are skipped.
I tried modifying the following parameters:
`
c .control_phase_bytes = 1, // According to SSD1306 datasheet .dc_bit_offset = 6, // According to SSD1306 datasheet .lcd_cmd_bits = 8, // According to SSD1306 datasheet .lcd_param_bits = 8, // According to SSD1306 datasheet`
but no variations produced better results. I also changed vertical resolution of the screen (32 or 64 pixels), but this does not make a difference.Help is appreciated.
Debug Logs.
More Information.
The hardware is working well when using the U8G2 driver in the Arduino programming environment, so I suspect something is wrong with the driver settings.