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