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.

How to configure ADC comparator for internal temperature sensor?

Hi

I would like to enable internal temperature sensor to detect the overheat case.

I have two purposes: read the data and waiting for the overheat interrupt.

I have enabled it and read the temperature data, but I'm failed to configure ADC comparator to trigger interrupt.

Below is my configure process:

void ADC1SS0INTHandler(void)
{
	ADCComparatorIntDisable(ADC1_BASE, 0);

	SendTestCANMsg(0x0000BBBB, 0x11111111);

	ADCComparatorIntClear(ADC1_BASE, 0xFFFFFFFF);
	ADCComparatorIntEnable(ADC1_BASE, 0);
	ADCSequenceEnable(ADC1_BASE, 0);
}

void ADCCompConfigure(void)
{
	SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC1);

	ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PLL | ADC_CLOCK_RATE_FULL, 24);
	ADCClockConfigSet(ADC1_BASE, ADC_CLOCK_SRC_PLL | ADC_CLOCK_RATE_FULL, 24);
	
	//init sample sequence
	ADCSequenceDisable(ADC0_BASE, 0);

	ADCHardwareOversampleConfigure(ADC0_BASE, 16);

	ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);

	ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_TS |ADC_CTL_IE | ADC_CTL_END);

	ADCSequenceEnable(ADC0_BASE, 0);
	
	//init comparator
	ADCSequenceDisable(ADC1_BASE, 0);

	ADCSequenceStepConfigure(ADC1_BASE, 0, 0, ADC_CTL_TS | ADC_CTL_CMP0 | ADC_CTL_END);

	ADCSequenceConfigure(ADC1_BASE, 0, ADC_TRIGGER_PROCESSOR, 1);

	//init comparator sequence
	ADCComparatorConfigure(ADC1_BASE, 0, ADC_COMP_INT_HIGH_ONCE);

	ADCComparatorRegionSet(ADC1_BASE, 0, 0, OVERTEMP);

	ADCComparatorReset(ADC1_BASE, 0, true, true);

	ADCComparatorIntEnable(ADC1_BASE, 0);

	ADCIntClear(ADC1_BASE, 0);
	

	ADCSequenceEnable(ADC1_BASE, 0);

	ADCIntEnableEx(ADC1_BASE, ADC_INT_DCON_SS0);

	ADCIntEnable(ADC1_BASE, 0);

}

I appreciate if anyone can give me some suggestion?

thanks

Gavin

  • Hello Gavin

    How are you triggering the ADC1 for Temperature Conversion. I would normally expect ADCProcessorTrigger API call and also assume that you are calling it some place in the code.

    What is the value of OVERTEMP and what is the temp value that you expect that the uC must get a Comparator Interrupt?

    Regards
    Amit
  • Hi Amit

    Actually, I don't call ADCProcessorTrigger in my code. So I add it into my code.

    But no matter what I call it once in the initial process or regular call it periodically, I still can't check the overheat interrupt.

    Do you have any idea? Or I make something wrong?

    Currently, I set OVERTEMP is 1862 for test, that should easy to hit.

    thanks
    Gavin

  • Having witnessed some device design cycles, I'd like to ask what makes you so confident that an MCU-internal temperature sensor is the best method to detect overheating. Actually, I'm pretty sure the MCU itself is not a heat source you need to be concerned about. If you still want to use the internal sensor, be aware of issues like thermal flow, thermal resistance and capacity, usually resulting in a time lag in the range of minutes before temperatures stabilize. An external sensor (or sensors) might serve you better.

  • Hello Gavin,

    When using the Digital Comparator you would need to perform continuous sample. Since you have 2 Temp Senses (one on ADC) and another on ADC1), did you check if the read out of temp actually goes from less than 1862 to more than 1862 (which is ~35C)

    Regards
    Amit
  • Hi f.m.

    Currently, I still evaluate the internal temperature sensor but I will consider your suggestion, thanks,

    Hi Amit

    Since the digital comparator needs continuous sampling, I may change to get the temperature data periodically.

    thanks for your clarification.

    Gavin

  • Hello Gavin,

    I would suggest an additional step to test w/o changing temp. Configure the sequencer to a ADC AINx pin and change it from 0 to 3.3V. This way with a simple switch you can check if the ADC works well before moving it to Temp Sense Mode.

    Regards
    Amit