Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: OCOTP_ANA1 register does not exist?

  1. #1
    Junior Member
    Join Date
    Oct 2019
    Posts
    15

    OCOTP_ANA1 register does not exist?

    I want to read the temperature from the internal sensor. My Code for this is

    Code:
    #include <Arduino.h>
    
    void setup() {
    }
    
    void loop() {
      Serial.println((TEMPMON_TEMPSENSE0 & 0x000FFF00) >> 8);
      delay(20);
    }
    This works, but in order to convert the raw value into an actual temperature, you need the values of ROOM_COUNT, HOT_COUNT and HOT_TEMP
    which are to be found in the OCOTP_ANA1 register (see pages 1275 and 1276 in the manual). However, When compiling, the above code with the following statement

    Code:
    Serial.println(OCOTP_ANA1);
    I get the error "'OCOTP_ANA1' was not declared in this scope". What's wrong?

  2. #2
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,498
    see https://forum.pjrc.com/threads/59813...re-measurement
    and you can look in the core source files to see how tempmonGetTemp() does it

  3. #3
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,137
    The temp monitor code is in the teensy4 core file tempmon.c. The register is identified as HW_OCOTP_ANA1 in the core for the Teensy4. But all you have to do is Serial.println(tempmonGetTemp()) to get the temperature for the T4 which is the same thing as in the post referenced by @manitou.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •