How to avoid ADC Interrupt overflow during initialization/configuration?
1 次查看(过去 30 天)
显示 更早的评论
I am using simulink for TMS320F28027 (at 40MHz clock freq). I have programmed ePWM for 450 cycles (on first event trigger) for ADC interrupt.
//
int main(void)
{
volatile boolean_T runModel = 1;
float modelBaseRate = 0.005;
float systemClock = 40;
c2000_flash_init();
init_board();
((void) 0);
SB_300W_CL5_Rev2_initialize();
configureTimer0(modelBaseRate, systemClock);
runModel =
((void*) 0) == (NULL);
enableTimer0Interrupt();
enable_interrupts();
globalInterruptEnable();
while (runModel) {
runModel =
((void*) 0) == (NULL);
....
}
//
void enable_interrupts()
{
EALLOW;
PieVectTable.ADCINT1 = &ADCINT1_isr; /* Hook interrupt to the ISR*/
EDIS;
PieCtrlRegs.PIEIER1.bit.INTx1 = 1; /* Enable interrupt ADCINT1*/
IER |= M_INT1;
/* Enable global Interrupts and higher priority real-time debug events:*/
EINT; /* Enable Global interrupt INTM*/
ERTM; /* Enable Global realtime interrupt DBGM*/
}
I have observed following things: 1. ADCINTFLG was set even before executing enable_interrupts() (as ePWM was initialized and configured earlier) 2. almost 425 cycles are spent between last instruction of enable_interrupts() and first instruction of globalInterruptEnable(). I don't understand the reason. 3. And,so, ADCINTOVF is set even before entering the infinite while loop.
Could you please let me know how to avoid interrupt overflow getting set?
0 个评论
回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!