NRF 52 OLED SSD 1306 SEGGER

Hello to all

I am quite lost, I need help to connect an oled to my project. The rest of the stages I have it complete, but my experience with OLED, is limited to arduino with U8G2 type libraries, that is, I don't know how to connect and configure my display with my board.

I am using NRF52DK and segger Studio.

Any recommendations on how I should start, or example with my environment?

Thank you very much

Parents Reply Children
  • Hello Helsing,

    From the recommendations I am using visual studio with zephyr, and I have done the recommended tutorial.

    I am trying to compile the code in your post to use oled and I am getting compile errors.

    the console say this

    Thank you

  • I was able to reproduce the same or similar errors when trying to build without any overlay file.

    Did you create any .overlay file? Check under input files if there is any such file.

    If not present, click where it says "Click to generate overlay". Then add the following to the generated(empty) file:

    &pinctrl {
        i2c0_default: i2c0_default {
            group1 {
                psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
                    <NRF_PSEL(TWIM_SCL, 0, 27)>;
            };
        };
    
        i2c0_sleep: i2c0_sleep {
            group1 {
                psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
                    <NRF_PSEL(TWIM_SCL, 0, 27)>;
                low-power-enable;
            };
        };
    };
    
    arduino_i2c: &i2c0 {
    	compatible = "nordic,nrf-twim";
    	status = "okay";
    	clock-frequency = <I2C_BITRATE_FAST>;   
        zephyr,concat-buf-size = <4096>;
      
        ssd1306: ssd1306@3c {
            compatible = "solomon,ssd1306fb";
            reg = <0x3c>; //0x3c is the i2c address of the SSD1306 aIC.
            width = <128>;
            height = <32>; // Change to '64' when using the 128x64 pixel version.
            segment-offset = <0>;
            page-offset = <0>;
            display-offset = <0>;
            multiplex-ratio = <31>; //change to '63' when using the 128x64 pixel version
            segment-remap;
            com-invdir;
            com-sequential;
            prechargep = <0x22>;
        };
    };
    	

    I selected i2c0 for nRF52 DK.

    Please report back how this goes.

    I tried building with nRF Connect SDK v2.1.2 but I did test it on the DK as I did not have any nRF52 DK at hand today. I will try flashing the board tomorrow.

  • Hello Helsing,

    Thank you for your reply

    I try to generate overlay file, and now i have two new problems:

    I'm lost with this issue.

    Thank you very much

  • Have you taken the shield into use? I am getting a similar error as you if I remove references to the ssd1306 shield. Try adding this line of code to the file CMakeLists.txt in your project folder: set(SHIELD ssd1306_128x32).

    Add the line just below cmake_minimum_required(VERSION 3.20.0).

  • Hello Helsing

    Thank you very much for your help.

    Now, i can flash DK board, but i have any mistake, because the thisplay show this:

    GND-->GND

    VCC -->VCC

    SCL-->P0.27

    SDA-->P0.26

    I have this Structure now:

    With this code:

    (Overlay file)

    &pinctrl {
        i2c0_default: i2c0_default {
            group1 {
                psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
                    <NRF_PSEL(TWIM_SCL, 0, 27)>;
            };
        };
    
        i2c0_sleep: i2c0_sleep {
            group1 {
                psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
                    <NRF_PSEL(TWIM_SCL, 0, 27)>;
                low-power-enable;
            };
        };
    };
    
    arduino_i2c: &i2c0 {
    	compatible = "nordic,nrf-twim";
    	status = "okay";
    	clock-frequency = <I2C_BITRATE_FAST>;   
        zephyr,concat-buf-size = <4096>;
      
        ssd1306: ssd1306@3c {
            compatible = "solomon,ssd1306fb";
            reg = <0x3c>; //0x3c is the i2c address of the SSD1306 aIC.
            width = <128>;
            height = <64>; // Change to '64' when using the 128x64 pixel version.
            segment-offset = <0>;
            page-offset = <0>;
            display-offset = <0>;
            multiplex-ratio = <63>; //change to '63' when using the 128x64 pixel version
            segment-remap;
            com-invdir;
            com-sequential;
            prechargep = <0x22>;
        };
    };

    Cmakelist

    # SPDX-License-Identifier: Apache-2.0
    
    cmake_minimum_required(VERSION 3.20.0)
    set(SHIELD ssd1306_128x64)
    
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(lvgl)
    
    FILE(GLOB app_sources src/*.c)
    target_sources(app PRIVATE ${app_sources})
    

    Thank you very much

Related