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 Hakon,

    Yes, every item is ticked. I did receive notifications in the past, the last one back in January 19 2021. I also received two more on Feb 16 2021 after a password reset request.

    Kind regards

    Mohamed

  • Hi Mohamed,

     

    My apologies for this. Im currently checking with the site administrators to see if we can figure this out.

     

    Kind regards,

    Håkon

  • Hi Hakon,

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

    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.

    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

Reply Children
  • 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

  • Good morning Hakon,

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

    Although I did report seeing the temperature values printed on the App Core side, I don't see them this morning. The App Core boots up and all I can see in SES Terminal Emulator is this message,

    *** Booting Zephyr OS build v2.4.99-ncs1-rc1 ***
    App Core

    In fact, I remember now, I had the same problem yesterday at first then after I open Segger RTT Viewer suddenly the App Core application started printing the temperature values. Please answer the following questions about this example.

    Q1/ Is this the expected behaviour?

    Q2/ What is this line doing? It seems to kick start the communication between App and Net Cores. 

           uint32_t ret = ipm_send(ipm_tx_handle, 1, 0, NULL, 0);

    Q3/ I expected to see both the message "TX ID <id>" and "RX ID <id>" but I don't, I only this "RX ID 0"

    Q3/ Please explain the chronological sequence of events that is taking place between the App Core and the Net core.

    Thank you for your support.

    Kind regards

    Mohamed

  • Hi Hakon,

    While waiting for your response to my previous reply where I asked you four questions I went back to my application (App Core) where I implemented the die temperature software based on your example. I am now unable to load the project in SES (File >  Open nRF Connect SDK Project...). I am getting this error,

    Cannot create project

    create_nordic_project.py failed(1)

    I am attaching a screen capture of the nRF Connect Options selected.

    Note, I am selecting the board nrf5340pdk_nrf5340_cpuapp for the App Core application. However, I've noticed in you very first response to my question you mentioned this

    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:

    Fullscreen
    1
    CONFIG_BOARD_ENABLE_CPUNET=y
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

     

    Must I include the above config line in my App Core project? Note, this line is not present in the project  file prj.conf of your App Core example.

    Another windge about DevZone, I cannot edit some of my responses.

    Kind regards

    Mohamed

  • Hi Hakon,

    I forgot to include details of the error I am getting in SES. Here it is 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:710.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:14 (find_package)

    error: cmake failed
    create_nordic_project.py failed (1)

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

    Yes, I confirm my overlay file nrf5340pdk_nrf5340_cpuapp.overlay does contain  the "temp", because your blinky example appcore overlay file also contains it. The only difference I called my overlay file *_cpuapp.overlay while you called yours *_cpunet.overlay. Why and what is the significance of the naming convention?

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

    The TEMP peripheral is only available on the network core.

    But in the example you sent me, in the blinky_appcore project you have an overlay file called nrf5340pdk_nrf5340_cpunet.overlay and contains "temp" which suggests that board nrf5340pdk does have a temp component. In fact your example ran, read and printed temperature values.

    Why is the appcore overlay file labelled "cpunet" when it is on the appcore?

     

    Kind regards

    Mohamed

  • Hi, 

     

    Learner said:
    Yes, I confirm my overlay file nrf5340pdk_nrf5340_cpuapp.overlay does contain  the "temp", because your blinky example appcore overlay file also contains it. The only difference I called my overlay file *_cpuapp.overlay while you called yours *_cpunet.overlay. Why and what is the significance of the naming convention?

    the project will only pick up the overlay file if it matches the board you've selected.

    You can have several other .overlay files, but they will not be picked up unless you either specify them explicitly or that they match the same board as you configure for.

     

    Example: If you configure the project for board nrf52840dk_nrf52840, it will look for "nrf52840dk_nrf52840.overlay".

     

    Learner said:
    But in the example you sent me, in the blinky_appcore project you have an overlay file called nrf5340pdk_nrf5340_cpunet.overlay and contains "temp" which suggests that board nrf5340pdk does have a temp component. In fact your example ran, read and printed temperature values.

    I should have deleted that file from that specific folder to avoid confusion, my apologies. That file was not included when you configured for nrf5340pdk_nrf5340_cpuapp, as it does not match the current board you were selecting. If you look at the product specification, the application core does not have access to the temp peripheral.

     

    Kind regards,

    Håkon 

Related