<?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: Bus Fault Exception on accessing internal flash in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339321#M16284</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may also want to look at this thread: &lt;A href="https://community.nxp.com/thread/306244"&gt;Tracking down Hard Faults&lt;/A&gt;. It links to ways to deal with the hard faults.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Sep 2014 12:49:08 GMT</pubDate>
    <dc:creator>ndavies</dc:creator>
    <dc:date>2014-09-26T12:49:08Z</dc:date>
    <item>
      <title>Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339315#M16278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We're using a Kinetis K61 which causes a Bus Fault Exception (exception 5) when accessing a location in the internal flash (address 0xC0010).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as I can tell from UM, the Kinetis Internal Flash does not have any error detection or correction, &lt;STRONG&gt;correct?&lt;/STRONG&gt; Yet I get the exception, &lt;STRONG&gt;how??&lt;/STRONG&gt;. I've been searching high and low for any register flags pointing me to more details but there seems to be none. I've tried turning off cache the whole internal flash area without any difference. The area is corrupt but how can the K61 know that without ECC? BTW, the debugger also fails reading that same address. Mind boggling :smileyhappy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The exact instruction that causes it and &lt;SPAN style="font-size: 13.3333339691162px;"&gt;a printout from my UnhandledException handler which prints information at time of crash:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;0x0809EB58 E8B15018&amp;nbsp; &lt;STRONG&gt;LDM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r1!,{r3-r4,r12,lr}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;-------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.479&amp;gt; &amp;gt;Unhandled Exception!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.479&amp;gt; SP:&amp;nbsp;&amp;nbsp; 0x1FFFCAF8&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.479&amp;gt; PC:&amp;nbsp;&amp;nbsp; 0x0809EB58(0x5018E8B1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.479&amp;gt; LR:&amp;nbsp;&amp;nbsp; 0x080C905B&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.479&amp;gt; PSR:&amp;nbsp; 0x61000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.479&amp;gt; IRQ:&amp;nbsp; 0 BASEPRI: 0x00&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.479&amp;gt; TASK: 30&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;10:32:33.479&amp;gt; ICSR: 0x00000805-&amp;gt;Act:5&lt;/STRONG&gt;,Pend:0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.479&amp;gt; CFSR: 0x00008200 FSTAT:80&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;10:32:33.479&amp;gt; FAR:&amp;nbsp; 0x000C0010&amp;lt;-Valid&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.479&amp;gt; SHCSR: 0x00070002&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.479&amp;gt; HFSR:&amp;nbsp; 0x00000000 MCG: 0x0040026C&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.479&amp;gt; DFSR:&amp;nbsp; 0x00000000 PMC: 0x00042231&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.479&amp;gt;&amp;nbsp;&amp;nbsp; R0:&amp;nbsp; 0x1FFFCB60 R7: 0x00000004&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.479&amp;gt;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;R1:&amp;nbsp; 0x000C0008&lt;/STRONG&gt; R8: 0x1FFFCB60&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt;&amp;nbsp;&amp;nbsp; R2:&amp;nbsp; 0x00000000 R9: 0x000C0028&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt;&amp;nbsp;&amp;nbsp; R3:&amp;nbsp; 0x00000038 R10: 0xAAAAAA1E&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt;&amp;nbsp;&amp;nbsp; R4:&amp;nbsp; 0x6946794D R11: 0x00000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt;&amp;nbsp;&amp;nbsp; R5:&amp;nbsp; 0x00000020 R12: 0x00000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt;&amp;nbsp;&amp;nbsp; R6:&amp;nbsp; 0x000C0008 PSR: 0x61000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt;&amp;nbsp; (LR:&amp;nbsp; 0xFFFFFFFD PSR: 0x60000005)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt; DDRCR30:00000001 IABR[0]:00000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt; MCM_ISR:00020000 IABR[1]:00000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt; MCM_FAD:28AA0020 IABR[2]:00000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt; MCM_FAT:000001B3 IABR[3]:00000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt; MCM_FDR:A8118003 MPU_CES:0001&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt; DMA0_ES:00000000 MPU_ED0:00000000,EA0:00000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt; DMA0_ER:00000000 MPU_ED1:00000000,EA1:00000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt; SPI0_SR:C0004100 MPU_ED2:00000000,EA2:00000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt; SPI1_SR:C2020303 MPU_ED3:00000000,EA3:00000000&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;10:32:33.662&amp;gt; SPI2_SR:00000000 MPU_ED4:00000000,EA4:00000000&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Sep 2014 17:47:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339315#M16278</guid>
      <dc:creator>bjoernjohanness</dc:creator>
      <dc:date>2014-09-23T17:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339316#M16279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bjoem Johannesson,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you please tell me the part number and mask set for that K61? Actually I tried to reproduce this issue on TWR-K70 but seems it works well as expected.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/46223iE30A1D661CE2A502/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I am wondering if you have more K61s to check if the problem is also with other K61s, but if you just have one K61, would you please check how about the&amp;nbsp; result after performing other load instruction such as "LDR Rt, [Rn, #offset] Load Register with word" ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your patience!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 05:32:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339316#M16279</guid>
      <dc:creator>Kan_Li</dc:creator>
      <dc:date>2014-09-24T05:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339317#M16280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kan, thanks for your reply!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The exception isn't coming from the executed instruction, it's because it reads from the internal flash address that's "corrupt". I do have several units and I can reproduce at will, here's a step-by-step:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;SPAN style="color: #1f497d;"&gt;Erase address 0xC0010&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #1f497d;"&gt;Program address &lt;SPAN style="color: #1f497d; font-size: 13.3333339691162px;"&gt;0xC0010 &lt;/SPAN&gt;with a value, e.g. 0x12345678&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #1f497d;"&gt;Now program address &lt;SPAN style="color: #1f497d; font-size: 13.3333339691162px;"&gt;0xC0010 &lt;/SPAN&gt;with a different value, e.g. 0xC0CAC01A (I know this isn’t “allowed” but it triggers the issue)&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="color: #1f497d;"&gt;Read the address &lt;SPAN style="color: #1f497d; font-size: 13.3333339691162px;"&gt;0xC0010 (&lt;/SPAN&gt;if read by microprocessor, e.g. using instruction above, this will cause the Bus Fault Exception)&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Let me know if you can reproduce, thanks!! //bjoern&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Sep 2014 14:49:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339317#M16280</guid>
      <dc:creator>bjoernjohanness</dc:creator>
      <dc:date>2014-09-24T14:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339318#M16281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bjoern,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am sorry, but if you want to program a different value to the same address, you have to erase the sector contains this address firstly, otherwise it would cause bus fault exception, as specified in the spec. so it is not a hardware issue at all. I am wondering why you did it in that way. would you please help to clarify?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Sep 2014 05:30:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339318#M16281</guid>
      <dc:creator>Kan_Li</dc:creator>
      <dc:date>2014-09-25T05:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339319#M16282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kan, thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know programming the same location twice is not allowed without erasing it in between (and we wouldn't normally do that). However, it could still happen and our SW needs to be able to handle it. Therefore we need to have a way to detect it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Three questions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;You mention "&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333339691162px;"&gt;it would cause bus fault exception, as specified in the spec&lt;/SPAN&gt;", I cannot find anything like that. &lt;STRONG&gt;What specification and where in it are you referring to?&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Once it has occurred (in the bus fault exception handler), how do I detect that it was an internal-flash-read-operation that caused the exception? &lt;STRONG&gt;Which register-flag indicate this?&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;I can understand if I get a bus fault while performing the re-write of an address (without erase in between), but &lt;STRONG&gt;how does the internal flash "know" to signal a bus exception&lt;/STRONG&gt; later (after reset etc)? &lt;STRONG&gt;Does it have ECC&lt;/STRONG&gt; (not mentioned anywhere)?&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Sep 2014 15:52:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339319#M16282</guid>
      <dc:creator>bjoernjohanness</dc:creator>
      <dc:date>2014-09-25T15:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339320#M16283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bjoern,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The spec I was referring to is the RM, you may find the following statement in the chapter for FMC:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/46268i53F60D744628CB99/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and when bus fault happens, you may find the reason and address info in the regiters from ARM Cortex M4 core, please refer to the following for details.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/46269iCCF81063A961847E/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.png" alt="2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hope that helps,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Sep 2014 08:00:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339320#M16283</guid>
      <dc:creator>Kan_Li</dc:creator>
      <dc:date>2014-09-26T08:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339321#M16284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may also want to look at this thread: &lt;A href="https://community.nxp.com/thread/306244"&gt;Tracking down Hard Faults&lt;/A&gt;. It links to ways to deal with the hard faults.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Sep 2014 12:49:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339321#M16284</guid>
      <dc:creator>ndavies</dc:creator>
      <dc:date>2014-09-26T12:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339322#M16285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kan,&lt;/P&gt;&lt;P&gt;Thanks for clarifying the reference :smileyhappy: and pointing out BFAR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From RM: "A &lt;STRONG&gt;write operation to program flash memory&lt;/STRONG&gt; or to FlexNVM used as data flash memory &lt;STRONG&gt;results in a bus error&lt;/STRONG&gt;"&lt;/P&gt;&lt;P&gt;=&amp;gt; That reference only talks about &lt;STRONG&gt;write-operations&lt;/STRONG&gt; to the flash, right? Actually, it's not really related to my read-operation causing a Bus Fault but instead pointing out that you can't perform write-operations to flash.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No-where can I find anything saying that &lt;SPAN style="text-decoration: underline;"&gt;reading internal flash could EVER cause a Bus Fault&lt;/SPAN&gt;. This is undocumented behavior and there's no flag anywhere indicating what caused the Bus Fault, possibly one could argue BFAR is hinting at it implicitly.&lt;/P&gt;&lt;P&gt;//bjoern&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Sep 2014 16:18:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339322#M16285</guid>
      <dc:creator>bjoernjohanness</dc:creator>
      <dc:date>2014-09-26T16:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339323#M16286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Norm, I really appreciate your input :smileygrin: &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I have something similar in my SW.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;The problem here is that this behavior (Bus Fault) is undocumented and has no flags indicating the source of the fault. There's no explicit flag to clear, hence when I try to return from the exception handler the Bus Fault is still active and I end up back in the exception handler :smileysad:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;The BFAR register hints at the source but doesn't explicitly tell me that the flash is corrupt and won't allow me to clear the source of the Bus Fault so I can return.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;//bjoern&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Sep 2014 16:26:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339323#M16286</guid>
      <dc:creator>bjoernjohanness</dc:creator>
      <dc:date>2014-09-26T16:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339324#M16287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bjoern,&lt;/P&gt;&lt;P&gt;I have found looking at the IPSR and ICSR registers helpful when you can set a breakpoint in your exception routine.&lt;/P&gt;&lt;P&gt;What debugger tool are you using?&lt;/P&gt;&lt;P&gt;Can you set a breakpoint in the exception routine?&lt;/P&gt;&lt;P&gt;Can you look at the callstack and go "backwards" to see what routine and "C" code specifically was trying to execute?&lt;/P&gt;&lt;P&gt;Are you running MQX or baremetal code or other?&lt;/P&gt;&lt;P&gt;What hardware are you running on?&lt;/P&gt;&lt;P&gt;The more you can show the better we can understand the issue.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Sep 2014 20:49:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339324#M16287</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2014-09-26T20:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339325#M16288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David, thanks for replying!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree those registers are good, if you look at my initial post those are in my crash-report :smileyhappy: Unfortunately there's nothing indicating the source of the bus fault and that is also my issue (I mean I know it's caused by reading from internal flash but there's no flag explicitly indicating that).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes I can easily catch it in the exception handler, the routine that's causing the bus fault is memcpy(). The &lt;STRONG&gt;root cause is reading from internal flash address 0x1C0010 which I've corrupted&lt;/STRONG&gt; on purpose. &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333339691162px;"&gt;No-where can I find anything saying that &lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333339691162px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; text-decoration: underline;"&gt;reading internal flash could EVER cause a Bus Fault&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333339691162px;"&gt;. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It shouldn't matter in regards to my issue but my board is similar design to Tower K70, running modified Quadros RTOS and I use uVision.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Sep 2014 21:32:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339325#M16288</guid>
      <dc:creator>bjoernjohanness</dc:creator>
      <dc:date>2014-09-26T21:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339326#M16289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bjoern,&lt;/P&gt;&lt;P&gt;It is not documented well and I will see if we can improve that somehow with a long answer but...&lt;/P&gt;&lt;P&gt;the short answer is you are generating a flash overprogramming error that corrupts the data when more than one flash programming has occurred to a previously programmed location.&lt;/P&gt;&lt;P&gt;When you do the second program command (writing 0xC0CAC01A) you should see the FSTATA[MGSTAT0] bit set indicating there is a problem.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Sep 2014 22:16:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339326#M16289</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2014-09-26T22:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339327#M16290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;David,&lt;/P&gt;&lt;P&gt;Alright, sounds good. I'd really appreciate to have that mentioned in an official document :smileyhappy: Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this mean that the K61 internal flash has some sort of ECC? If not, how can it detect corrupt data even after a reset? Let me guess that each phrase (8 bytes) has its own ECC, that would explain the "whole-phrase-programming-only" requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your comment on &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333339691162px;"&gt;FSTATA[MGSTAT0]: that only applies to the actual programming right? I.e. not when reading that corrupt data later (&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13.3333339691162px;"&gt;lets say &lt;/SPAN&gt;following a reset)?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Sep 2014 02:14:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339327#M16290</guid>
      <dc:creator>bjoernjohanness</dc:creator>
      <dc:date>2014-09-27T02:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339328#M16291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bjoern,&lt;/P&gt;&lt;P&gt;Sorry for delay.&amp;nbsp; A slight cold set me back.&lt;/P&gt;&lt;P&gt;Correct that the FSTATA[MGSTAT0] &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;only&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;sets during the write to previously written flash location(s) and not during a read.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Our flash does have smarts (IP-Intellectual Property) that is not documented to notify user of the programming error.&amp;nbsp; Your code should test for that condition.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 18:45:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339328#M16291</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2014-09-30T18:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339329#M16292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting! Is there a purpose it's not documented? Seems like an extremely vital thing to have documented.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The actual programming is not an issue for me, I do test for that condition during normal programming. I understand &lt;SPAN style="font-size: 13.3333339691162px;"&gt;that we "shouldn't" program the same area twice without erase and that's not really the issue. I only use this method to trigger the non-documented bus fault. I imagine that the same bus fault would be triggered once the flash get's worn out for example.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's a MAJOR issue if reading from internal flash can cause a non-documented bus fault. (Actually, any non-documented fault/exception is a MAJOR issue). I mean, how are we supposed to handle that if it's not described. Sure, the read data is corrupt but that should't render the microcontroller completely useless, right? It needs to be handled gracefully but as far as I can tell you can't even mask the exception? I hope Freescale understands how serious this is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help David!! //bjoern&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Sep 2014 20:35:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339329#M16292</guid>
      <dc:creator>bjoernjohanness</dc:creator>
      <dc:date>2014-09-30T20:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339330#M16293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bjoern,&lt;/P&gt;&lt;P&gt;Once you have written to the same flash location without an erase step between them, you are running the device out of specification.&amp;nbsp; When operating the device out of specification then we cannot guarantee the operations of the device.&lt;/P&gt;&lt;P&gt;The solution is when you have tested for the error and found the error, then make sure you have erased the sector before flashing again.&lt;/P&gt;&lt;P&gt;Note that continued double (or more) writes to the same flash location will overstress the device.&amp;nbsp; The Reference Manual has the following in the Flash Chapter:&lt;/P&gt;&lt;P&gt;CAUTION&lt;/P&gt;&lt;P&gt;A flash memory location must be in the erased state before&lt;/P&gt;&lt;P&gt;being programmed. Cumulative programming of bits (back-toback&lt;/P&gt;&lt;P&gt;program operations without an intervening erase) within a&lt;/P&gt;&lt;P&gt;flash memory location is not allowed. Re-programming of&lt;/P&gt;&lt;P&gt;existing 0s to 0 is not allowed as this overstresses the device.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 17:12:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339330#M16293</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2014-10-06T17:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339331#M16294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Yes, you are right and I've seen that too.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;In this particular case I do over-program but &lt;SPAN style="text-decoration: underline;"&gt;the same result is expected due to (A) &lt;STRONG&gt;power-loss, (B) wear-out or (C) aging&lt;/STRONG&gt;; whenever the error-checking is incorrect&lt;/SPAN&gt;, right? Let's focus on those three scenarios instead so we don't operate out-of-spec (no more over-programming).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #1f497d;"&gt;Over time, we can conclude they will happen. And since it will happen, &lt;SPAN style="text-decoration: underline;"&gt;we will have to handle it in SW&lt;/SPAN&gt;. Therefore, we need at the very least:&lt;/SPAN&gt;&lt;/P&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;&lt;STRONG style="color: #1f497d;"&gt;Documentation&lt;/STRONG&gt;&lt;SPAN style="color: #1f497d;"&gt;, ECC is not even mentioned and obviously this has a huge impact on our SW-design&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG style="color: #1f497d;"&gt;Indication&lt;/STRONG&gt;&lt;SPAN style="color: #1f497d;"&gt; of what caused the exception (a FTFE-ECC-error flag etc.) &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG style="color: #1f497d;"&gt;Disabling&lt;/STRONG&gt;&lt;SPAN style="color: #1f497d;"&gt; the exception from happening&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 19:05:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339331#M16294</guid>
      <dc:creator>bjoernjohanness</dc:creator>
      <dc:date>2014-10-06T19:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339332#M16295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Hi&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Was it ever clarified how to cope with this situation.&amp;nbsp; We are experiencing the same type of behavior on a K26.&amp;nbsp; We do not do double writes on purpose, but in rare situations we&amp;nbsp;I get hard fault from flash access.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;What is the recommeded way to handle this in software.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Best regards&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;Anders&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2018 11:38:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339332#M16295</guid>
      <dc:creator>aescov</dc:creator>
      <dc:date>2018-04-10T11:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339333#M16296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are encountering the same issue. While i understand that stressing the flash puts it in a bad state, it is extremely annoying to not have a way to detect why the hard fault is happening. The risk of confusing this specific fault (reading from a corrupted flash) with other faults is real.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How did you solve your issue ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2018 15:30:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/339333#M16296</guid>
      <dc:creator>julienblanc</dc:creator>
      <dc:date>2018-09-10T15:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault Exception on accessing internal flash</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/1701403#M65424</link>
      <description>&lt;P&gt;Almost nine years later it is my turn to run into this issue. &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now it is the &lt;EM&gt;LPC5528&lt;/EM&gt; and just like the original author of this thread, my attempt to access flash using the &lt;EM&gt;LDR&lt;/EM&gt; instruction in the certain conditions triggers the "&lt;EM&gt;Bus Fault&lt;/EM&gt;" or "&lt;EM&gt;Hard Fault&lt;/EM&gt;" exception. Though I'm quite sure it is impossible to "fix" this issue currently, I'm still looking forward for the feedback from the support team, because there is no clear explanation in the available documentation. Or it is distributed among many documents which makes it hard to squeeze it out. So maybe the following few lines of text would be helpful for the future readers who might meet this issue.&lt;/P&gt;&lt;P&gt;First, how I actually run into it. It is an outcome of my attempts to save up the erase/program cycles. I've already described it in &lt;A href="https://community.nxp.com/t5/LPC-Microcontrollers/Is-it-possible-to-conserve-the-flash-erase-program-cycles-using/m-p/1701248#M53787" target="_blank" rel="noopener"&gt;this thread&lt;/A&gt;. Long things short, I was going to erase a page once, and then populate the "obtained" pool of the erased space until it runs out. After that erase page and starts from the beginning. And this is how I've got the described issue.&lt;/P&gt;&lt;P&gt;Note, that exact type of the exception being risen depends on your configuration. The "Bus Fault" exception fires only if it is enabled in the register &lt;EM&gt;&lt;A href="https://developer.arm.com/documentation/100235/0004/the-cortex-m33-peripherals/system-control-block/system-handler-control-and-state-register" target="_blank" rel="noopener"&gt;SHCSR&lt;/A&gt;&lt;/EM&gt;, which is part of the System Control Block of the Cortex-M33. Otherwise the "Hard Fault" exception takes its place. So the issue might be reproduced using the following sequences.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Sequence 1 — Bus Fault — Read after erase&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#define FS_START_ADDR 0x0007B600

uint32_t flashBuf[FLASH_PAGE_SIZE / sizeof(uint32_t)];

void flashMemTest(void)
{
  uint32_t flashWord;

  FLASH_Init(&amp;amp;flashConfig);
  flashConfig.modeConfig.readSingleWord.readWithEccOff = kFLASH_ReadWithEccOff;

  FLASH_Erase(&amp;amp;flashConfig, FS_START_ADDR, FLASH_PAGE_SIZE, kFLASH_ApiEraseKey);
  flashWord = *((uint32_t*)FS_START_ADDR);  // BUS FAULT

  while(1);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Sequence 2 — Bus Fault — Read after the second program&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#define FS_START_ADDR 0x0007B600

uint32_t flashBuf[FLASH_PAGE_SIZE / sizeof(uint32_t)];

void flashMemTest(void)
{
    uint32_t flashWord;

    FLASH_Init(&amp;amp;flashConfig);
    flashConfig.modeConfig.readSingleWord.readWithEccOff = kFLASH_ReadWithEccOff;

    FLASH_Erase(&amp;amp;flashConfig, FS_START_ADDR, FLASH_PAGE_SIZE, kFLASH_ApiEraseKey);

    flashBuf[0] = 0x00000000;
    FLASH_Program(&amp;amp;flashConfig, FS_START_ADDR, (uint8_t *)flashBuf, sizeof flashBuf);
    flashWord = *((uint32_t*)FS_START_ADDR + 0);

    flashBuf[1] = 0x11223344;
    FLASH_Program(&amp;amp;flashConfig, FS_START_ADDR, (uint8_t *)flashBuf, sizeof flashBuf);
    flashWord = *((uint32_t*)FS_START_ADDR + 1);  // BUS FAULT
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From my standpoint, it seems like the ECC module is in charge of this behavior. In particular, if in the second sequence one will change "&lt;EM&gt;flashBuf[0] = 0x00000000&lt;/EM&gt;" to "&lt;EM&gt;flashBuf[0] = 0x11223344&lt;/EM&gt;"&amp;nbsp;no fault will be triggered.&amp;nbsp;And it is very confusing, that freshly erased page cannot be accessed. It would be fine to have it populated with 0x00 (though, it really is) or 0xFF.&lt;/P&gt;&lt;P&gt;Nevertheless, it is completely fine to access flash under any conditions using the Flash API. No faults, no errors. Everything is completely fine. See the following example:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Sequence 3 — No Fault — Read using Flash API&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;#define FS_START_ADDR 0x0007B600

uint32_t flashBuf[FLASH_PAGE_SIZE / sizeof(uint32_t)];

void flashMemTest(void)
{
    uint32_t flashWord;

    FLASH_Init(&amp;amp;flashConfig);
    flashConfig.modeConfig.readSingleWord.readWithEccOff = kFLASH_ReadWithEccOff;

    FLASH_Erase(&amp;amp;flashConfig, FS_START_ADDR, FLASH_PAGE_SIZE, kFLASH_ApiEraseKey);
    FLASH_Read(&amp;amp;flashConfig, FS_START_ADDR, (uint8_t *)&amp;amp;flashWord, sizeof flashWord);

    while(1);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Reading the flash memory using the "&lt;EM&gt;FLASH_Read&lt;/EM&gt;" function succeeds in any condition. One may use it as a workaround.&lt;/P&gt;&lt;P&gt;Despite the use case I've presented above is not a typical one and, I believe, highly discouraged by the developers, I'm still curious of the root cause causing of the issue. Is it really the ECC module? Or something else? Could it be disabled? Where can I get more information?&lt;/P&gt;&lt;P&gt;If anyone has a clue, please share.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 00:00:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Bus-Fault-Exception-on-accessing-internal-flash/m-p/1701403#M65424</guid>
      <dc:creator>GlebPlekhotko</dc:creator>
      <dc:date>2023-08-09T00:00:33Z</dc:date>
    </item>
  </channel>
</rss>

