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,

    The F5 refresh trick used to work for me but not anymore.

    The "Reply", "Verify Answer" and "More" buttons do appear after some responses but not other. For instance, I can reply to this latest response of yours but not recent previous ones. It is bizarre.

    By the way I managed to get the MCU die temperature to work but with some anomalies similar to What I reported three days ago when I ran your example. In fact someone else Devin Li reported similar problems. Was I  meant to receive his response?

    Could you please answer these four questions that I asked 3 days ago.

    Q1/ Why is it that the App core does not start getting temperature readings until the Segger J-Link RTT viewer is connected?

    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.

    Kind regards

    Mohamed

  • Hi Mohamed,

     

    Learner said:
    The "Reply", "Verify Answer" and "More" buttons do appear after some responses but not other. For instance, I can reply to this latest response of yours but not recent previous ones. It is bizarre.

    This is strange. I'll let the web admins know about this.

     

     

    Learner said:

    By the way I managed to get the MCU die temperature to work but with some anomalies similar to What I reported three days ago when I ran your example. In fact someone else Devin Li reported similar problems. Was I  meant to receive his response?

    Could you please answer these four questions that I asked 3 days ago.

    Q1/ Why is it that the App core does not start getting temperature readings until the Segger J-Link RTT viewer is connected?

     Oh! I had a setting that I forgot to add to the prj.conf in the blinky_appcore/prj.conf:

    CONFIG_BOARD_ENABLE_CPUNET=y

     

    When you start the RTT session, JLink RTT viewer automatically boots up the net cpu for you, which is the reason why it wasn't caught earlier.

    Once the above configuration is enabled, then it should print the temperature w/o attaching the RTT session.

     

    Learner said:

    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);

    This sets a event to the other core. You can read about the IPC peripheral in the PS:

    https://infocenter.nordicsemi.com/topic/ps_nrf5340/ipc.html?cp=3_0_0_6_15 

      

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

    1. app core sends an event to the net core once a second.

    2. net core receives event, points to app cores memory, and copies in the most recent temperature data

    3. net core signalizes that it has updated the memory with fresh data (ipm_send())

    4. app core receives the ipm_rx_callback() and prints the temp data.

     

    Kind regards,

    Håkon

  • Hi Hakon,

    Thank you for your reply where you answered my 4 questions.

    I think I can see clearer what is going on between app and network cores in the die temperature example.

    Once the above configuration is enabled, then it should print the temperature w/o attaching the RTT session.
    CONFIG_BOARD_ENABLE_CPUNET=y

    If I understand you right, once I add the above config line in the app_core prj.conf then the network core will boot up automatically (well in fact the app core will boot it up I guess). So, the reason I was not seeing temperature values until J-Link RTT viewer connected is because the network core did not boot up and needed an external entity to kick start it.

    Kind regards

    Mohamed

  • Hi Mohamed,

     

    Learner said:
    If I understand you right, once I add the above config line in the app_core prj.conf then the network core will boot up automatically (well in fact the app core will boot it up I guess). So, the reason I was not seeing temperature values until J-Link RTT viewer connected is because the network core did not boot up and needed an external entity to kick start it.

    That is correct. SEGGER has scripts that automatically boots up the network core for you when you start a RTT session.

     

    Kind regards,

    Håkon 

Reply Children
Related