UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor flouger
Visitor
7,320 Views
Registered: ‎02-07-2012

Xilinx xilkernel timer interrupt problems.

Im running the xilkernel, and trying to get an interrupt to occure at a regular 1/4 ms.

Majority of the time it runs ok, however sometimes it is delayed a little bit.

This causes signal processing problems.

 

The maximum time for the interrupt is well under the 1/4ms time limit, and the average time it runs is very small.

(gdb) p max_tracking_timer
$38 = 0.00013711536303162575
(gdb) p avg_tracking_time
$39 = 3.282309745553627e-005

 

The time inbetween my interrupt however is sometimes much greater than the 1/4ms interival.

(gdb) p max_between_time
$40 = 0.00039486680179834366 <- This number should always be around .00025
(gdb) p avg_between_time
$41 = 0.00025274289338876631

 

My code isn't locking out interrupts, unless the xilkernel is.

 

Also I noticed that the interrupt uses the IRQ stack, so this probably means the timing interrupt timer1, and os timer interrupt(timer 0) are somehow locking interrupts to prevent stack corruption.

 

Was wondering where the vector table code was.  Can I preempt the os timer interrupt with mine if I make some assembly code to define my own stack?

 

I moved the irq stack into the interal ram thinking that would fix the problem.  False.

 

Anyhow here is how I am starting up the interrupt.  Couldn't get the xilkernel register_interrupt, and enable_interrupt to work.

 

 

// Driver instances
static XTmrCtr myTimer;

extern XIntc sys_intc;

 

int start_interrupt()
{

    XTmrCtr_Initialize(&myTimer, XPAR_XPS_TIMER_1_DEVICE_ID);
    /* Set options: auto-reload, down count, enable interrupts */
    XTmrCtr_SetOptions(&myTimer,0,XTC_INT_MODE_OPTION | XTC_DOWN_COUNT_OPTION | XTC_AUTO_RELOAD_OPTION);
    /* Set handler for interrupt to run when timer expires */
    XTmrCtr_SetHandler(&myTimer,my_timer_int_handler,&myTimer);

     XTmrCtr_SetResetValue(&myTimer, 0, 25000/2); //Not sure why this needs to 25000/2 were using a 100MHz clock, want .00025 s intervals

    XIntc_Connect(&sys_intc, XPAR_XPS_INTC_0_XPS_TIMER_1_INTERRUPT_INTR, XTmrCtr_InterruptHandler,&myTimer);
    /********* Start the timer ***************************************************/
    XTmrCtr_Start(&myTimer, 0);
    /* Enable the interrupt controller */
    XIntc_Enable(&sys_intc, XPAR_XPS_INTC_0_XPS_TIMER_1_INTERRUPT_INTR);

}

 

int main_thread()
{

    printf("Launching application threads\n");
    launch_app_threads();
    start_interrupt();

}

 

void my_timer_int_handler(void *CallBackRef, Xuint8 TmrCtrNumber)
{

//My timing information is done in here, so unless the OS is taking a super long time, we should be meeting timing.

        my_isr(0);

}

 

Any thoughts?

Should I make my own interrupt vector and share data via a global to a xilinx thread?

Would that even preempt the os timer?

 

Thanks,
Sam

0 Kudos
5 Replies
Highlighted
Explorer
Explorer
7,314 Views
Registered: ‎06-25-2008

Re: Xilinx xilkernel timer interrupt problems.

I'm not sure what the correct format is but make sure you are using the correct interrupt functions with the kernel because they are different.

 

What is the priority of the interrupt in EDK?  Could it be at a lower level?

0 Kudos
Visitor flouger
Visitor
7,310 Views
Registered: ‎02-07-2012

Re: Xilinx xilkernel timer interrupt problems.

XPAR_XPS_INTC_0_XPS_TIMER_1_INTERRUPT_INTR
is set to 0
and timer_0 is set to 1.

The documentation states that lower numbers are the higher priority.

I think the problem is that all of the interrupts share the same interrupt pin, and they can't preempt each other because they share the same irq stack.

on other micros I usually have separate stacks for each interrupt, and am able to preempt the operating system scheduling interrupt.

I couldn't get the register_interrupt to work, the stuff I was doing is kind of a mix between the standalone, and the xilkernel so that might be the problem.
0 Kudos
Moderator
Moderator
7,306 Views
Registered: ‎09-12-2007

Re: Xilinx xilkernel timer interrupt problems.

Can you see the doc attached. Here, this goes through tghe steps needs to get the interrupt system working in Xilkernel.

This may help you here

0 Kudos
Explorer
Explorer
7,305 Views
Registered: ‎06-25-2008

Re: Xilinx xilkernel timer interrupt problems.

Are you using an interrupt controller?

0 Kudos
Adventurer
Adventurer
3,312 Views
Registered: ‎05-17-2015

Re: Xilinx xilkernel timer interrupt problems.

Hello,

 

I have similiar issue in which the interrupt test fails with xilkernel bsp, and succeeded standalone bsp.

Is there any idea what can cause such behaviour ?

 

Thank you,

Ran

0 Kudos