This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Re-Entrant  and  nesting of low priority Interrupts on Cortex M4

Note: This was originally posted on 4th December 2012 at http://forums.arm.com

Hi All,

I have tried to implement Re-Entrant  and  nesting of low priority Interrupts on Cortex M4 even if NVIC does not allow this feature.
I am using Freescale's MK60FN1M0VLQ12 processor.
I am trying to implement logic such that NVIC can serve any interrupt irrespective of its priority.

For that i have implemented following logic -----
1  When interrupt occurs , NVIC pushes frame of particular registers to stack ( r0,r1,r2,r3,r12,LR,PC,XPSR - for non floating point execution ). In IRQ Handler, i have
acknowledged  the interrupt and then I have pushed dummy frame to stack which contains Reset Value Of XPSR, Address of MY ISR Routine, Original LR, R12 = 0,R3 = 0,
R2 = 0, R1 =0, R0 =0. Then i have used (BX LR) to return from handler.
2. So when core returns from handler it will pop dummy frame and will go to MY ISR routine.
3. In MY ISR routine i have done my stuff and then load the registers r0-r4 ,r12, LR,XPSR and PC  with original values from stack frame pushed by NVIC.

Now i am able to return successfully to point from where interrupt occurred. Therefore now I am able to nest low priority interrupts even if NVIC executing higher priority interrupt.But sometimes processor goes to Hard Fault Exception.

After that i have implemented same logic for floating point execution in which I have added floating point registers S0 - S15 and FPSCR. But still processor goes to hard fault exception once in a while.

So can anybody suggest what did i miss?

OR has anybody implemented the nesting of low priority interrupts on CORTEX-M core.


Basically my purpose is to serve any interrupt as soon as it occurs irrespective of its priority which can be done in ARM7.

Thanks !!!
Parents
  • Note: This was originally posted on 6th December 2012 at http://forums.arm.com

    Hi Joseph ,
    Thank you very much for your reply !!

                              Yes , What you are saying is correct but I just forgot to mention that only one interrupt is active. so no other interrupt will
    pre-empt this interrupt. Also I have restored original XPSR value when returning from ISR. So do you think that it will cause the problem ?

                               I think the other way to nest the interrupt is to use BASEPRI.  I have written a  value in BASEPRI in thread mode and Handler mode. but it is not reflected in it. So Is there other way to write value in BASEPRI or we have to enable some other register to write in BASEPRI.


    Regards ,
    Mangesh Jadhav                          

Reply
  • Note: This was originally posted on 6th December 2012 at http://forums.arm.com

    Hi Joseph ,
    Thank you very much for your reply !!

                              Yes , What you are saying is correct but I just forgot to mention that only one interrupt is active. so no other interrupt will
    pre-empt this interrupt. Also I have restored original XPSR value when returning from ISR. So do you think that it will cause the problem ?

                               I think the other way to nest the interrupt is to use BASEPRI.  I have written a  value in BASEPRI in thread mode and Handler mode. but it is not reflected in it. So Is there other way to write value in BASEPRI or we have to enable some other register to write in BASEPRI.


    Regards ,
    Mangesh Jadhav                          

Children
No data