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.

CCS/UCD3138064A: How to use the internal temperature sensor in UCD3138064A

Part Number: UCD3138064A
Other Parts Discussed in Thread: UCD3138,

Tool/software: Code Composer Studio

Hello,
I don't want to bother you,but I really have a question that I can't solve.
When I use UCD3138,I know that I have to use AD12(ch14).And the Code "MiscAnalogRegs.TEMPSENCTRL.bit.TEMP_SENSE_DIS = 0;" is necessary.

  //=============================================================================
  // Miscellaneous Analog  Module Register File
  //=============================================================================
  struct MISC_ANALOG_REGS {
    union CLKTRIM_REG       CLKTRIM;
    union BGTRIM_REG        BGTRIM;
    union AFECTRL_REG       AFECTRL;
    union AFEMISC_REG       AFEMISC;
    union PKGID_REG         PKGID;
    union BROWNOUT_REG      BROWNOUT;
    union GLBIOEN_REG       GLBIOEN;
    union GLBIOOE_REG       GLBIOOE;
    union GLBIOOD_REG       GLBIOOD;
    union GLBIOVAL_REG      GLBIOVAL;
    union GLBIOREAD_REG     GLBIOREAD;
    union TEMPSENCTRL_REG   TEMPSENCTRL;
    union IOMUX_REG         IOMUX;
    union CSTRIM_REG        CSTRIM;
    union CSCTRL_REG        CSCTRL;
    union TEMPREF_REG       TEMPREF;
    union PWRDISCTRL_REG    PWRDISCTRL;
    union BIASTRIM_REG      BIASTRIM;
  };

However,when I use UCD3138064A(I know the channel turns to be AD15),I can't find TEMPSENCTRL register in cyclone_misc_analog.h .There is only Reserved bit filed.

  //=============================================================================
  // Miscellaneous Analog  Module Register File
  //=============================================================================
  struct MISC_ANALOG_REGS {
    Uint32		    rsvd0;
    Uint32		    rsvd1;
    Uint32		    rsvd2;
    Uint32		    rsvd3;
    union PKGID_REG         PKGID;
    union BROWNOUT_REG      BROWNOUT;
    union GLBIOEN_REG       GLBIOEN;
    union GLBIOOE_REG       GLBIOOE;
    union GLBIOOD_REG       GLBIOOD;
    union GLBIOVAL_REG      GLBIOVAL;
    union GLBIOREAD_REG     GLBIOREAD;
    Uint32		    rsvd4;
    union IOMUX_REG         IOMUX;
    Uint32		    rsvd5;
    union CSCTRL_REG        CSCTRL;
    union TEMPREF_REG       TEMPREF;
    union PWRDISCTRL_REG    PWRDISCTRL;
    Uint32		    rsvd6;
    union DTCUARTSEL_REG    DTCUARTSEL;
  };

Could you tell me why?Meanwhile,how can I enable the temperature sensor? 

Thanks,

hly_rookie

  • Hi, Larry,

    It is good question. I haven't used this bit yet, and I will get back to you as soon ass possible.

    Thanks,
    Sean
  • The temperature sensor is enabled as default in UCD3138064A.
    Therefore you do not need to enable it.

    Hope this helps.
    Regards,
  • Hi Mr Bolurian,

    I use the internal temperature sensor directly,but the raw value is only 12!!It's so small.Could you tell me what's wrong with it?(The Code is simple:I initiate adc,and use poll_adc()).I did not  do any conversion.

    void init_adc_polled(void) 
    {
    	AdcRegs.ADCCTRL.bit.MAX_CONV = NUMBER_OF_ADC_CHANNELS_ACTIVE - 1; 
       	AdcRegs.ADCCTRL.bit.SAMPLING_SEL = 6;   //268KS/s
    	AdcRegs.ADCCTRL.bit.SINGLE_SWEEP = 1;   // set it up for single loop
    	AdcRegs.ADCSEQSEL0.bit.SEQ0 = 15;       //temperature	
    	AdcRegs.ADCCTRL.bit.ADC_EN = 1;
    	AdcRegs.ADCAVGCTRL.bit.AVG0_CONFIG = 3;	// average 32 samples
    	AdcRegs.ADCAVGCTRL.bit.AVG0_EN = 1;	// adc averaging module 0 enabled
    
    }
    #pragma FUNC_ALWAYS_INLINE (poll_adc)
    void poll_adc(void)
    {
    	if(AdcRegs.ADCSTAT.bit.ADC_INT == 1)				// end-of-conversion interrupt found
    	{
    		adc_raw[0] = AdcRegs.ADCRESULT[0].bit.RESULT;
    		adc_avg[0] = AdcRegs.ADCAVGRESULT[0].bit.RESULT;       // read AD15
    	}
    
    	AdcRegs.ADCCTRL.bit.SW_START = 1; //trigger sweep
    
    }

    Thanks,

    Larry

  • Thank you,sir!
  • I could reproduce the issue that you are reporting on my setup as well.
    The temperature signal seems to be connected to channel 14!
    This is strange; I have started to investigate this and double check why this happens.

    Meanwhile, please check the configuration when:
    AdcRegs.ADCSEQSEL0.bit.SEQ0 = 14; //temperature
    instead, and see if you can read the temperature.

    Regards,

  • Hi Larry,

    I have double checked this and indeed the temperature sensor is connected to channel 14.
    We will change the documentation accordingly.
    If this addressed your issue.
    Please set the status of this post to resolved.

    Regards,