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

  • Hi Daniel,

    I was able to reproduce the issue you are facing, as well as finding a solution.

    Things should work if you use the twi driver instead of twim, and in addition remove zephyr,concat-buf-size = <4096>; from the overlay.

    The reason is that twim is using DMA but nRF52832 is only able to send a limited amount of bytes. For example nRF52840, nRF5340 and nRF9160 are not affected by this limitation when it comes to writing to these displays. twi is able to output data continuously, although the CPU becomes a bit more occupied as DMA is not used.

    Here is the full overlay:

    / {
    	chosen {
    		zephyr,display = &ssd1306;
    	};
    };
    
    &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-twi";
    	status = "okay";
    	clock-frequency = <I2C_BITRATE_FAST>;
        
      
    	ssd1306: ssd1306@3c {
    		compatible = "solomon,ssd1306fb";
    		reg = <0x3c>;
    		width = <128>;
    		height = <64>;
    		segment-offset = <0>;
    		page-offset = <0>;
    		display-offset = <0>;
    		multiplex-ratio = <63>;
    		segment-remap;
    		com-invdir;
    		prechargep = <0x22>;
    	};
    };
    

    Attached is the working project I tested, using nRF Connect SDK v2.1.2.

    lvgl-20230110.zip

    If you are using nRF Connect SDK v2.2.0 or later you might need to update the overlay with the below code, due to the new naming format. This section of code becomes included when using the shield, so it is not really necessary to include it in the overlay, and could be removed.

    / {
    	chosen {
    		zephyr,display = &ssd1306_ssd1306_128x64;
    	};
    };

  • Hello Helsing

    The solution works perfectly. Thank you very Much!

    I feel a bit lost with the programming of the device and with zephyr, I have taken the basic course you recommended but I still have a lot of gaps.
    Is there NRF documentation at a low level, defining for example architecture and memory issues?
    Are there higher level courses for zephyr and NRF?

    Thank you

  • Sorry for the delay.

    Please check out both our nRF Connect SDK guides and our Blog. Also check out our on-demand webinars.

    One may also learn from the samples and applications in nRF Connect SDK as well as Zephyr’s Samples and Demos section.

    Working with nRF52 Series is also a good starting point as well as Application development

    What kind of architecture and memory issues, specifically? You could open a new case (as this will be a new topic), and we will reply within the next business day.

Related