Forum Discussion
Altera_Forum
Honored Contributor
12 years agoInterval timer problem
Hello. I’ve got a problem with simple interrupt from interval timer in uC/OS-II System frequency is 75Mhz. There are PIO and timer. It makes strobe. Duration 10 ms. Here it is:
// glob...
Altera_Forum
Honored Contributor
12 years agoHow do you measure the strobe ? You power up the board and start a chronometer until your "err=1" happens ?
uC/OS has its own initialization that shall take time. Do you want your board to start very fast ? Why such a constraint. OR do you want your board to "produce" a regular strobe ? which is more usual. I think you want THIS. You code is hard to understand.
static void handle_timer(void* context)
{
IOWR_ALTERA_AVALON_TIMER_CONTROL(timer_base, ALTERA_AVALON_TIMER_CONTROL_STOP_MSK); //disable interrupt
IOWR_ALTERA_AVALON_TIMER_STATUS(timer_base, 0); //clear flag
IOWR_ALTERA_AVALON_PIO_DATA(PIO_BASE, 1); // <----------------------This is THE stobe signal, I think
timer_exit(); // <--------------------- ?????????? ----------------- you are in an interrupt routine, so it should be as short as possible and easy to read
err = 1;
return;
}
Your code doesn't do what you expect (I am 95% sure). I suggest to rewrite the code. Keep in mind the algorithm of what you expect. Regards