MPC5744P performnce monitor interrupt problem

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

MPC5744P performnce monitor interrupt problem

544 Views
billie60
Contributor I

Hello!

Now I can enter the performance monitor interrupt! But it's not an interruption in the way I expected. So I still have a problem.

I want to enter the interrupt from IVOR7.

billie60_2-1659436766355.png

 

I set some values in MSR and PM registers in startup.s. Like this:

mfmsr r7
e_or2i r7, 0x1201
mtmsr r7
wrteei 1      //set EE, ME, DE and RI = 1 in MSR


e_bl xcptn_xmpl    //init INTC.IACKR, INTC.BCR and IVPR.


e_lis r7, 0x8000
e_or2i r7, 0x0000
mtpmr 400, r7           //freeze all global counters
se_isync



e_lis r7, 0x0402 
e_or2i r7, 0x7000 
mtpmr 144, r7  //set up Instructions completed event in counter 0,                                                 se_isync         //(set CE and EVENT = 0000 0010 in PMLCa0 register)

 

e_lis r7, 0X7fff
e_or2i r7, 0xffff 
mtpmr 16, r7    //Set the initial value of PMC0 to 7fffffff, that is, interrupt after running an instruction.
se_isync

e_lis r7, 0x4000
e_or2i r7, 0x0000
mtpmr 400, r7   //un-freeze all global counters, set PMGC[PMIE] = 1, 
se_isync            //Performance monitor interrupt Enable

;# Jump to Main
e_bl main

I write main like this:

void IVOR7_Exception_Handler(void);

int inhandler = 0;
int main(void)
{
         int a = 1;
         int b = 2;

         for(;;)
         {
            a++;
            b++;

          }
}

void IVOR7_Exception_Handler(void){
            inhandler ++;

}

My idea is to trigger the performance monitor interrupt when the program runs an instruction. But when it running, inhandler still = 0.

billie60_0-1659437038996.jpeg

 

 

However, when I run the dead loop in the program, press the reset key of the development board. Then I suspend the code and check the expressions view, inhandler changed to 1.

billie60_1-1659437047196.jpeg

 

But why can't the interrupt be entered when the program is running normally, and the inhandler value can only be changed after pressing the reset key? I have no idea. Can you help me?

Thank you so much.

0 Kudos
Reply
2 Replies

537 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

It seems to me as coincidence, as registers are re-initialized after reset.

Please check how you set-up PMU events. How you have  it, it does not fit to AN4341 description:

davidtosenovjan_0-1659444043556.png

 

0 Kudos
Reply

532 Views
billie60
Contributor I

Hello, David

I'm afraid it's no coincidence that the value of inhandler will be changed only after pressing the reset button, because I've tried it many times, and the results are the same. And, I think AN4341's description of set events is wrong. You can see this at https://www.nxp.com/docs/en/supporting-information/ftf-acc-F1184.pdf

d30351dc17b49e8ff547ffdc51e528f.jpg

Obviously, the event is set in bits 8-15 of the register (the eighth bit is also the event bit), but the event in your image is set after 16 bits. 

I hope you can help me see what the problem is from the perspective of code logic. Thank you soooo much.

 

0 Kudos
Reply