This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Zephyr API to read the nRF5340 die temperature

Hello,

I am looking for some some nRF5340 example code that reads the nRF5340 die temperature using zephyr APIs.

I've looked at previous posts but I could only find this one https://devzone.nordicsemi.com/f/nordic-q-a/56171/how-to-get-die-temperature-on-nrf52832-using-zephyr from 10 months ago that stated none existed. I am hoping someone, somewhere musty have done something similar.

Thank you.

Kind regards

Parents
  • Hi,

     

    The temp peripheral is only accessible on the network core:

    https://infocenter.nordicsemi.com/topic/ps_nrf5340/temp.html?cp=3_0_0_6_33

    So we need to configure the board nrf5340pdk_nrf5340_cpunet, but since the network core is started from the app cpu, you first need to have something on the app core running with this config set:

    CONFIG_BOARD_ENABLE_CPUNET=y

     

    I used sample/nrf5340/empty_app_core.

     

    For uart output from the network core, connect P0.25 to P0.20.

    If you also need UART RXD, connect P0.26 to P0.22.

     

    Here's an example that shows how to use the NRF_TEMP peripheral: 

    0677.nrf_temp_sample.zip

     

    Kind regards,

    Håkon

  • Hi Hakon,

    I have built and run the project that reads the die temperature. I can see the see the temperature values going up and down as I heat and cool the device. However, I am still not clear how to read these values from the network core into my application. 

    Please advise.

    Kind regards

    Mohamed

  • Hi Mohamed,

     

    Learner said:

    I have received a notification about your previous reply. Have you made any changes on your side? Anyway, Notifications are working now.

    I am glad to hear that the notifications are now working!

     

    Learner said:
    I still have not had a chance to try your proposed die temperature solution. While waiting for your response I started another task and I need to complete it before I can go back to the die temperature. I will probably look at it sometimes tomorrow.

    No worries. If you run into any issues, please let us know.

     

    Cheers,

    Håkon 

  • Hi Hakon,

    I am back on the die temperature example now.

    What are the two folders blinky_send and blinky_temp for?

    I can see only a build folder in each.

    Kind regards

    Mohamed

  • Hi Hakon,

    I have implemented the changes in my project as per your example but I am unable to load my project in SES. Below in blue is the error I am getting. Note, I am using SES v5.34a and NCS v1.5.0-rc1.

    --------------------------------------------------------------------------------------------------------------------

    My CMakeLists.txt file looks like this,

    #
    # Copyright (c) 2020 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
    #

    cmake_minimum_required(VERSION 3.8.2)

    set(NRF_SUPPORTED_BOARDS
    nrf5340pdk_nrf5340_cpuapp
    )

    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(empty_app_core)

    FILE(GLOB app_sources src/*.c src/radio/*.c src/lr1110_driver-master/*.c src/crypto/*.c src/adc/*.c src/timer/*.c src/mcu_temp/*.c)
    #FILE(GLOB app_sources src/radio/*.c)
    target_sources(app PRIVATE ${app_sources})
    #target_sources(app PRIVATE src/radio/*.c)
    #arget_sources(app PRIVATE src/*.c)
    #target_sources(app PRIVATE src/lr1110_driver-master/lr1110_driver_version.c)

    --------------------------------------------------------------------------------------------------------------------

    My project file prj.conf looks like this,

    #
    # Copyright (c) 2020 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
    #

    ### Logging ####
    # For the PID 4 hardware we must set CONFIG_SERIAL=n because otherwise the SPI CS/BUSY
    # pins will be allocated to UART0 CTS/RTS pins.
    CONFIG_SERIAL=n
    CONFIG_LOG=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    #CONFIG_UART_CONSOLE=n
    CONFIG_DEBUG_OPTIMIZATIONS=y

    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    CONFIG_PRINTK=y

    # This will be needed when using to NCS v1.40 or higher, #ifdef ZEPHYR_V_1_50
    CONFIG_DEPRECATED_ZEPHYR_INT_TYPES=y

    ### NETWORK core ###
    # needed when measuring the SoC die temperature
    #CONFIG_BOARD_ENABLE_CPUNET=n

    ### GPIOs ###
    CONFIG_GPIO=y

    # ADC
    CONFIG_ADC=y
    # No need for this as it is alresdy enabled by default in ...\adc\Kconfig.nrfx
    #CONFIG_ADC_NRF5_SAADC = y

    ### SPI ###
    CONFIG_SPI=y
    #CONFIG_SPI_ASYNC=y
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_SPI_1=y

    ### TEMPERATURE SENSOR ###
    #CONFIG_BOARD_ENABLE_CPUNET=y
    #CONFIG_SENSOR=y
    #CONFIG_TEMP_NRF5=y
    ### IPC stuff ###
    CONFIG_IPM=y
    CONFIG_IPM_NRFX=y
    CONFIG_IPM_MSG_CH_0_ENABLE=y
    CONFIG_IPM_MSG_CH_0_TX=y
    CONFIG_IPM_MSG_CH_1_ENABLE=y
    CONFIG_IPM_MSG_CH_1_RX=y
    # CONFIG_NRF_RPC=y

    ### I2C ###
    #CONFIG_LIS2DE12=y
    #CONFIG_I2C_1=y

    ### RTC ###
    # The RTC on nRF5340 is not really an Real Time Clock but it's a real time counter.
    # Timers will be used instead.
    #CONFIG_COUNTER_NRFX_RTC0=y

    ### RANDOM NUMBER GENERATION ###
    CONFIG_TIMER_RANDOM_GENERATOR=n
    CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR=n
    CONFIG_XOROSHIRO_RANDOM_GENERATOR=n
    # Cryptographically secure random number generators
    CONFIG_HARDWARE_DEVICE_CS_GENERATOR=n
    CONFIG_CTR_DRBG_CSPRNG_GENERATOR=n
    #CONFIG_CS_CTR_DRBG_PERSONALIZATION=n

    --------------------------------------------------------------------------------------------------------------------

    while my overlay file nrf5340pdk_nrf5340_cpunet.overlay looks like this,

    // SEGGER Embedded Studio auto generated

    /// {
    // chosen {
    /*
    * In some default configurations within the nRF Connect SDK,
    * e.g. on nRF52840 and nRF9160, the chosen zephyr,entropy node
    * is &cryptocell. This devicetree overlay ensures that default
    * is overridden wherever it is set, as this application uses
    * the RNG node for entropy exclusively.
    */
    // zephyr,entropy = &rng;
    // };
    //};

    &temp {
    compatible = "nordic,nrf-temp";
    status = "okay";
    };

    //&led0 { gpios = < &gpio1 9 GPIO_ACTIVE_LOW >; };

    // nRF5340PDK board
    //&spi1 {
    // cs-gpios = <&gpio1 9 0>;
    //
    // compatible = "nordic,nrf-spim";
    // status = "okay";
    // sck-pin = < 47 >;
    // mosi-pin = < 45 >;
    // miso-pin = < 46 >;
    //};

    // PID-4 board
    &spi1 {
    cs-gpios = <&gpio0 19 0>;

    compatible = "nordic,nrf-spim";
    status = "okay";
    sck-pin = < 13 >;
    mosi-pin = < 9 >;
    miso-pin = < 40 >;
    };

    / {
    aliases {
    //Didn't work with alias spi-1=&spi1 as defined in dts\...\nrf5340_cpuapp.dtsi and build\zephyr.dts;
    spi1 = &spi1;
    };
    };

    --------------------------------------------------------------------------------------------------------------------

    Creating solution spi_test_LR1110-2-TX-RX-CMAC-AES.emProject

    C:/Zypher/v1.5.0-rc1/toolchain/opt/bin/cmake.exe -GNinja -DBOARD=nrf5340pdk_nrf5340_cpuapp -DBOARD_DIR=C:\Zypher\v1.5.0-rc1\zephyr\boards\arm\nrf5340dk_nrf5340 -BC:\Dev\PID-4\spi_test_LR1110-2-TX-RX-CMAC-AES\build_nrf5340pdk_nrf5340_cpu_net -SC:\Dev\PID-4\spi_test_LR1110-2-TX-RX-CMAC-AES -DNCS_TOOLCHAIN_VERSION=1.5.0 -DEXTRA_KCONFIG_TARGETS=menuconfig_ses -DEXTRA_KCONFIG_TARGET_COMMAND_FOR_menuconfig_ses=C:\Zypher\v1.5.0-rc1\toolchain\segger_embedded_studio/html/configure_nordic_project_menuconfig.py
    -- Application: C:/Dev/PID-4/spi_test_LR1110-2-TX-RX-CMAC-AES
    -- Zephyr version: 2.4.99 (C:/Zypher/v1.5.0-rc1/zephyr)
    -- Found Python3: C:/Zypher/v1.5.0-rc1/toolchain/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
    -- Found west (found suitable version "0.9.0", minimum required is "0.7.1")
    -- Board: nrf5340pdk_nrf5340_cpuapp
    -- Cache files will be written to: C:/Zypher/v1.5.0-rc1/zephyr/.cache
    -- Found dtc: C:/Zypher/v1.5.0-rc1/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (C:/Zypher/v1.5.0-rc1/toolchain/opt)
    -- Found BOARD.dts: C:/Zypher/v1.5.0-rc1/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340pdk_nrf5340_cpuapp.dts
    -- Generated zephyr.dts: C:/Dev/PID-4/spi_test_LR1110-2-TX-RX-CMAC-AES/build_nrf5340pdk_nrf5340_cpu_net/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: C:/Dev/PID-4/spi_test_LR1110-2-TX-RX-CMAC-AES/build_nrf5340pdk_nrf5340_cpu_net/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: C:/Dev/PID-4/spi_test_LR1110-2-TX-RX-CMAC-AES/build_nrf5340pdk_nrf5340_cpu_net/zephyr/include/generated/device_extern.h
    Parsing C:/Zypher/v1.5.0-rc1/zephyr/Kconfig
    Loaded configuration 'C:/Zypher/v1.5.0-rc1/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340pdk_nrf5340_cpuapp_defconfig'
    Merged configuration 'C:/Dev/PID-4/spi_test_LR1110-2-TX-RX-CMAC-AES/prj.conf'
    Configuration saved to 'C:/Dev/PID-4/spi_test_LR1110-2-TX-RX-CMAC-AES/build_nrf5340pdk_nrf5340_cpu_net/zephyr/.config'
    Kconfig header saved to 'C:/Dev/PID-4/spi_test_LR1110-2-TX-RX-CMAC-AES/build_nrf5340pdk_nrf5340_cpu_net/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 9.2.1
    -- The CXX compiler identification is GNU 9.2.1
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/Zypher/v1.5.0-rc1/toolchain/opt/bin/arm-none-eabi-gcc.exe
    -- Configuring done
    Including boilerplate (Zephyr base): C:/Zypher/v1.5.0-rc1/zephyr/cmake/app/boilerplate.cmake
    -- Using NCS Toolchain 1.5.0 for building. (C:/Zypher/v1.5.0-rc1/toolchain/cmake)

    warning: UART_CONSOLE (defined at drivers/console/Kconfig:47) was assigned the value 'y' but got the
    value 'n'. Check these unsatisfied dependencies: SERIAL (=n), SERIAL_HAS_DRIVER (=n). See
    docs.zephyrproject.org/.../CONFIG_UART_CONSOLE.html and/or look up
    UART_CONSOLE in the menuconfig/guiconfig interface. The Application Development Primer, Setting
    Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
    too.

    CMake Warning at C:/Zypher/v1.5.0-rc1/zephyr/CMakeLists.txt:1354 (message):

    WARNING: The board 'nrf5340pdk_nrf5340_cpuapp' is deprecated and will be
    removed in version v2.6.0


    CMake Error at C:/Zypher/v1.5.0-rc1/zephyr/cmake/extensions.cmake:416 (add_library):
    No SOURCES given to target: drivers__spi
    Call Stack (most recent call first):
    C:/Zypher/v1.5.0-rc1/zephyr/cmake/extensions.cmake:393 (zephyr_library_named)
    C:/Zypher/v1.5.0-rc1/zephyr/drivers/spi/CMakeLists.txt:3 (zephyr_library)


    CMake Generate step failed. Build files cannot be regenerated correctly.

    error: cmake failed
    create_nordic_project.py failed (1)

    Kind regards

    Mohamed

  • Hi,

     

    Learner said:
    What are the two folders blinky_send and blinky_temp for?

    Those should have been deleted, as the project name wasn't descriptive from my side. My apologies for this.

     

    You should use blinky_netcore_temp (nrf5340pdk_nrf5340_cpunet) and blinky_appcore.

    Were you able to run these successfully and fetch the temperature data from one core to the other?

     

    You are getting an error wrt. spi sources. Could you try adding "CONFIG_NRFX_SPIM1=y" to see if it compiles then?

    You are also setting the overlay by aliasing it to itself. Try just keeping it as-is without the alias.

      

    Kind regards,

    Håkon

  • Thank you Hakon.

    For some reason I could not reply to your latest response. The fields "Reply"  "Verify Answer"   "More"  are not showing. So, I am replying to you from one of your earlier responses.

    Were you able to run these successfully and fetch the temperature data from one core to the other?

    Yes, I can read the temperature values in the Terminal Emulator window in SES.

    You are getting an error wrt. spi sources. Could you try adding "CONFIG_NRFX_SPIM1=y" to see if it compiles then?

    You are also setting the overlay by aliasing it to itself. Try just keeping it as-is without the alias.

    I applied both suggestions but the problem remains. Note, my overlay file worked fine even with the spi1 alias before I added this,

    &temp {
    compatible = "nordic,nrf-temp", "nordic,nrf-spim";
    status = "okay";
    };

    I think I found what I was doing wrong, I was selecting the wrong board for my application. I was selecting nrf5340pdk_nrf5340_cpunet instead of nrf5340pdk_nrf5340_cpuapp.

    My application project is loading successfully now but I am getting this build error. Any suggestion?

    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:208:32: error: 'DT_N_ALIAS_spi1_P_cs_gpios_IDX_0_PH_P_label' undeclared (first use in this function)
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:2176:24: note: in definition of macro 'DT_CAT'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:103:2: note: in expansion of macro 'DT_PROP'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:463:32: note: in expansion of macro 'DT_CAT'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:1095:2: note: in expansion of macro 'DT_PROP'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:54:2: note: in expansion of macro 'DT_PHANDLE_BY_IDX'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:103:10: note: in expansion of macro 'DT_GPIO_CTLR_BY_IDX'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:114:2: note: in expansion of macro 'DT_GPIO_LABEL_BY_IDX'
    5> ../src/radio/pid4_radio.h:261:29: note: in expansion of macro 'DT_GPIO_LABEL'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:208:25: note: in expansion of macro 'DT_CAT'
    5> ../src/radio/pid4_radio.h:259:29: note: in expansion of macro 'DT_ALIAS'
    5> ../src/radio/pid4_radio.h:261:43: note: in expansion of macro 'SPI_1_NODE'
    5> ../src/radio/pid4_radio.c:203:43: note: in expansion of macro 'SPI_1_CS'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:208:32: note: each undeclared identifier is reported only once for each function it appears in
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:2176:24: note: in definition of macro 'DT_CAT'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:103:2: note: in expansion of macro 'DT_PROP'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:463:32: note: in expansion of macro 'DT_CAT'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:1095:2: note: in expansion of macro 'DT_PROP'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:54:2: note: in expansion of macro 'DT_PHANDLE_BY_IDX'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:103:10: note: in expansion of macro 'DT_GPIO_CTLR_BY_IDX'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:114:2: note: in expansion of macro 'DT_GPIO_LABEL_BY_IDX'
    5> ../src/radio/pid4_radio.h:261:29: note: in expansion of macro 'DT_GPIO_LABEL'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:208:25: note: in expansion of macro 'DT_CAT'
    5> ../src/radio/pid4_radio.h:259:29: note: in expansion of macro 'DT_ALIAS'
    5> ../src/radio/pid4_radio.h:261:43: note: in expansion of macro 'SPI_1_NODE'
    5> ../src/radio/pid4_radio.c:203:43: note: in expansion of macro 'SPI_1_CS'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:208:32: error: 'DT_N_ALIAS_spi1_P_cs_gpios_IDX_0_VAL_pin' undeclared (first use in this function)
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:2176:24: note: in definition of macro 'DT_CAT'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:898:2: note: in expansion of macro 'DT_PROP'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:158:2: note: in expansion of macro 'DT_PHA_BY_IDX'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:169:2: note: in expansion of macro 'DT_GPIO_PIN_BY_IDX'
    5> ../src/radio/pid4_radio.h:262:29: note: in expansion of macro 'DT_GPIO_PIN'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:208:25: note: in expansion of macro 'DT_CAT'
    5> ../src/radio/pid4_radio.h:259:29: note: in expansion of macro 'DT_ALIAS'
    5> ../src/radio/pid4_radio.h:262:41: note: in expansion of macro 'SPI_1_NODE'
    5> ../src/radio/pid4_radio.c:208:27: note: in expansion of macro 'SPI_1_CS_PIN'

    Kind regards

    Mohamed

Reply
  • Thank you Hakon.

    For some reason I could not reply to your latest response. The fields "Reply"  "Verify Answer"   "More"  are not showing. So, I am replying to you from one of your earlier responses.

    Were you able to run these successfully and fetch the temperature data from one core to the other?

    Yes, I can read the temperature values in the Terminal Emulator window in SES.

    You are getting an error wrt. spi sources. Could you try adding "CONFIG_NRFX_SPIM1=y" to see if it compiles then?

    You are also setting the overlay by aliasing it to itself. Try just keeping it as-is without the alias.

    I applied both suggestions but the problem remains. Note, my overlay file worked fine even with the spi1 alias before I added this,

    &temp {
    compatible = "nordic,nrf-temp", "nordic,nrf-spim";
    status = "okay";
    };

    I think I found what I was doing wrong, I was selecting the wrong board for my application. I was selecting nrf5340pdk_nrf5340_cpunet instead of nrf5340pdk_nrf5340_cpuapp.

    My application project is loading successfully now but I am getting this build error. Any suggestion?

    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:208:32: error: 'DT_N_ALIAS_spi1_P_cs_gpios_IDX_0_PH_P_label' undeclared (first use in this function)
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:2176:24: note: in definition of macro 'DT_CAT'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:103:2: note: in expansion of macro 'DT_PROP'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:463:32: note: in expansion of macro 'DT_CAT'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:1095:2: note: in expansion of macro 'DT_PROP'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:54:2: note: in expansion of macro 'DT_PHANDLE_BY_IDX'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:103:10: note: in expansion of macro 'DT_GPIO_CTLR_BY_IDX'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:114:2: note: in expansion of macro 'DT_GPIO_LABEL_BY_IDX'
    5> ../src/radio/pid4_radio.h:261:29: note: in expansion of macro 'DT_GPIO_LABEL'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:208:25: note: in expansion of macro 'DT_CAT'
    5> ../src/radio/pid4_radio.h:259:29: note: in expansion of macro 'DT_ALIAS'
    5> ../src/radio/pid4_radio.h:261:43: note: in expansion of macro 'SPI_1_NODE'
    5> ../src/radio/pid4_radio.c:203:43: note: in expansion of macro 'SPI_1_CS'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:208:32: note: each undeclared identifier is reported only once for each function it appears in
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:2176:24: note: in definition of macro 'DT_CAT'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:103:2: note: in expansion of macro 'DT_PROP'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:463:32: note: in expansion of macro 'DT_CAT'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:1095:2: note: in expansion of macro 'DT_PROP'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:54:2: note: in expansion of macro 'DT_PHANDLE_BY_IDX'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:103:10: note: in expansion of macro 'DT_GPIO_CTLR_BY_IDX'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:114:2: note: in expansion of macro 'DT_GPIO_LABEL_BY_IDX'
    5> ../src/radio/pid4_radio.h:261:29: note: in expansion of macro 'DT_GPIO_LABEL'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:208:25: note: in expansion of macro 'DT_CAT'
    5> ../src/radio/pid4_radio.h:259:29: note: in expansion of macro 'DT_ALIAS'
    5> ../src/radio/pid4_radio.h:261:43: note: in expansion of macro 'SPI_1_NODE'
    5> ../src/radio/pid4_radio.c:203:43: note: in expansion of macro 'SPI_1_CS'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:208:32: error: 'DT_N_ALIAS_spi1_P_cs_gpios_IDX_0_VAL_pin' undeclared (first use in this function)
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:2176:24: note: in definition of macro 'DT_CAT'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:898:2: note: in expansion of macro 'DT_PROP'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:158:2: note: in expansion of macro 'DT_PHA_BY_IDX'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree/gpio.h:169:2: note: in expansion of macro 'DT_GPIO_PIN_BY_IDX'
    5> ../src/radio/pid4_radio.h:262:29: note: in expansion of macro 'DT_GPIO_PIN'
    5> C:/Zypher/v1.5.0-rc1/zephyr/include/devicetree.h:208:25: note: in expansion of macro 'DT_CAT'
    5> ../src/radio/pid4_radio.h:259:29: note: in expansion of macro 'DT_ALIAS'
    5> ../src/radio/pid4_radio.h:262:41: note: in expansion of macro 'SPI_1_NODE'
    5> ../src/radio/pid4_radio.c:208:27: note: in expansion of macro 'SPI_1_CS_PIN'

    Kind regards

    Mohamed

Children
  • Hi,

     

    Learner said:
    &temp {
    compatible = "nordic,nrf-temp", "nordic,nrf-spim";
    status = "okay";
    };

    The temp peripheral cannot be compatible with several hardware peripherals.

    If you need to use an SPI, you should declare it like this:

    &spiX
    {
        status = "okay";
        rest-of-config;
    };

     

    It seems that you are configuring for the network core. You should look into the peripherals available on the network core:

    https://infocenter.nordicsemi.com/topic/ps_nrf5340/chapters/memory.network/netmem.html?cp=3_0_0_5_2_0#net_instantiation

     

    For SPI, you should use "spi0". Note that SPIM0 is a shared peripheral, with other bus peripherals; meaning only one of SPI*0, TWI*0 can be enabled simultaneously:

    https://infocenter.nordicsemi.com/topic/ps_nrf5340/peripheral_interface.html?cp=3_0_0_6_0_1#concept_shared_id

     

    Kind regards,

    Håkon

  • Good morning Hakon,

    Thank you.

    Please look at my last two previous posts and answer my questions there. Ignore the older questions.

    I have changed my overlay file and it now looks like this,

    // SEGGER Embedded Studio auto generated

    &spi0 {
    status = "okay";
    cs-gpios = <&gpio0 19 0>;
    sck-pin = < 13 >;
    mosi-pin = < 9 >;
    miso-pin = < 40 >;
    };

    &temp {
    compatible = "nordic,nrf-temp";
    status = "okay";
    };

    But I am still getting the same error when I try to load the project. See below.

    Creating solution spi_test_LR1110-2-TX-RX-CMAC-AES.emProject
    C:/Zypher/v1.5.0-rc1/toolchain/opt/bin/cmake.exe -GNinja -DBOARD=nrf5340pdk_nrf5340_cpuapp -DBOARD_DIR=C:\Zypher\v1.5.0-rc1\zephyr\boards\arm\nrf5340dk_nrf5340 -BC:\Dev\PID-4\spi_test_LR1110-2-TX-RX-CMAC-AES\build_nrf5340pdk_nrf5340_cpuapp_Zypher_v1.50rc1_temp -SC:\Dev\PID-4\spi_test_LR1110-2-TX-RX-CMAC-AES -DNCS_TOOLCHAIN_VERSION=1.5.0 -DDTC_OVERLAY_FILE=C:\Dev\PID-4\spi_test_LR1110-2-TX-RX-CMAC-AES/nrf5340pdk_nrf5340_cpuapp.overlay -DEXTRA_KCONFIG_TARGETS=menuconfig_ses -DEXTRA_KCONFIG_TARGET_COMMAND_FOR_menuconfig_ses=C:\Zypher\v1.5.0-rc1\toolchain\segger_embedded_studio/html/configure_nordic_project_menuconfig.py
    -- Application: C:/Dev/PID-4/spi_test_LR1110-2-TX-RX-CMAC-AES
    -- Zephyr version: 2.4.99 (C:/Zypher/v1.5.0-rc1/zephyr)
    -- Found Python3: C:/Zypher/v1.5.0-rc1/toolchain/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
    -- Found west (found suitable version "0.9.0", minimum required is "0.7.1")
    -- Board: nrf5340pdk_nrf5340_cpuapp
    -- Cache files will be written to: C:/Zypher/v1.5.0-rc1/zephyr/.cache
    -- Found dtc: C:/Zypher/v1.5.0-rc1/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (C:/Zypher/v1.5.0-rc1/toolchain/opt)
    -- Found BOARD.dts: C:/Zypher/v1.5.0-rc1/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340pdk_nrf5340_cpuapp.dts
    -- Found devicetree overlay: C:/Dev/PID-4/spi_test_LR1110-2-TX-RX-CMAC-AES/nrf5340pdk_nrf5340_cpuapp.overlay
    -- Configuring incomplete, errors occurred!
    Including boilerplate (Zephyr base): C:/Zypher/v1.5.0-rc1/zephyr/cmake/app/boilerplate.cmake
    -- Using NCS Toolchain 1.5.0 for building. (C:/Zypher/v1.5.0-rc1/toolchain/cmake)
    Error: nrf5340pdk_nrf5340_cpuapp.dts.pre.tmp:704.1-6 Label or path temp not found
    FATAL ERROR: Syntax error parsing input tree
    CMake Error at C:/Zypher/v1.5.0-rc1/zephyr/cmake/dts.cmake:205 (message):
    command failed with return code: 1
    Call Stack (most recent call first):
    C:/Zypher/v1.5.0-rc1/zephyr/cmake/app/boilerplate.cmake:533 (include)
    C:/Zypher/v1.5.0-rc1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    C:/Zypher/v1.5.0-rc1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
    CMakeLists.txt:15 (find_package)

    error: cmake failed
    create_nordic_project.py failed (1)

    I have been struggling with this problem for days, I hope you will be able to identify what I am doing wrong.

    It seems that you are configuring for the network core. You should look into the peripherals available on the network core:

    I am not sure why you are saying I am configuring for the network. This is how my prj.conf file looks, all lines referring to the Network core are commented out.

    #
    # Copyright (c) 2020 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
    #

    ### Logging ####
    # For the PID 4 hardware we must set CONFIG_SERIAL=n because otherwise the SPI CS/BUSY
    # pins will be allocated to UART0 CTS/RTS pins.
    CONFIG_SERIAL=n
    CONFIG_LOG=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    #CONFIG_UART_CONSOLE=n
    CONFIG_DEBUG_OPTIMIZATIONS=y

    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    CONFIG_PRINTK=y

    # This will be needed when using to NCS v1.40 or higher, #ifdef ZEPHYR_V_1_50
    CONFIG_DEPRECATED_ZEPHYR_INT_TYPES=y

    ### NETWORK core ###
    # needed when measuring the SoC die temperature
    #!!!CONFIG_BOARD_ENABLE_CPUNET=n

    ### GPIOs ###
    CONFIG_GPIO=y

    # ADC
    CONFIG_ADC=y
    # No need for this as it is already enabled by default in ...\adc\Kconfig.nrfx
    #CONFIG_ADC_NRF5_SAADC = y

    ### SPI ###
    CONFIG_SPI=y
    #CONFIG_SPI_ASYNC=y
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_SPI_1=y
    #!!!CONFIG_NRFX_SPIM1=y

    ### TEMPERATURE SENSOR ###
    #CONFIG_BOARD_ENABLE_CPUNET=y
    #CONFIG_SENSOR=y
    #CONFIG_TEMP_NRF5=y
    ### IPC stuff ###
    CONFIG_IPM=y
    CONFIG_IPM_NRFX=y
    CONFIG_IPM_MSG_CH_0_ENABLE=y
    CONFIG_IPM_MSG_CH_0_TX=y
    CONFIG_IPM_MSG_CH_1_ENABLE=y
    CONFIG_IPM_MSG_CH_1_RX=y
    # CONFIG_NRF_RPC=y

    ### I2C ###
    #CONFIG_LIS2DE12=y
    #CONFIG_I2C_1=y

    ### RTC ###
    # The RTC on nRF5340 is not really an Real Time Clock but it's a real time counter.
    # Timers will be used instead.
    #CONFIG_COUNTER_NRFX_RTC0=y

    ### RANDOM NUMBER GENERATION ###
    CONFIG_TIMER_RANDOM_GENERATOR=n
    CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR=n
    CONFIG_XOROSHIRO_RANDOM_GENERATOR=n
    # Cryptographically secure random number generators
    CONFIG_HARDWARE_DEVICE_CS_GENERATOR=n
    CONFIG_CTR_DRBG_CSPRNG_GENERATOR=n
    #CONFIG_CS_CTR_DRBG_PERSONALIZATION=n

    I also replaced the config line CONFIG_SPI_1=y with CONFIG_SPI_0=y and I got the same error.

    For SPI, you should use "spi0". Note that SPIM0 is a shared peripheral, with other bus peripherals; meaning only one of SPI*0, TWI*0 can be enabled simultaneously:

    I am not I understand why I have to switch to using spi0 and not stick with spi1. Please explain.

    Thank you for your continued support.

    Kind regards

    Mohamed

  • Hi Mohamed,

     

    Learner said:
    &temp {
    compatible = "nordic,nrf-temp";
    status = "okay";
    };
    Learner said:
    -- Board: nrf5340pdk_nrf5340_cpuapp

    Could you confirm if the nrf5340pdk_nrf5340_cpuapp.overlay contains "temp"?

    The TEMP peripheral is only available on the network core. The reason why you are getting an error is because for this specific board, there is no "temp" component.  

     

    Kind regards,

    Håkon

Related