RTI stops working on MC9S12XEP100

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RTI stops working on MC9S12XEP100

2,215 Views
lak
Contributor I
Hi,
I have the RTI running successfully in my boot main configured for 1.024 ms. I use the following  to set it
  RTICTL = 0x1F; /* set RTI prescaler */
 
  CRGINT = 0x80;  /* enable RTI interrupts */
  CRGFLG = 0x80;  /* clear any pending RTIF */
Then, I use a unconditional jump to the application main where again RTI gets re configured to approx. 10 ms
RTICTL = 0x59;
CRGFLG_RTIF = 1;
CRGINT_RTIE = 1;
Also, before the above, the chip gets configured to NORMAL EXPANDED mode.
Even here the RTI works fine.
 
Again, when I jump from application to my boot main back, (the first code set again gets executed), the RTI stops working.Other interrupts work fine.I have set my IVBR register properly
 
However if I do a hard reset to return to boot main  instead of jumping, the RTI works perfectly
 
In both the boot and appl, I am setting up the PLL clock to 40Mhz
 
I am at a loss to findout what am I missing out here, any initializations to be taken care of.
please advice.
 
with regards,
Lak
Labels (1)
0 Kudos
Reply
4 Replies

784 Views
kef
Specialist I
Are you jumping back to boot from some of your interrupt service routine?
0 Kudos
Reply

784 Views
lak
Contributor I
Yes, this jump is from a task which gets executed in the RTI ISR. However before jumping, I disable the RTI and disable the interrupts too.
 
with regards,
Lak
0 Kudos
Reply

784 Views
kef
Specialist I
If it was S12, then jumping from ISR to start of bootloader, reinitializing SP and some peripherals could be enough. In S12X you also have to reset CPU CCR IPL bits to 0, and I guess you didn't? If so, then current priority level is >=1, and all interrupts that have priority <= IPL are inhibited.
 
BTW in ISR interrupts are already disabled, unless you reenable them with CLI allowing higher priority interrupts to interrupt current ISR.
0 Kudos
Reply

784 Views
lak
Contributor I
Kef,
your suggestion was very appropriate.
I had been indeed clearing the CCR  by the instn ANDCC #0 however, the IPL bits are in the MSbyte of the CCR(CCRH), which I realised after your mail.
 
As i had been jumping from the RTI isr which had a priority level of 1  in appl main where we had nested interrupts, the CCR retains this level.
So once i jumped to boot, still the RTI carried a priority level of 1 and was not serviced since the current level in CCR and current RTI levels were same.
 
After clearing the CCRH thro TFR A,CCRH where i had cleared A earlier, RTI started working again.
 
thank you again for your advice.
 
 
 
0 Kudos
Reply