This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

An interrupt service routine occurs twice instead of one time

Other Parts Discussed in Thread: HALCOGEN

Hello
I created an interrupt routine for rtiCompare0Interrupt.
The purpose of the interrupt is just to create a 1 msec timer and a program time out.
With R4F on RM48 USB Stick Development Kit I have no problem.
With R5F on TMDXRM57LHDK Development Board the interrupt service routine occurs twice instead of one time.

I tried to put a hardware breakpoint at the end of the service routine to look at R14 and CPSR but in that case the problem does not occur and all is OK.
What can I do?
Thanks for your help
Jerome

7823.Echantilon trace.xlsx

  • Hello:

    We have received your post and will direct it to one of our experts.

    Regards,

    Enrique
  • Hello Jerome,

      Are you using the HalCoGen to generate the code? In HalCoGen generated code the first thing it does in the rtiCompare0Interrupt() is to first clear the flag. Can you check if you are writing to clear the flag very late before the interrupt is exited. If this is the case, then it is possible that the write takes some cycles to complete before the interrupt is exited. In this case, as soon as you exited the interrupt the interrupt is still pending and hence you get another interrupt. You can either move the clearing of the flag earlier right when you enter the interrupt or perform a read of the flag after your write to the flag before you exit the interrupt. This way it makes sure the flag is truely cleared before exiting interrupt.

  • Hello Charles,

    Thanks a lot for your reply.

    Yes I use Halcogen but just for chip initialization. I rewrote fully the RTI interrupt routine.

    You are right; I cleared the RTI flag just before exit the routine. So I moved around it at the beginning of service routine and all works well now.

    Thanks for all.

    Jerome

  • Hello Jerome,

      Glad your problem is resolved.