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.

CC2530 internal temperature sensor

Other Parts Discussed in Thread: CC2530, CC2430

Hello community,

at the moment I'm trying to migrate my proprietary communication protocol from the CC2430 to the CC2530. Thanks to the migration guide all runs perfect but except the internal temperature sensor. The ADCs result is always between 150 and 225 mV (depending to the supply voltage, 2 to 3 V) and doesn't change, when the temperature does. According to the datasheet it should have 904 mV at 25 °C.

I tried to enable the temperature sensor with the TR0 and/or the ATEST registers, but nothing happend. I am using CC2530 withoat a primary address in the info page - from a preliminary batch according to this post --> http://e2e.ti.com/support/low_power_rf/f/155/p/15751/60635.aspx#60635

What am I doing wrong? Any ideas?

 

Regards

mario

 

My code:

ADCCON3 = 0x3E; // temp
while(!(ADCCON1 & 0x80)); // wait until conversion done
temp = ADCL;
temp |= ADCH << 8;
temp = temp >> 4; // only 12 bits
t_voltage = temp *1.15 / 2047;

  • You said you are using the ATEST and TR0 registers, but they are not present in your code. In addition to your code you need to set

    ATEST = 1;
    TR0 = 1;

    before you start the conversion. With that modification, your code works.

  • Thanks for your answer.

    I did this modifications already but still didn't get correct values from the temperature sensor because I set the two registers only once. It seems, that the value in TR0 is not retained in power mode 2. With a TR0 = 1; before every single conversion I get the correct values from the temperature sensor.

  • Mario12440 said:

    Thanks for your answer.

    I did this modifications already but still didn't get correct values from the temperature sensor because I set the two registers only once. It seems, that the value in TR0 is not retained in power mode 2. With a TR0 = 1; before every single conversion I get the correct values from the temperature sensor.

    Hello Mario,

    I'm having problems calculating correct temperature. In your implementation what factors did u use in order to obtain valid temperature? Did you use some sort of specific equation using the value from ADCL?Thanks in advance. Nikos

  • Hello Nikos,

    you just have to calculate the temperature from the sampled values with the following equation:

           

            float temperature = ((float)((ADCH << 8) | ADCL) >> 4) * 1150.0 / 2047.0 - 743.0) / 2.45;

    //        1150 mV ADC reference voltage
    //        2047 positive samples with 12 bits resolution
    //         743 mV at 0 °C
    //        2.45 mV per °C

    I think ADCL must be read first, but generally this should work.

    m.

  • Hello Mario,

    Thanks a lot for the reply. I used your equation but i dont get correct values. For example i get 43 degrees when the temperature is 16. Are you sure the Voltage At Zero Temperature is 743 mV for the cc2530? Did this work for you? Also you have a missing parenthesis :).

    Thanks in advance

    Nikos

    EDIT: Here is my code

    float get_cur_temp(void) {
     
     
      float temp;
      uint16 value;
     
      ATEST = 0x01;
      TR0  |= 0x01;
      ADCIF = 0;
      ADCCON3 = (HAL_ADC_REF_125V | HAL_ADC_DEC_512 | HAL_ADC_CHN_TEMP);
     
      while ( !ADCIF );

      value = ADCL;
      value |= ((uint16) ADCH) << 8;
      value >>= 4;
     
     
     
      temp = ((((float)value) * 1150.0 / 2047.0 - 743.0) / 2.45);
     
      return temp;
     
    }