Altera_Forum
Honored Contributor
9 years agoTimer Period not correctly
Hi all,
my goal is to set a timer with a period time of 1ms and start it. After the time is elapsed it should rise an IRQ (once). The timer itself with interrupt works, but the time is always about 6 to 8us. regardless what i write into the timer period registers? I also tried to set 80'000 (80MHz clock) but nothing changed on the 6 to 8 us. qsys settings: Period: 1us size: 32bit Hardware Options: Full featured Here the code for the timer: init:
alt_ic_isr_register(HIRES_TIMER_IRQ_INTERRUPT_CONTROLLER_ID, HIRES_TIMER_IRQ, hires_timer_ISR, NULL, NULL);
note: i made this according to the BSP generator for my niosII / uC-OSII project irq:
void hires_timer_ISR() {
IOWR_ALTERA_AVALON_PIO_DATA(DEBUG_BASE, 0);
IOWR_ALTERA_AVALON_TIMER_CONTROL(HIRES_TIMER_BASE, 0x0000); // disable IRQ
}
start the timer:
// set debug io
IOWR_ALTERA_AVALON_PIO_DATA(DEBUG_BASE, 1);
// set period
IOWR_ALTERA_AVALON_TIMER_PERIODL(HIRES_TIMER_BASE, 0x03E8);
IOWR_ALTERA_AVALON_TIMER_PERIODH(HIRES_TIMER_BASE, 0x0000);
// Start timer, single, with IRQ
IOWR_ALTERA_AVALON_TIMER_CONTROL(HIRES_TIMER_BASE, 0x0005);
Thanks in advice, Thomas