This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Example at ...\ncs\v1.4.0\zephyr\samples\drivers\display does not work with SSD1306 wired directly to nRF9160DK

When I program the nrf9160dk with the example, the code detects the SSD1306, but the display looks like:

The image is only using the middle half (16 rows) of the display that has 32 rows and 128 columns. 

And the left side of the image is a random set of pixels.

What can I do to get the example to give me text on the screen?

I am using the SSD1306 OLED at: https://www.amazon.com/Pieces-Display-Module-SSD1306-3-3V-5V/dp/B08CDN5PSJ/ref=sr_1_8?dchild=1&keywords=ssd1306&qid=1606702037&sr=8-8

Do I have to modify any of the files to target the nRF9160 instead of the nRF52 family?

  • Hi Craig,

    Thank you for the update, I have been out of office this week, so I have not read trough your reply yet. I will hopefully be back before the week is over.

    Regards,

    Håkon

  • I have now figured out how to use the mentioned concat-buf-size. The result for zephyr/samples/drivers/display is a large white rectangle in the middle, and next to it a smaller rectangle flashing. What was needed was adding zephyr,concat-buf-size = <1024>; to the overlay. This solved an issue with the nrfx_twim driver and i2c_burst_write.

    The new nRF Connect SDK tag, v1.5.0 now has enhanced support for SSD1306. If there is no particular reason for you to stick to v1.4.0, I suggest you move to v1.5.0.

    I have experimented with both the samples zephyr/samples/drivers/display and zephyr/samples/display/cfb, tested on ncs v1.5.0-rc1(and I expect it to work on v1.5.0):

    The sample called cfb displays the characters "012345". The display is rapidly alternating between displaying the characters and a white screen. Some change is needed in order to make it look better.

    Here is the overlay I used, named nrf9160dk_nrf9160ns.overlay

    /*
     * Copyright (c) 2018-2020 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: Apache-2.0
     */

     &i2c2 { 
        compatible = "nordic,nrf-twim";
        status = "okay";
        sda-pin = <30>;
        scl-pin = <31>;
        clock-frequency = <I2C_BITRATE_FAST>;
        zephyr,concat-buf-size = <1024>;


            ssd1306@3c {
            compatible = "solomon,ssd1306fb";
            reg = <0x3c>;
            label = "SSD1306";
            width = <128>;
            height = <32>;
            segment-offset = <0>;
            page-offset = <0>;
            display-offset = <0>; 
            multiplex-ratio = <31>;
            segment-remap;
            com-invdir;
            com-sequential;
            prechargep = <0x22>; 
        };
    };

    I also added these two lines to each of the two project's respective prj.conf files:

    CONFIG_I2C=y
    CONFIG_SSD1306=y

    Regarding the voltages:

    I powered the board via the regular USB and I powered the VCC_OLED with 3.584V, generated from Nordic's PPK2. I also connected VCC_OLED to VIN_REF on the DK.

    I also briefly checked that powering the display from the pin "5V" on the board with VDD_IO set to "3V" seems to work.

  • The new addition to the device tree does help to display the characters that I code into the c code, but the zephyr library appears to only use approximately half of the vertical pixels. I have attached a picture of the display as I see it with the zephyr library and an mp4 video of the mybotic library for the arduino UNO. Can you please determine why the entire display is not used in the zephyr driver?

    smaller fontsmaller font

  • All pixels are in use on on my side. I will post an image later. Do you see the alternation between text and white background on your side?

    It looks like a little more work is needed in order to display things perfectly. I will experiment with some settings for the SSD1306 driver IC today.

  • Have you been able to spend any time on this? If your build works to use all pixels of the 128x32 array, can you please provide your files and let me know what versions of the tools you are using? Thanks!

Related