<?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 (BFSR) and Hard Fault (HFSR) in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295484#M45563</link>
    <description>&lt;P&gt;The value of the base at this point is&amp;nbsp;1074286592 (decimal)/40085000 (hex). Could it be that the instruction to access the register is causing the problem?&lt;/P&gt;</description>
    <pubDate>Mon, 21 Jun 2021 14:33:19 GMT</pubDate>
    <dc:creator>caden013</dc:creator>
    <dc:date>2021-06-21T14:33:19Z</dc:date>
    <item>
      <title>Bus Fault (BFSR) and Hard Fault (HFSR)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1294855#M45539</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been working on a piece of code recently, trying to input data from an external ADC via SPI communication. To my chagrin, I keep getting active faults in my code: a bus fault and a hard fault (the hard fault is probably due to the bus fault, correct?). I have looked through my code (I mostly just copied code from NXP examples), but I cannot manage to find my errors. I know that it is probably something simple that I am overlooking, but I would appreciate it if anyone could help me out.&lt;/P&gt;&lt;P&gt;Here is the faults tab in MCUXpresso:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="caden013_0-1624034454563.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/147486i08430D052FCD77D2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="caden013_0-1624034454563.png" alt="caden013_0-1624034454563.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have also attached a file with my code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jun 2021 16:43:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1294855#M45539</guid>
      <dc:creator>caden013</dc:creator>
      <dc:date>2021-06-18T16:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault (BFSR) and Hard Fault (HFSR)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295126#M45544</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; ...&amp;nbsp;(the hard fault is probably due to the bus fault, correct?)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Indirectly, yes. If there is no handler for a specific fault, it is escalated to hardfault.&lt;/P&gt;&lt;P&gt;I would suggest this tutorial first:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.keil.com/appnotes/files/apnt209.pdf" target="_blank" rel="noopener"&gt;&lt;SPAN class="result__url__domain"&gt;https://www.keil.com&lt;/SPAN&gt;&lt;SPAN class="result__url__full"&gt;/appnotes/files/apnt209.pdf&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;And then trying to pinpoint the exact location by instruction-stepping (assembler code) in the debugger, at least near the fault.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 04:45:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295126#M45544</guid>
      <dc:creator>frank_m</dc:creator>
      <dc:date>2021-06-21T04:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault (BFSR) and Hard Fault (HFSR)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295289#M45551</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;A id="link_12" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://community.nxp.com/t5/user/viewprofilepage/user-id/187403" target="_self" aria-label="View Profile of caden013"&gt;&lt;SPAN class=""&gt;caden013&lt;/SPAN&gt;&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;Please check have you enable peripheral clocks you used, for example ADC, SPI ...&lt;/P&gt;
&lt;P&gt;Also debug to check which code crash.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 08:20:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295289#M45551</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2021-06-21T08:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault (BFSR) and Hard Fault (HFSR)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295474#M45560</link>
      <description>&lt;P&gt;I have found the line that causes a fault.&lt;/P&gt;&lt;P&gt;base-&amp;gt;MATCH_ACCESS16BIT[s_currentMatch].MATCHL = (uint16_t)matchValue;&lt;/P&gt;&lt;P&gt;This line of code is from the file "fsl_sctimer.c"&lt;/P&gt;&lt;P&gt;The variable s_currentMatch has a value of 0, which is a valid index number, when this line is executed, yet it still causes a fault. Do you know why I receive a fault at this point?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 13:55:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295474#M45560</guid>
      <dc:creator>caden013</dc:creator>
      <dc:date>2021-06-21T13:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault (BFSR) and Hard Fault (HFSR)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295478#M45561</link>
      <description>&lt;P&gt;Is the timer unit properly initialised at that time, i.e. clock enabled ?&lt;/P&gt;&lt;P&gt;I guess not.&lt;/P&gt;&lt;P&gt;This is why I mentioned assember / instruction stepping debug mode. The fault probaly happens when the peripheral register is accessed.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 14:15:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295478#M45561</guid>
      <dc:creator>frank_m</dc:creator>
      <dc:date>2021-06-21T14:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault (BFSR) and Hard Fault (HFSR)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295481#M45562</link>
      <description>&lt;P&gt;What is the value of base at this point? Could it have been corrupted (e.g. stack overflow?)&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 14:25:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295481#M45562</guid>
      <dc:creator>converse</dc:creator>
      <dc:date>2021-06-21T14:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault (BFSR) and Hard Fault (HFSR)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295484#M45563</link>
      <description>&lt;P&gt;The value of the base at this point is&amp;nbsp;1074286592 (decimal)/40085000 (hex). Could it be that the instruction to access the register is causing the problem?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 14:33:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295484#M45563</guid>
      <dc:creator>caden013</dc:creator>
      <dc:date>2021-06-21T14:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault (BFSR) and Hard Fault (HFSR)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295500#M45564</link>
      <description>&lt;P&gt;The timer unit is properly initialized -- the clock for the SCTIMER is enabled. Right before the instruction in question is executed, the value of the base is&amp;nbsp;1074286592. Is it possible that the error is due to the settings for the base?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 15:25:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295500#M45564</guid>
      <dc:creator>caden013</dc:creator>
      <dc:date>2021-06-21T15:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault (BFSR) and Hard Fault (HFSR)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295541#M45566</link>
      <description>&lt;P&gt;You are going to have to debug this yourself - without your exact setup and source code, we can only offer some pointers.&lt;/P&gt;&lt;P&gt;So, as&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/137574"&gt;@frank_m&lt;/a&gt;&amp;nbsp;said, switch to instruction level (assembler) debugging and find the exact instructions that is causing the fault. What is the instruction, and what is the values causing the fault.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 16:13:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295541#M45566</guid>
      <dc:creator>converse</dc:creator>
      <dc:date>2021-06-21T16:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Bus Fault (BFSR) and Hard Fault (HFSR)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295811#M45573</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; Right before the instruction in question is executed, the value of the base is&amp;nbsp;1074286592.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This might be correct, you can check in the MCU's user manual. "&lt;FONT face="courier new,courier"&gt;base&lt;/FONT&gt;" is the base address of the peripheral, and &lt;FONT face="courier new,courier"&gt;SCT_Type&lt;/FONT&gt; is a struct laid over the unit and it's registers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am having a LPC54628, and the SCT0 is at the same address:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/* SCT - Peripheral instance base addresses */
/** Peripheral SCT0 base address */
#define SCT0_BASE         (0x40085000u)
/** Peripheral SCT0 base pointer */
#define SCT0              ((SCT_Type *)SCT0_BASE)&lt;/LI-CODE&gt;&lt;P&gt;Perhaps the stack got corrupted, as converse suggested ?&lt;/P&gt;&lt;P&gt;I would switch to instruction stepping mode (debugging), and check the register values of the "offending" instruction.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jun 2021 05:21:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Bus-Fault-BFSR-and-Hard-Fault-HFSR/m-p/1295811#M45573</guid>
      <dc:creator>frank_m</dc:creator>
      <dc:date>2021-06-22T05:21:17Z</dc:date>
    </item>
  </channel>
</rss>

