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\display\cfb does not work with SSD1306 wired directly to nRF9160DK

Despite following the procedure listed below, no text appears on the OLED display, despite the driver being able to communicate with the device.

I am using nRF Connect SDK v1.4.0.

I build the example that I copied from {INSTALLDIR}\ncs\v1.4.0\zephyr\samples\display\cfb with the following modifications/additions:

  1. added nrf9160dk_nrf9160ns.overlay custom device tree overlay file
  2. updated prj.conf file to include SSD1306 and to enable the I2C port.

I build the example from within a bash window with the command "west build -b nrf9160dk_nrf9160ns".

After building, I program the nrf9160 with the cfb/build/zephyr/merged.hex.


7317.cfb.zip

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
*** Booting Zephyr OS build v2.4.0-ncs1 ***
Flash regions Domain Permissions
00 00 0x00000 0x08000 Secure rwxl
01 31 0x08000 0x100000 Non-Secure rwxl
Non-secure callable region 0 placed in flash region 0 with size 32.
SRAM region Domain Permissions
00 07 0x00000 0x10000 Secure rwxl
08 31 0x10000 0x40000 Non-Secure rwxl
Peripheral Domain Status
00 NRF_P0 Non-Secure OK
01 NRF_CLOCK Non-Secure OK
02 NRF_RTC0 Non-Secure OK
03 NRF_RTC1 Non-Secure OK
04 NRF_NVMC Non-Secure OK
05 NRF_UARTE1 Non-Secure OK
06 NRF_UARTE2 Secure SKIP
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi, Craig!

    From what I can see your code works. How much voltage are you supplying to the device? I haven't seen the datasheet, but my guess is that 3V is not adequate.

    Best regards,
    Carl Richard

  • I am supplying the OLED with 5V from the nRF9160 header pin.

    The device does display text when connected to an arduino uno and running code that uses the u8g2 library.

    Would you recommend another sample build to try? Any other suggestions?

    Would the /SSD1306-LCD-on-NRF52 project that was mentioned on this devzone work on the nRF9160?

  • Hi again!

    Good. Then that should be OK! Jimmy actually has a series of samples for the nRF9160 where Example 4 shows how the SSD1306 can be used. Have you made sure to include the shield in CMakeLists.txt like this?

    Fullscreen
    1
    set(SHIELD ssd1306_128x32)
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    The Zephyr documentation contains more info about the generic SSD1306 shields.

    Best regards,
    Carl Richard

  • Adding the set(SHIELD ssd1306_128x32) causes the device tree overlay to result in errors.

    The new log file from the west build is:

    $ west build -b nrf9160dk_nrf9160ns
    [0/1] Re-running CMake...
    Including boilerplate (Zephyr base (cached)): D:/Users/craig/ncs/v1.4.0/zephyr/cmake/app/boilerplate.cmake
    -- Application: D:/nordicProjects/cfb
    -- Using NCS Toolchain 1.4.0 for building. (D:/Users/craig/ncs/v1.4.0/toolchain/cmake)
    -- Zephyr version: 2.4.0 (D:/Users/craig/ncs/v1.4.0/zephyr)
    -- Found west (found suitable version "0.7.2", minimum required is "0.7.1")
    -- Board: nrf9160dk_nrf9160ns
    -- Cache files will be written to: D:/Users/craig/ncs/v1.4.0/zephyr/.cache
    -- Found dtc: D:/Users/craig/ncs/v1.4.0/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (D:/Users/craig/ncs/v1.4.0/toolchain/opt)
    -- Found BOARD.dts: D:/Users/craig/ncs/v1.4.0/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160ns.dts
    -- Found devicetree overlay: D:/Users/craig/ncs/v1.4.0/zephyr/boards/shields/ssd1306/ssd1306_128x32.overlay
    -- Found devicetree overlay: D:/nordicProjects/cfb/nrf9160dk_nrf9160ns.overlay
    Error: nrf9160dk_nrf9160ns.dts.pre.tmp:572.1-13 Label or path arduino_i2c not found
    FATAL ERROR: Syntax error parsing input tree
    CMake Error at D:/Users/craig/ncs/v1.4.0/zephyr/cmake/dts.cmake:213 (message):
    command failed with return code: 1
    Call Stack (most recent call first):
    D:/Users/craig/ncs/v1.4.0/zephyr/cmake/app/boilerplate.cmake:590 (include)
    D:/Users/craig/ncs/v1.4.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    D:/Users/craig/ncs/v1.4.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
    CMakeLists.txt:7 (find_package)


    -- Configuring incomplete, errors occurred!
    See also "D:/nordicProjects/cfb/build/CMakeFiles/CMakeOutput.log".
    See also "D:/nordicProjects/cfb/build/CMakeFiles/CMakeError.log".
    FAILED: build.ninja
    D:\Users\craig\ncs\v1.4.0\toolchain\opt\bin\cmake.exe -SD:\nordicProjects\cfb -BD:\nordicProjects\cfb\build
    ninja: error: rebuilding 'build.ninja': subcommand failed
    FATAL ERROR: command exited with status 1: 'D:\Users\craig\ncs\v1.4.0\toolchain\opt\bin\cmake.EXE' --build 'D:\nordicProjects\cfb\build'

  • Hi again!

    I see. I mixed the nRF9160DK and nRF52840DK. You can remove it from the CMakeLists.txt again and try the following overlay instead:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    &i2c2 {
    status = "ok";
    ssd1306@3c {
    compatible = "solomon,ssd1306fb";
    reg = <0x3c>;
    label = "SSD1306";
    width = <128>;
    height = <64>;
    segment-offset = <0>;
    page-offset = <0>;
    display-offset = <0>;
    segment-remap;
    com-invdir;
    prechargep = <0x22>;
    };
    };
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


    Best regards,
    Carl Richard

1 2