Hi,
i have TMS320C5515 ezdsp usb stick board.
As per the Timer Application note it is mention IER0 register should be set.but i am unable to find what is the address of IER0 IO register(from example downloaded from TI website tells that it is 0x0000).
i tried to use timer0 and i want to capture timer interrupt. But i am not getting it.
here my code :-
#define CPU_CLOCK 100000000
#define PRE_SCALER 1024
#define TIMER_CLOCK (CPU_CLOCK / PRE_SCALER)
#define INTERRUPT_TIME_INTERVAL 1000 /* Time in Micro Seconds */
#define TIMER_PERIOD TIMER_CLOCK / INTERRUPT_TIME_INTERVAL
#define PSRCR *(volatile ioport Uint16*)(0x0C04)
#define PRCR *(volatile ioport Uint16*)(0x0C05)
#define PCGCR *(volatile ioport Uint16*)(0x1C02) /* Bit 10: Timer 0 Clock Enable_L */
/* Timer Registers */
#define TCR *(volatile ioport Uint16*)(0x1810) /* TCR Timer 0 Control Register */
/* Bit 15=ENABLE, Bits 5:2= Prescaler 2**1-2**13, 1:Autoreload, 0:Start */
#define TIMPRD1 *(volatile ioport Uint16*)(0x1812) /* Timer 0 Period Register 1 LSW */
#define TIMPRD2 *(volatile ioport Uint16*)(0x1813) /* Timer 0 Period Register 2 MSW */
#define TIMCNT1 *(volatile ioport Uint16*)(0x1814) /* Timer 0 Counter Register 1 LSW */
#define TIMCNT2 *(volatile ioport Uint16*)(0x1815) /* Timer 0 Counter Register 2 PSW */
#define TIAFR *(volatile ioport Uint16*)(0x1C14) /* Timer Interrupt Flag Register Bit 0: Timer0 Flag*/
#define IER0 *(volatile ioport Uint16*)(0x0000) /* Interrupt Enable Register Bit 4: Timer Interrupt Mask */
#define IFR0 *(volatile ioport Uint16*)(0x0001) /* Interrupt Flag Register Bit 4: Timer Flag*/
#define RESET_ALL_TIMER_FLAGS 0x07
void Timer0_start(void)
{
USBSTK5515_LED_init( );
USBSTK5515_LED_on( 0 );
PCGCR = 0x0000 ; /* Bit 10: Timer 0 Clock Enable_L */
/* Timer Registers */
TIMPRD2 = TIMER_PERIOD >> 16 ; /* Timer 0 Period Register 2 MSW */
TIMPRD1 = TIMER_PERIOD & 0xFFFF ; /* Timer 0 Period Register 1 LSW */
TIMCNT1 = 0 ;
TIMCNT2 = 0 ;
TIAFR = RESET_ALL_TIMER_FLAGS ;
IFR0 = 0x0000 ; /* Interrupt Flag Register Bit 4: Timer Flag*/
IER0 = 0x0010 ; /* Interrupt Enable Register Bit 4: Timer Interrupt Mask */
TIMER0_INT_FLAG = 1 ;
TCR = 0x8027 ; /* Bit 15=ENABLE, Bits 5:2= Prescaler 2**1-2**13, 1:Autoreload, 0:Start */
}
interrupt void Timer_isr(void)
{
TIAFR = RESET_ALL_TIMER_FLAGS ;
if(Timer_alt) { Timer_alt = 0 ; USBSTK5515_LED_on( 0 ); }
else { Timer_alt = 1 ; USBSTK5515_LED_off( 0 ); }
Timer0_flag = 1 ;
}
Regards'
Manish