nrf52840dk not building with ssd1306 oled display

Having issues trying to use ssd1306 display with the nrf52840dk. When I try to use the lvgl sample code, I cannot make a build configuration (doesn't compile), although if I use the given code and build for a nrf5340, then everything works. 

In the steps it also mentioned this portion:

Edit: For nRF52832: Use compatible = "nordic,nrf-twi"; instead of compatible = "nordic,nrf-twim"; also remove the line zephyr,concat-buf-size = <4096>;

which I also tried but was unsuccessful building. 

I have looked online and tried to build the code I see in people's github repos but it also doesn't work(build). Maybe sometime with the newer sdk and toolchain? I am using v3.0.2, while most of the examples I see are from 2.8 or prior. My board target is nrf52840dk/nrf52840. 

here is the terminal output:

-- Generated zephyr.dts: /home/grammy/nrfProj/test_zephyr_oled/build/test_zephyr_oled/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /home/grammy/nrfProj/test_zephyr_oled/build/test_zephyr_oled/zephyr/include/generated/zephyr/devicetree_generated.h
-- Including generated dts.cmake file: /home/grammy/nrfProj/test_zephyr_oled/build/test_zephyr_oled/zephyr/dts.cmake

/home/grammy/nrfProj/test_zephyr_oled/prj.conf:16: warning: attempt to assign the value 'y' to the undefined symbol LV_MEM_CUSTOM

/home/grammy/nrfProj/test_zephyr_oled/prj.conf:19: warning: attempt to assign the value 'y' to the undefined symbol LV_USE_BTN

/home/grammy/nrfProj/test_zephyr_oled/prj.conf:21: warning: attempt to assign the value 'y' to the undefined symbol LV_USE_IMG

error: Aborting due to Kconfig warnings

Parsing /home/grammy/ncs/v3.0.2/zephyr/Kconfig
Loaded configuration '/home/grammy/ncs/v3.0.2/zephyr/boards/nordic/nrf52840dk/nrf52840dk_nrf52840_defconfig'
Merged configuration '/home/grammy/nrfProj/test_zephyr_oled/prj.conf'
Merged configuration '/home/grammy/nrfProj/test_zephyr_oled/build/test_zephyr_oled/zephyr/.config.sysbuild'
CMake Error at /home/grammy/ncs/v3.0.2/zephyr/cmake/modules/kconfig.cmake:396 (message):
command failed with return code: 1
Call Stack (most recent call first):
/home/grammy/ncs/v3.0.2/nrf/cmake/modules/kconfig.cmake:36 (include)
/home/grammy/ncs/v3.0.2/zephyr/cmake/modules/zephyr_default.cmake:133 (include)
/home/grammy/ncs/v3.0.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
/home/grammy/ncs/v3.0.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
CMakeLists.txt:3 (find_package)


-- Configuring incomplete, errors occurred!
CMake Error at cmake/modules/sysbuild_extensions.cmake:514 (message):
CMake configure failed for Zephyr project: test_zephyr_oled

Location: /home/grammy/nrfProj/test_zephyr_oled
Call Stack (most recent call first):
cmake/modules/sysbuild_images.cmake:43 (ExternalZephyrProject_Cmake)
cmake/modules/sysbuild_default.cmake:21 (include)
/home/grammy/ncs/v3.0.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:75 (include)
/home/grammy/ncs/v3.0.2/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
/home/grammy/ncs/v3.0.2/zephyr/share/sysbuild-package/cmake/SysbuildConfig.cmake:8 (include)
template/CMakeLists.txt:10 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/grammy/nrfProj/test_zephyr_oled/build/CMakeFiles/CMakeOutput.log".
FATAL ERROR: command exited with status 1: /home/grammy/ncs/toolchains/7cbc0036f4/usr/local/bin/cmake -DWEST_PYTHON=/home/grammy/ncs/toolchains/7cbc0036f4/usr/local/bin/python3.12 -B/home/grammy/nrfProj/test_zephyr_oled/build -GNinja -DBOARD=nrf52840dk/nrf52840 -DCONF_FILE=prj.conf -S/home/grammy/ncs/v3.0.2/zephyr/share/sysbuild -DAPP_DIR:PATH=/home/grammy/nrfProj/test_zephyr_oled

Parents
  • Hello,

    although if I use the given code and build for a nrf5340, then everything works. 

    I assume this is because the project only contains board files for the nRF5340 and nothing for any other boards. Could you share more about where you found the sample application? Is it from a Nordic sample repository or is it from a third party source showcasing how to interface with this specific display?

    I see that you're relatively new to nRF Connect SDK, so I also want to strongly recommend you to go through our academy courses, namely the fundamentals course at https://academy.nordicsemi.com/courses/nrf-connect-sdk-fundamentals/ and the intermediate course at https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/

    Let me know about the sample repo and I'll get back to you

    Kind regards,
    Andreas

  • I have just completed the fundamentals course and am starting the intermediate course. 

    I thought I linked it but I was following this tutorial:

     Printing to an I2C OLED display using nRF Connect SDK 

    the example used is zephyr/samples/subsys/display/lvgl

    Thank you for the response.

  • Great! 

    Aah, then I see that there might be quite a bit of porting work ahead. The guide you're basing your application on is from NCS 2.1.0, whereas you're currently working on the latest tagged release i.e NCS 3.0.1, but at the same time atleast the first part of the lesson is relatively straight forward

    I would recommend that you to some extent finish up the intermediate course as well to familiarize yourself better with "sysbuild" in lesson 8, which is the new project structure system we have after NCS 2.7.0 as well as hardware model 2 (basically just naming your board targets "nrf5340dk/nrf5340/cpuapp/ns" instead of "nrf5340dk_nrf5340_cpuapp_ns"). 

    In the fundamentals course you should've seen a lesson w.r.t board files and overlay files, which brings me to the reason for why you're successfull when compiling for the nrf5340 whereas you're unsuccessfull with the rest. The overlay file, which the course explains, simply modifies the boards existing devicetree file (.dts file), with modifications specific for this project only. For cases where you're using boards that are predefined within the SDK, such as a nRF based development kit, you can find the board files here: https://github.com/nrfconnect/sdk-zephyr/blob/main/boards/nordic/. Every DK that you build for will base their configuration on whats mentioned there, and the overlay will as mention modify that board for this specific build/project you're working on.

    Back to your project, you have an overlay thats specific for the nrf5340, i.e https://github.com/hx91/oled-ssd1306-lvgl/blob/main/part-1/nrf5340dk_nrf5340_cpuapp.overlay. The overlay file within either a <your_app>/boards repository or just within <your_app>/ will only be picked up if you're building for the board target you build for. If you only have the nrf5340dk_nrf5340_cpuapp.overlay available, it will only be picked up the nrf5340dk/nrf5340/cpuapp build target (not even for nrf5340dk/nrf5340/cpuapp/ns) it will be included.

    So to build it for the nrf52840dk/nrf52840, which you're using, you will have to add an overlay file for the nRF52840dk/nrf52840 specifying what peripheral to add (i.e to add the i2c communication) to the display you're working with. Then you will have to state which GPIOs this board will use, and you can freely select "any available/unused GPIO" on the DK. Note, that I emphasize "available/unused". Every DK has a set of GPIOs that are preoccupied and requires either hardware modifications or software modifications to use (or both), some of them are the UART that goes between the SoC and the debugger and the NFC pins. You can find a list of the GPIOS in the datasheet for the DK, and you can have a look at the back side of the DK to see what GPIOs are already in use.

    To summarize what you need to do to get this sample up and running for a different board using NCS 3.0.1

    1. Create a new overlay file with hardware model 2 and set up the I2C interface
    2. Update any deprecated APIs (I don't think there should be any since the project in part 1 is relatively small)
    3. If you wish to expand on it further with bootloaders and use the elements for lesson 8 and 9 in the intermediate course
    4. If you have any issues, use the knowledge from the debugging lesson in the intermediate course to do some preliminary debugging
    5. If you're curious about overlay files and devicetree, spend some time in the fundamentals and intermediate lessons containing overlay files as well as play around with the exercises showcasing various peripherals since all of them uses and modifies the board files in one way or another.

    I hope this is enough to get you going with porting this demo to the nrf52840dk and to a newer NCS version than the one used in the blogpost

    Kind regards,
    Andreas

Reply
  • Great! 

    Aah, then I see that there might be quite a bit of porting work ahead. The guide you're basing your application on is from NCS 2.1.0, whereas you're currently working on the latest tagged release i.e NCS 3.0.1, but at the same time atleast the first part of the lesson is relatively straight forward

    I would recommend that you to some extent finish up the intermediate course as well to familiarize yourself better with "sysbuild" in lesson 8, which is the new project structure system we have after NCS 2.7.0 as well as hardware model 2 (basically just naming your board targets "nrf5340dk/nrf5340/cpuapp/ns" instead of "nrf5340dk_nrf5340_cpuapp_ns"). 

    In the fundamentals course you should've seen a lesson w.r.t board files and overlay files, which brings me to the reason for why you're successfull when compiling for the nrf5340 whereas you're unsuccessfull with the rest. The overlay file, which the course explains, simply modifies the boards existing devicetree file (.dts file), with modifications specific for this project only. For cases where you're using boards that are predefined within the SDK, such as a nRF based development kit, you can find the board files here: https://github.com/nrfconnect/sdk-zephyr/blob/main/boards/nordic/. Every DK that you build for will base their configuration on whats mentioned there, and the overlay will as mention modify that board for this specific build/project you're working on.

    Back to your project, you have an overlay thats specific for the nrf5340, i.e https://github.com/hx91/oled-ssd1306-lvgl/blob/main/part-1/nrf5340dk_nrf5340_cpuapp.overlay. The overlay file within either a <your_app>/boards repository or just within <your_app>/ will only be picked up if you're building for the board target you build for. If you only have the nrf5340dk_nrf5340_cpuapp.overlay available, it will only be picked up the nrf5340dk/nrf5340/cpuapp build target (not even for nrf5340dk/nrf5340/cpuapp/ns) it will be included.

    So to build it for the nrf52840dk/nrf52840, which you're using, you will have to add an overlay file for the nRF52840dk/nrf52840 specifying what peripheral to add (i.e to add the i2c communication) to the display you're working with. Then you will have to state which GPIOs this board will use, and you can freely select "any available/unused GPIO" on the DK. Note, that I emphasize "available/unused". Every DK has a set of GPIOs that are preoccupied and requires either hardware modifications or software modifications to use (or both), some of them are the UART that goes between the SoC and the debugger and the NFC pins. You can find a list of the GPIOS in the datasheet for the DK, and you can have a look at the back side of the DK to see what GPIOs are already in use.

    To summarize what you need to do to get this sample up and running for a different board using NCS 3.0.1

    1. Create a new overlay file with hardware model 2 and set up the I2C interface
    2. Update any deprecated APIs (I don't think there should be any since the project in part 1 is relatively small)
    3. If you wish to expand on it further with bootloaders and use the elements for lesson 8 and 9 in the intermediate course
    4. If you have any issues, use the knowledge from the debugging lesson in the intermediate course to do some preliminary debugging
    5. If you're curious about overlay files and devicetree, spend some time in the fundamentals and intermediate lessons containing overlay files as well as play around with the exercises showcasing various peripherals since all of them uses and modifies the board files in one way or another.

    I hope this is enough to get you going with porting this demo to the nrf52840dk and to a newer NCS version than the one used in the blogpost

    Kind regards,
    Andreas

Children
No Data
Related