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.

eCap1 interrupt triggered back-to-back (non stop) after the first egde is detected

Other Parts Discussed in Thread: HALCOGEN

Hi

I am working with the TMS570KS1227 and I am using the eCap1 to measure the time of both edges of a square wave, 1KHz and 30% duty. No intrrupt is triggered until the first edge pulse arrives but once the first one arrives the ISR keeps being called non-stop. I used the HalCoGen code and I have uCOS III running. The code is as follows: (basically the same as HalCoGen)

#pragma CODE_STATE(eCap1IsrHandler, 32)
#pragma INTERRUPT(eCap1IsrHandler, IRQ)

/* SourceId : ECAP_SourceId_032 */
/* DesignId : ECAP_DesignId_021 */
/* Requirements : HL_ECAP_SR15 */
volatile uint16_t ecclr_aux;
void eCap1IsrHandler(void)
{
uint16 Int_Flag = ecapREG1->ECFLG & ecapREG1->ECEINT;


/* USER CODE BEGIN (2) */

BSP_LED_Toggle(0);
ecclr_aux = ecapREG1->ECCLR;

/* USER CODE END */

/* Clear Events, */
/* Note : Current Implementation clears multiple all events set
before this point, User notification function is called with Flags and user must take care of handling */
ecapREG1->ECCLR = Int_Flag;

/* Clears the interrupt flag and enables further interrupts to be generated
if an event flags is set to 1. */
ecapREG1->ECCLR = 1U;

/* Passing the Interrupt Flag to the user Notification Function */
//ecapNotification(ecapREG1,Int_Flag);

/* USER CODE BEGIN (3) */
ecapREG1->ECCLR = 0xFF;
ecclr_aux = ecapREG1->ECCLR;

/* USER CODE END */

}

Does anyone have an idea?

Thanks