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.

F28069 on-chip Temperature Sensing Issue

My question wss about F28069 on-chip temperature sensing.

I was able to create a simple code project to try out the temperature sensing only and got it working. However, when I added the temperature monitor code into a real project, I could not get the temperature but the physical signal on the pin ADC-A5, even though ADCCTL1.bit.TEMPCONV was set to 1.

I tested the code on both HVMotorCtrl+PfcKit and DRV8312EVM hardware, but ended up with the same problem. Below is my code of the ADC initialization. Please review and comment what was the issue.

void InitAdc(void)
{
 EALLOW;

 //reset ADC                 
    AdcRegs.ADCCTL1.bit.RESET = 1;             
 //delay two cycle required before initialization
 DelayUs(ADC_2usDELAY);
    AdcRegs.ADCCTL1.bit.RESET = 0;  //release reset          

 //power sequence: bandgap -> reference -> rest of ADC                     
 AdcRegs.ADCCTL1.bit.ADCBGPWD = ADC_POWER_ON; // Power up band gap
 DelayUs(ADC_10usDELAY);   // Delay before powering up the rest of ADC
 AdcRegs.ADCCTL1.bit.ADCREFSEL = ADC_REF_INT; // select internal bandgap for input voltage reference
    AdcRegs.ADCCTL1.bit.ADCREFPWD = ADC_POWER_ON; // Power up reference      
    AdcRegs.ADCCTL1.bit.ADCPWDN  = ADC_POWER_ON; // Power up rest of ADC

 AdcRegs.ADCCTL1.bit.INTPULSEPOS = ADC_INT_CONV_END;  //INT pulse generation occurs a cycle prior to ADC result latching to its register           
 AdcRegs.ADCCTL1.bit.TEMPCONV = ADC_TEMP_SENSOR_EN;  //Temperature sensor is connected

 AdcRegs.ADCCTL2.all = ADCREGS_ADCCTL2_INIT;    //ADC clock configuration

//configure sample mode
 AdcRegs.ADCSAMPLEMODE.all = 0xFF;

//SOC0/1
 AdcRegs.ADCSOC0CTL.bit.CHSEL  = ADC_CH_TSI;    // Tach/Speed Analog Input TSI
 AdcRegs.ADCSOC0CTL.bit.TRIGSEL  = ADCTRIG_EPWM1SOCA;  // select EPWM1SOCA as SOC triggering source
 AdcRegs.ADCSOC0CTL.bit.ACQPS  = ADCSOC_ACQPS_VOLT;  // set acquisition width

 //SOC2/3
 AdcRegs.ADCSOC2CTL.bit.CHSEL  = ADC_CH_MTR_IA_IB;   // Motor Phase A/B IA-FB, IB-FB
 AdcRegs.ADCSOC2CTL.bit.TRIGSEL  = ADCTRIG_EPWM1SOCA;  // select EPWM1SOCA as SOC triggering source
 AdcRegs.ADCSOC2CTL.bit.ACQPS  = ADCSOC_ACQPS_CURR;  // set acquisition width
                     
 //SOC4/5
 AdcRegs.ADCSOC4CTL.bit.CHSEL  = ADC_CH_MTR_I_VBUS;  // Motor bus current and voltage
 AdcRegs.ADCSOC4CTL.bit.TRIGSEL  = ADCTRIG_EPWM1SOCA;  // select EPWM1SOCA as SOC triggering source
 AdcRegs.ADCSOC4CTL.bit.ACQPS  = ADCSOC_ACQPS_CURR;  // set acquisition width

 //SOC6/7
 AdcRegs.ADCSOC6CTL.bit.CHSEL  = ADC_CH_MTR_IC_IA;   // Motor bus current IC-FB
 AdcRegs.ADCSOC6CTL.bit.TRIGSEL  = ADCTRIG_EPWM1SOCA;  // select EPWM1SOCA as SOC triggering source
 AdcRegs.ADCSOC6CTL.bit.ACQPS  = ADCSOC_ACQPS_CURR;  // set acquisition width

 //SOC8/9
 AdcRegs.ADCSOC8CTL.bit.CHSEL  = ADC_CH_Vhb3;    // Motor drive H bridge 3
 AdcRegs.ADCSOC8CTL.bit.TRIGSEL  = ADCTRIG_EPWM1SOCA;  // select EPWM1SOCA as SOC triggering source
 AdcRegs.ADCSOC8CTL.bit.ACQPS  = ADCSOC_ACQPS_VOLT;  // set acquisition width

 //SOC10/11
 AdcRegs.ADCSOC10CTL.bit.CHSEL  = ADC_CH_TEMP_IB;   // MCU temperature and motor phase current IB
 AdcRegs.ADCSOC10CTL.bit.TRIGSEL  = ADCTRIG_EPWM1SOCA;  // select EPWM1SOCA as SOC triggering source
 AdcRegs.ADCSOC10CTL.bit.ACQPS  = ADCSOC_ACQPS_CURR;  // set acquisition width

 //SOC12/13
 AdcRegs.ADCSOC12CTL.bit.CHSEL  = ADC_CH_RSVD;    // reserved
 AdcRegs.ADCSOC12CTL.bit.TRIGSEL = ADCTRIG_EPWM1SOCA;  // select EPWM1SOCA as SOC triggering source
 AdcRegs.ADCSOC12CTL.bit.ACQPS  = ADCSOC_ACQPS_VOLT;  // set acquisition width

 //SOC14/15
 AdcRegs.ADCSOC14CTL.bit.CHSEL  = ADC_CH_MTR_VHB2;   // Motor voltage H-bridge ADC-Vhb2, ADC-Vhb1
 AdcRegs.ADCSOC14CTL.bit.TRIGSEL = ADCTRIG_EPWM1SOCA;  // select EPWM1SOCA as SOC triggering source
 AdcRegs.ADCSOC14CTL.bit.ACQPS  = ADCSOC_ACQPS_VOLT;  // set acquisition width

...

//Enable ADC
 AdcRegs.ADCCTL1.bit.ADCENABLE = ADC_ENABLE;

EDIS;

}

  • Hi Louis,


    Try reading back the value of  AdcRegs.ADCCTL1.bit.TEMPCONV in the expressions window.  If it isn't getting set, the most likely cause is a missing EALLOW.

  • In the Expression window, the TEMPCONV bit reads 1. Please advise other possibilities.
  • Hi Louis,

    I wonder if the ADC has an issue with using both simultaneous sampling mode, and the internal connection. Can you try sampling with AdcRegs.ADCSAMPLEMODE.all set to 0?
  • That's exactly what I suspected. In my first trial code project, I configured the ADC to be serial sampling, and the temperature sensing works. In my real project that is motor control app, I configured the ADC to be simultaneously sampling, and the temperature sensing does not work.
    I just changed the code to be serial sampling again per your suggestion, and proved that the temperature sensing works. Does it mean that I have to sacrifice the temperature sensing feature in order to ensure simultaneous sampling of phase currents of a motor?

  • Hi Louis,

    Whatever is being simultaneously sampled with what is supposed to be the temp. sensor sample (A5 = temp sensor, B5 = other sample) would only be simultaneous with the temp sensor sample, so I don't think it will matter if you change that pair of SOCs to sequential.

    I will investigate further if this behavior is documented anywhere in the DS or TRM. If not, we may need to issue an erratum or other documentation update.