<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: S32K144 Bus fault during instruction prefetch while using LPIT0 ISR. in S32K</title>
    <link>https://community.nxp.com/t5/S32K/S32K144-Bus-fault-during-instruction-prefetch-while-using-LPIT0/m-p/1300973#M11238</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/46737"&gt;@lucianomoretti&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Are the interrupts masked while the flash is being programmed?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can analyze the fault exception further following this example:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.nxp.com/t5/S32K-Knowledge-Base/Fault-handling-on-S32K14x/ta-p/1114447" target="_blank"&gt;https://community.nxp.com/t5/S32K-Knowledge-Base/Fault-handling-on-S32K14x/ta-p/1114447&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Since it is a precise bus fault, the S32_SCB_BFAR register holds an address of the fault memory access.&lt;/P&gt;
&lt;P&gt;And you should be able get the fault instruction too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, the priority of the LPIT interrupt is not set correctly.&lt;/P&gt;
&lt;P&gt;The priority number must be in the 4 MSBs of the IP register.&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;S32_NVIC-&amp;gt;IP[48] = 0xA0; /* IRQ48-LPIT0 ch0: priority 10 of 0-15*/&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
    <pubDate>Thu, 01 Jul 2021 07:16:55 GMT</pubDate>
    <dc:creator>danielmartynek</dc:creator>
    <dc:date>2021-07-01T07:16:55Z</dc:date>
    <item>
      <title>S32K144 Bus fault during instruction prefetch while using LPIT0 ISR.</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Bus-fault-during-instruction-prefetch-while-using-LPIT0/m-p/1300488#M11231</link>
      <description>&lt;P&gt;I'm having an issue where I'm getting a bus fault after enabling the LPIT0 ISR. The timing of the issue is not consistent: sometimes I'll run for a second or two, sometimes I'll run for 10+ seconds. Using a modified version of the AN12218 Bootloader.&lt;/P&gt;&lt;P&gt;Debugger shows my LPIT0_Ch0_IRQHandler called, then another signal handler called for the default handler (I'm guessing it's the Hard Fault Handler)&lt;/P&gt;&lt;P&gt;S32 Design Studio for ARM reports the following on the console:&lt;BR /&gt;BusFault: A bus fault has occurred during instruction prefetching.&lt;/P&gt;&lt;P&gt;CFSR is 0x00000100&lt;/P&gt;&lt;P&gt;HFSR is 0x40000000&lt;/P&gt;&lt;P&gt;I'm enabling it using the following code similar to the code used in the AN5413 S32K1xx Series Cookbook section 2.3:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;	/* set up interrupt handling for the timer */

	S32_NVIC-&amp;gt;ICPR[1] = 1 &amp;lt;&amp;lt; (48 % 32); /* IRQ48-LPIT0 ch0: clr any pending IRQ*/
	S32_NVIC-&amp;gt;ISER[1] = 1 &amp;lt;&amp;lt; (48 % 32); /* IRQ48-LPIT0 ch0: enable IRQ */
	S32_NVIC-&amp;gt;IP[48] =0x0A; /* IRQ48-LPIT0 ch0: priority 10 of 0-15*/

	/* Enable bus clock to PIT */
	PCC-&amp;gt;PCCn[PCC_LPIT_INDEX] = PCC_PCCn_PCS(3) | PCC_PCCn_CGC_MASK;    /* Clock src=3 (FIRC_DIV2_CLK)*/

	/* Turn on PIT */
	LPIT0-&amp;gt;MCR |= LPIT_MCR_M_CEN_MASK; /* enable module clock */
	LPIT0-&amp;gt;MIER = 0x00000001; /* TIE0=1: Timer Interrupt Enabled for Chan 0 */

	/* Configure Channel 0 to trigger as defined in pit.h */
	LPIT0-&amp;gt;TMR[0].TVAL = TRIG_PERIOD;

	/* Enable timer */
	LPIT0-&amp;gt;TMR[0].TCTRL = LPIT_TMR_TCTRL_T_EN_MASK;&lt;/LI-CODE&gt;&lt;P&gt;ISR Code is:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void LPIT0_Ch0_IRQHandler (void) {
	if(LPIT0-&amp;gt;MSR &amp;amp; LPIT_MSR_TIF0_MASK){
		LPIT0-&amp;gt;MSR |= LPIT_MSR_TIF0_MASK; /* Clear LPIT0 timer flag 0 */
		is_triggered = 1;
	}
}&lt;/LI-CODE&gt;&lt;P&gt;is_triggered is a volatile int that's only accessed from one function in the regular code which is not in the call chain when the fault occurs (access has a disable interrupts and put a dsb &amp;amp; isb after disabling interrupts)&lt;/P&gt;&lt;P&gt;When it happens I'm performing a Flash Command Sequence in&amp;nbsp;fsl_flash_driver_c90tfs.c (Copyright 2016), but that's the main thing that the bootloader is doing.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 14:55:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Bus-fault-during-instruction-prefetch-while-using-LPIT0/m-p/1300488#M11231</guid>
      <dc:creator>lucianomoretti</dc:creator>
      <dc:date>2021-06-30T14:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Bus fault during instruction prefetch while using LPIT0 ISR.</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Bus-fault-during-instruction-prefetch-while-using-LPIT0/m-p/1300973#M11238</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/46737"&gt;@lucianomoretti&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Are the interrupts masked while the flash is being programmed?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can analyze the fault exception further following this example:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.nxp.com/t5/S32K-Knowledge-Base/Fault-handling-on-S32K14x/ta-p/1114447" target="_blank"&gt;https://community.nxp.com/t5/S32K-Knowledge-Base/Fault-handling-on-S32K14x/ta-p/1114447&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Since it is a precise bus fault, the S32_SCB_BFAR register holds an address of the fault memory access.&lt;/P&gt;
&lt;P&gt;And you should be able get the fault instruction too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, the priority of the LPIT interrupt is not set correctly.&lt;/P&gt;
&lt;P&gt;The priority number must be in the 4 MSBs of the IP register.&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;S32_NVIC-&amp;gt;IP[48] = 0xA0; /* IRQ48-LPIT0 ch0: priority 10 of 0-15*/&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jul 2021 07:16:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Bus-fault-during-instruction-prefetch-while-using-LPIT0/m-p/1300973#M11238</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2021-07-01T07:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Bus fault during instruction prefetch while using LPIT0 ISR.</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Bus-fault-during-instruction-prefetch-while-using-LPIT0/m-p/1301349#M11245</link>
      <description>&lt;P&gt;Thanks for the info.&lt;/P&gt;&lt;P&gt;I managed to get the behavior I wanted using the polling solution so when I have time I'll go back and try to figure out what was going on. I'm not masking any interrupts during the flash process.&lt;/P&gt;&lt;P&gt;I got the S32_NVIC-&amp;gt;IP settings directly from AN5413&amp;nbsp;S32K1xx Series Cookbook, Rev. 5. Probably should add that to the list of things to fix/revise.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jul 2021 18:05:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Bus-fault-during-instruction-prefetch-while-using-LPIT0/m-p/1301349#M11245</guid>
      <dc:creator>lucianomoretti</dc:creator>
      <dc:date>2021-07-01T18:05:48Z</dc:date>
    </item>
  </channel>
</rss>

