840 views|2 replies

6829

Posts

11

Resources
The OP
 

[ST NUCLEO-U5A5ZJ-Q development board review] In-depth experience of I2C driven OLED screen [Copy link]

According to the official data sheet, the I2C can operate at three communication speeds: 100K, 400K, and 1M.

This time, three different speeds are used to drive the OLED screen, and the FPS of the OLED is used to test the effect:

【Configuration】

1. IO selects D15 (PB8) - SLC and D14 (PB9) - SDA on the development board as pin output.

2. Create an STM32CubeIDE project based on the development board and configure the pins to PB8 and PB9:

4. First, configure the speed to 100K, 400K, and 1M:

5. Transplant OLED driver, skip (please check the project attachment yourself)

6. Function for measuring FPS:

void ssd1306_TestFPS() {
    ssd1306_Fill(White);
   
    uint32_t start = HAL_GetTick();
    uint32_t end = start;
    int fps = 0;
    char message[] = "ABCDEFGHIJK";
   
    ssd1306_SetCursor(2,0);
    ssd1306_WriteString("Testing...", Font_11x18, Black);
    ssd1306_SetCursor(2, 18*2);
    ssd1306_WriteString("0123456789A", Font_11x18, Black);
   
    do {
        ssd1306_SetCursor(2, 18);
        ssd1306_WriteString(message, Font_11x18, Black);
        ssd1306_UpdateScreen();
       
        char ch = message[0];
        memmove(message, message+1, sizeof(message)-2);
        message[sizeof(message)-2] = ch;

        fps++;
        end = HAL_GetTick();
    } while((end - start) < 5000);
   
    HAL_Delay(5000);

    char buff[64];
    fps = (float)fps / ((end - start) / 1000.0);
    snprintf(buff, sizeof(buff), "~%d FPS", fps);
   
    ssd1306_Fill(White);
    ssd1306_SetCursor(2, 2);
    ssd1306_WriteString(buff, Font_11x18, Black);
    ssd1306_UpdateScreen();
}

6. The test results are as follows:

100K——9FPS

400K——29FPS

1M—— 49FPS

【Summarize】

By comparing three different speeds and configuring different speeds, the effect can be greatly improved at the same main frequency.

This post is from stm32/stm8

Latest reply

Can you send me the OLED driver attachment? There are several errors every time. [attach]785336[/attach]   Details Published on 2024-2-6 23:47
 

73

Posts

0

Resources
2
 

Can you send me the OLED driver attachment? There are several errors every time.

This post is from stm32/stm8
 
 

6829

Posts

11

Resources
3
 

My Downloads_Personal Center - - EEWORLD

I have uploaded the source code here.

This post is from stm32/stm8
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list