Dear all,
I have a TMS320C5505-ezdsp, Now the Timer0 work well, and I just modify hGpt = GPT_open (GPT_0, &gptObj, &status); -to-> hGpt = GPT_open (GPT_1, &gptObj, &status);. But the Timer1 or timer2 was not work. What else do I need to set ?
Best regards
Yudong
int Timer0Init(void) { CSL_Status status; CSL_Config hwConfig; CSL_GptObj gptObj1; CSL_Handle hGpt1; /* Open the CSL GPT module */ hGpt1 = GPT_open (GPT_1, &gptObj1, &status);//---Just modify here,GPT_0 --TO--GPT_1 /* Reset the GPT module */ status = GPT_reset(hGpt1); printf("Testing INTC using SAR module\n"); //Disable interrupt IRQ_globalDisable(); IRQ_clearAll(); /* Disable all the interrupts */ IRQ_disableAll(); /* Initialize Interrupt Vector table */ IRQ_setVecs((Uint32)(&VECSTART)); IRQ_plug(TINT_EVENT,&Timer_isr); IRQ_enable(TINT_EVENT); /* Timer interval 0.5sec (2Hz)*/ hwConfig.autoLoad = GPT_AUTO_ENABLE; hwConfig.ctrlTim = GPT_TIMER_ENABLE; hwConfig.preScaleDiv = GPT_PRE_SC_DIV_11; // Pre scale Divide input clock by 4096 // 98.304M/4096 = 24K hwConfig.prdLow = 0x5DC0; //0x2EE0;// 0x5DC0; hwConfig.prdHigh = 0x0000; //TIM1FLAG=1; /* Configure Timer0 */ //hGpt = GPT_open (GPT_2, &gptObj, &status); status = GPT_config(hGpt1, &hwConfig); IRQ_globalEnable(); /* Start timer */ GPT_start(hGpt1); return CSL_TEST_PASSED; } interrupt void Timer_isr() { unsigned char TIAFR_VAL=0; TIAFR_VAL = CSL_SYSCTRL_REGS->TIAFR; IRQ_clear(TINT_EVENT); if((TIAFR_VAL&0x01) == 0x01) { fTimer++; gpt0Isr(); } if((TIAFR_VAL&0x02) == 0x02) { fTimer++; gpt1Isr(); } }