This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using internal temperature sensor of cc1120

Other Parts Discussed in Thread: CC1120

Hello

I was using the internal temperature sensor of cc1120. I initially referred the swra415b document and used the values of temperature coefficients mentioned in it.They have provided the values for 3V supply and 3.6V supply.But I was using a 3.3V supply so I took the average of temperature coefficients at 3.0 V and 3.6 V. I wrote a C code to compute the temperature using the temperature coefficients and the formula provided in the document.But I got incorrect temperature outputs.Then I used the c revision swra415c and used the new values of temp coeff and the new formula but I am still getting incorrect temperature output.

 Please guide me. 

  • - I assume you are using the digital readout of the temp sense?

    - Which coefficients are you using?

    - Which measurement/ readout values do you get at which temperatures?

  • Thank you for replying

    Yes I am using the digital readout.

    I am using the temperature coefficients provided in swra415c doc.

    Following are the digital readouts,actual temperatures.To calculate the value from cc's temperature sensor we used the code written below.

    Digital readout                   actual temperature (in celsius)          temperature calculated from readout

    64hex                                            24                                                             19.195

    67hex                                            26                                                               17.70

    74hex                                            30                                                               14.32

    97hex                                            42                                                                4.105

      The temperature coefficient values were given for 3V supply and 3.6V supply.But my system was on 3.3V so  took the average of the two temperature coefficients values. 

  • The code is missing. Please also provide the coefficients so it's no misunderstanding.

  • Please find the code below :

    float calc_temp (uint16_t temp) {
    float tc1, tc2, tc3, curr;
    int dm, dc, tc;
    tc1 = (-3.32 - 3.29 ) / 2;
    tc2 = ( 992.1 - 1010.87 ) / 2;
    tc3 = (-2629.91 - 3945.8 ) / 2;
    dc = (0x3f00 + 0x4100) / 2;
    tc = 30.5;
    dm = temp << 8;
    /*
    * Calculate the temperature here
    * Look up in the table and print the temperature range
    */
    curr = (tc2 + sqrt(4*tc1*(tc3-dm))/(2*tc1) - (tc2 + sqrt(4*tc1*(tc3-dc)))/(2*tc1) + tc;
    return curr;
    }

     Out of the three byte quantity I am using only the middle byte
    As I need less precision
    And the highest significant byte is always zero for all temperature values while testing
  • It is an error in the calculation of tc2.

    A typical reading at room temp should be around 20000, you get a much lower value. I also find it strange that the MSB byte always are 0. The reading should wrap around 0 degrees, if you try a temp read when it's cold, is the MSB byte still 0?

    Have you tried to do a calculation where you keep all 3 bytes?

  • The error was a typing mistake. Sorry for that. I have used the correct value for tc2 in the code.

    Yes the reading wraps around to 0 degrees at colder environments. But I am using the device at room temperature above 20 degree celsius. Yes the MSB byte was still 0.

    We needed less precision so we aren't using all 3 bytes.

    Thank You