Hi,
I'm facing a little issue with the F2812 considering the Timer interrupt. I'm using the following code as shown below. The thing is, that I want to increment a counter value, every time a interrupt occures. Right now, the value is only incrementing when giving a interrupt from high [1] to low [0]. But can't make it interrupt everytime, no matter if the value incomming is low og high. I've tried with a simple if else statement (out-commented in the code), by changing the polarity, but no luck. Hope you can help me.
#include "DSP281x_Device.h" // DSP281x Headerfile Include File
#include "DSP281x_Examples.h" // DSP281x Examples Include File
// Prototype statements for functions found within this file.
interrupt void cpu_timer0_isr(void);
void main(void)
{
// Step 1. Initialize System Control:
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP281x_SysCtrl.c file.
InitSysCtrl();
DINT;
InitPieCtrl();
// Disable CPU interrupts and clear all CPU interrupt flags:
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
// Interrupts that are used in this example are re-mapped to
// ISR functions found within this file.
EALLOW; // This is needed to write to EALLOW protected registers
GpioMuxRegs.GPADIR.all = 0xFFFF; // All pins are outputs
GpioDataRegs.GPADAT.all = 0x0000; // All I/O pins are driven low
GpioMuxRegs.GPADIR.bit.GPIOA0 = 1; // Sets A0 to output | 1 = output | 0 = input
GpioDataRegs.GPADAT.bit.GPIOA0 = 0; // If 1 = high else 0 = low.
GpioMuxRegs.GPEMUX.bit.XINT1_XBIO_GPIOE0 = 1; // GPIOE0 is XINT1 pin
PieVectTable.XINT1 = &cpu_timer0_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
XIntruptRegs.XINT1CR.bit.ENABLE = 1; // Enable XINT1 pin
//XIntruptRegs.XINT1CR.bit.POLARITY = 1; // Interrupt triggers on rising edge
/*while(1){
if (GpioDataRegs.GPADAT.bit.GPIOA0 == 0){
XIntruptRegs.XINT1CR.bit.POLARITY = 1;
break;
}else
XIntruptRegs.XINT1CR.bit.POLARITY = 0;
break;
}*/
// Enable CPU INT1 which is connected to CPU-Timer 0:
IER |= M_INT1;
// Enable TINT0 in the PIE: Group 1 interrupt 7
PieCtrlRegs.PIEIER1.bit.INTx4 = 1;
// Enable global Interrupts and higher priority real-time debug events:
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
// Step 6. IDLE loop. Just sit and loop forever (optional):
for(;;);
}
interrupt void cpu_timer0_isr(void)
{
CpuTimer0.InterruptCount++;
// Acknowledge this interrupt to receive more interrupts from group 1
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}