I have a simple board based on S32R247. I am trying to get a timer interrupt working and I find that if PIT_0.MCR.B.FRZ is set the interrupt service routine is not called.
the way I test it is to let the program run and then pause after a while and check that the timer ticks have been incremented.
I have started with the sample code from MPC5775k. The board does not have an external oscilator so modified the code to run on the internal one. As the frequencies is 16Mhz instead of 40 everything will take 2.5 time longer as I did not modify the divider values. I have modified the interrupt vector table as well. Attached are the two files I have modified. The rest is as generated by S32DS
To put the FRZ bit in/out I uncomment/comment the following lines. I tried as a bit and as a register. I also tried in DRUN mode. same behaviour
void timer_isr_init(void){
//PIT_0.MCR.R=0x0001; /*freeze on debug*/
//PIT_0.MCR.B.FRZ=0x0001;
PIT_0.MCR.B.MDIS = 0; /* Enable PIT */
Original Attachment has been moved to: main_Z4.c.zip
Original Attachment has been moved to: intc_SW_mode_isr_vectors_S32R274.c.zip
converted the project to single core and it works not. Thank you very much. Still have problems with the FEC started a new thread.
Thank you Martin.
Hello,
which version of S32DS you use?
In the code you shared, I see some issues. You do not call Sysclk_Init and InitPeriClkGen and also I do not know, how you configure interrupts.
I S32DS, there is function xcptn_xmpl which configures global interrupt settings. I recommend you to download S32DS version 1.1 and create project directly for S32R.
I am attaching you simple project which works correct, but PIT interrupt occurs after 10-15 seconds (I used your settings).
Regards,
Martin
PS: Please ignore example name.
Martin,Thank you for your answer. The example I sent you does work and is the same with the one you sent back. what does not work is if you set the PIT_0.MCR.B.FRZ=1 ;void timer_isr_init(void){ //PIT_0.MCR.R=0x0001; /freeze on debug/ PIT_0.MCR.B.FRZ=1; PIT_0.MCR.B.MDIS = 0; /* Enable PIT / //PIT_0.TIMER[0].LDVAL.R = 0x07270E00; / 2s at 60MHz Per clock / // PIT_0.TIMER[0].LDVAL.R = 0x002DC6C0; / 50ms at 60MHz Per clock / PIT_0.TIMER[0].LDVAL.R = 0x11E1A300; / 5s at 60MHz Per clock / PIT_0.TIMER[0].TCTRL.R = 0x00000003; / enable timer CH0 and int */ INTC.PSR[226].R=(unsigned short int)(0x8000 | 0x0F);}
or if you set the register to 1 MCR.R=1 (the line above)
Can you please check that too
Sysclk_init and InitPeriClkGen are called from hw_init() function.
From: b55689 <admin@community.nxp.com>
To: adrian onea <adrian_onea@yahoo.com>
Sent: Monday, 5 June 2017, 20:54
Subject: Re: - Re: timer interrupt does not work when FRZ bit is set
#yiv0250212330 * #yiv0250212330 a #yiv0250212330 body {font-family:Helvetica, Arial, sans-serif;}#yiv0250212330 #yiv0250212330 h1, #yiv0250212330 h2, #yiv0250212330 h3, #yiv0250212330 h4, #yiv0250212330 h5, #yiv0250212330 h6, #yiv0250212330 p, #yiv0250212330 hr {}#yiv0250212330 .yiv0250212330button td {}
|
NXP Community |
|
Re: timer interrupt does not work when FRZ bit is set
reply from Martin Kovar in MPC5xxx - View the full discussionHello, which version of S32DS you use? In the code you shared, I see some issues. You do not call Sysclk_Init and InitPeriClkGen and also I do not know, how you configure interrupts. I S32DS, there is function xcptn_xmpl which configures global interrupt settings. I recommend you to download S32DS version 1.1 and create project directly for S32R. I am attaching you simple project which works correct, but PIT interrupt occurs after 10-15 seconds (I used your settings). Regards,Martin PS: Please ignore example name.
Reply to this message by replying to this email, or go to the message on NXP Community |
Start a new discussion in MPC5xxx by email or at NXP Community |
Following Re: timer interrupt does not work when FRZ bit is set in these streams: Inbox |
This email was sent by NXP Community because you are a registered user.
You may unsubscribe instantly from NXP Community, or adjust email frequency in your email preferences |
|
Hello,
there is a problem with freeze bit implementation in S32 Design Studio (it does not work correct in multi-core projects). Could you please try to create single-core project and test, if it works?
If it does not work even with single-core, I recommend you to use different debugger.
Regards,
Martin