Hello TI Community,
I am working on a project using the TI C2000 MCU series and have encountered an issue with the ADC interrupt not triggering as expected. My project involves various functionalities including ADC conversion, SPI communication, and LED control. I am particularly facing a challenge with the ADC interrupt part of my code.
The Problem
I have a function read_current_temperature()
that is supposed to trigger an ADC conversion and then wait for the conversion to complete. The issue arises in the waiting loop, where the program fails to exit and does not print "ADC conversion complete" as expected:
short read_current_temperature() {
ADC_forceSOC(ADCA_BASE, ADC_SOC_NUMBER0);
SCISendData("ADC conversion triggered\r\n"); // this line work very well
while(ADC_getInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1) == false) {
}
SCISendData("ADC conversion complete\r\n"); //this line not show in SCI print
// ... More code ...
}
Steps Taken
-
ADC ISR: I have added an ADC Interrupt Service Routine (ISR) named
adcISR()
inspi_test_v1.c
, which is supposed to clear the ADC interrupt status and send a message via SCI:
__interrupt void adcISR(void) {
SCISendData("ADC ISR triggered\r\n");
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}
2. ISR Registration: The adcISR()
is registered in the main function after all initializations:
void main(void) {
// ... Initializations ...
Interrupt_register(INT_ADCA1, adcISR);
Interrupt_enableMaster();
// ... Rest of the main function ...
}
3.ADC Initialization: The ADC is initialized with the following setup:
void initADCSOC() {
// ... ADC SOC configuration ...
ADC_setInterruptSource(ADCA_BASE, ADC_INT_NUMBER1, ADC_SOC_NUMBER0);
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER1);
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
// ... More initialization ...
}
Despite these steps, the "ADC conversion complete" message is never printed, indicating that the while
loop in read_current_temperature()
never exits. This suggests that the ADC interrupt is not triggering as expected, or there is an issue with the interrupt status check.
Request for Assistance
Could anyone provide guidance or insights on what might be causing this issue? Are there any additional steps or configurations that I should consider to resolve this problem? Any advice or suggestions would be greatly appreciated.
Thank you in advance for your help.
N