Altera_Forum
Honored Contributor
15 years agoTimer interrupt with RTOS-II
Hi all,
I'm working with RTOS-II and I need a very precise timing for a simple function. I have a dedicated timer which can trigger an interrupt every 1ms. So I used alt_irq_register(MY_TIMER_IRQ, 0,handle_timer_interrupt); and placed my simple code in the handle function (actually it simply changes a pio status and post an OS semaphore) All works. But I have two questions: Q1: Is this correct and safe under RTOS? Can I use alt_irq_register() without corrupting anything is OS? Is there any other way to achieve this in a better way? Maybe the CreateTimer function? Q2 I use an oscilloscope to monitor the pio setting performed by isr and I see a jitter up to 40us when OS tasks are quite loaded with work. Is this normal? Can I improve it? My timer use the highest priority irq, so I expected very high precision and then very low jittering of the 1ms period. Note that I don't care irq latency, provided it is constant. I only want generate these events at the exact 1ms period. Thank you Cris