Hi:
i am trying to generate a square wave from GPIO pin of a C6747, by alternatively setting and clearing the corresponding bit of certain GPIO register in the isr function of timer1 interrupt. the timer1 intterupt works well, but when i add some other lines in my codes, like those marked in red color below, the isr function refuses to execute, although i think they have nothing related with timer1. i checked the core registers of C6747, and also timer1 registers, found nothing unusual, expect that IRP had changed. could someone help me? thanks a lot!
void Timer1_Init(void)
{
TIMER1_TCR = 0x00000080; //timer1 control register
TIMER1_PRD12 = 0x00000330;
TIMER1_TIM12 = 0;
INTCTLSTAT1 &= ~0xFF;
INTCTLSTAT1 |= 0x00000001; // enable timer1 interrupt
TIMER1_TGCR = 0x05; // let timer1 works in dual 32bit unchained mode and enable time1
}
Uint8 cnt = 0;
void main(void)
{
C6747_init( );
KICK0R = 0x83e70b13; // Kick0 register + data (unlock) */
KICK1R = 0x95a4f1e0; // Kick1 register + data (unlock) */
PINMUX13 = 0x00000080; //GP4[4] */
KICK0R = 0; // Kick0 register + data (unlock) */
KICK1R = 0; // Kick1 register + data (unlock) */
// C6747_GPIO_setDirection(4 << 5 + 4, 0);
ISTP = 0x80003800; //start of the c_int0
INTMUX1 &= ~0xFF; // clear out INTSEL4 field
INTMUX1 |= 40; // INTSEL4=40
IER |= 0x00000013; // IE4=1
CSR |= 0x00000001; // intrrupt gloabe enabel
Timer1_Init();
while(1);
}
interrupt void Timer1_isr(void){
// if((cnt++) % 2)
// GPIO_OUT_DATA45 |= 0x00000010;
// else
// GPIO_SET_DATA45 &= ~(0x00000010);
printf("interrupt occured\n");
}