Hello everyone, I have some problems with the initialization of the interrupts. I have used the example code provided by the TI, unfortunatelly I am still not able generate any interrupts. Following code was applied,
[c]
[/c]
[c]
[/c]
this is the code I have used for the implementation, when I am setting an LED in the interrupt function high, it doesnt work.
Does anyone has any ideas.
Thx
[c]
Rich (BB code):
void DeviceInit(void)
{
WDogDisable(); // Disable the watchdog initially
DINT; // Global Disable all Interrupts
IER = 0x0000; // Disable CPU interrupts
IFR = 0x0000; // Clear all CPU interrupt flags
// SYSTEM CLOCK speed based on Crystal = 20 MHz
// 0xA = 100 MHz (10)
// 0x9 = 90 MHz (9)
// 0x8 = 80 MHz (8)
// 0x7 = 70 MHz (7)
// 0x6 = 60 MHz (6)
// 0x5 = 50 MHz (5)
// 0x4 = 40 MHz (4)
// 0x3 = 30 MHz (3)
// 0x2 = 20 MHz (2)
PLLset(0xA); // choose from options above
// Initialise interrupt controller and Vector Table
// to defaults for now. Application ISR mapping done later.
PieCntlInit();
PieVectTableInit();
EALLOW; // below registers are "protected", allow access.
// HIGH / LOW SPEED CLOCKS prescale register settings
SysCtrlRegs.HISPCP.all = 0x0002; // Sysclk / 4 (25 MHz)
SysCtrlRegs.LOSPCP.all = 0x0002; // Sysclk / 4 (25 MHz)
SysCtrlRegs.XCLK.bit.XCLKOUTDIV=2;
// PERIPHERAL CLOCK ENABLES
//---------------------------------------------------
// If you are not using a peripheral you may want to switch
// the clock off to save power, i.e. set to =0
//
// Note: not all peripherals are available on all 280x derivates.
// Refer to the datasheet for your particular device.
SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1; // ADC
//------------------------------------------------
SysCtrlRegs.PCLKCR0.bit.I2CAENCLK = 0; // I2C
//------------------------------------------------
SysCtrlRegs.PCLKCR0.bit.SPIAENCLK=0; // SPI-A
SysCtrlRegs.PCLKCR0.bit.SPIBENCLK=0; // SPI-B
SysCtrlRegs.PCLKCR0.bit.SPICENCLK=0; // SPI-C
.
.
.
GpioDataRegs.GPBSET.bit.GPIO34 = 1; // uncomment if --> Set High initially
//--------------------------------------------------------------------------------------
EDIS; // Disable register access
}
[c]
Rich (BB code):
// This function initializes the PIE control registers to a known state.
//
void PieCntlInit(void)
{
// Disable Interrupts at the CPU level:
DINT;
// Disable the PIE
PieCtrlRegs.PIECTRL.bit.ENPIE = 0;
// Clear all PIEIER registers:
PieCtrlRegs.PIEIER1.all = 0;
PieCtrlRegs.PIEIER2.all = 0;
PieCtrlRegs.PIEIER3.all = 0;
PieCtrlRegs.PIEIER4.all = 0;
PieCtrlRegs.PIEIER5.all = 0;
PieCtrlRegs.PIEIER6.all = 0;
PieCtrlRegs.PIEIER7.all = 0;
PieCtrlRegs.PIEIER8.all = 0;
PieCtrlRegs.PIEIER9.all = 0;
PieCtrlRegs.PIEIER10.all = 0;
PieCtrlRegs.PIEIER11.all = 0;
PieCtrlRegs.PIEIER12.all = 0;
// Clear all PIEIFR registers:
PieCtrlRegs.PIEIFR1.all = 0;
PieCtrlRegs.PIEIFR2.all = 0;
PieCtrlRegs.PIEIFR3.all = 0;
PieCtrlRegs.PIEIFR4.all = 0;
PieCtrlRegs.PIEIFR5.all = 0;
PieCtrlRegs.PIEIFR6.all = 0;
PieCtrlRegs.PIEIFR7.all = 0;
PieCtrlRegs.PIEIFR8.all = 0;
PieCtrlRegs.PIEIFR9.all = 0;
PieCtrlRegs.PIEIFR10.all = 0;
PieCtrlRegs.PIEIFR11.all = 0;
PieCtrlRegs.PIEIFR12.all = 0;
}
void PieVectTableInit(void)
{
int16 i;
Uint32 *Source = (void *) &ISR_ILLEGAL;
Uint32 *Dest = (void *) &PieVectTable;
EALLOW;
for(i=0; i < 128; i++)
*Dest++ = *Source;
EDIS;
// Enable the PIE Vector Table
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
}
interrupt void ISR_ILLEGAL(void) // Illegal operation TRAP
{
// Insert ISR Code here
// Next two lines for debug only to halt the processor here
// Remove after inserting ISR Code
asm(" ESTOP0");
for(;;);
}
this is the code I have used for the implementation, when I am setting an LED in the interrupt function high, it doesnt work.
Does anyone has any ideas.
Thx