<?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>Kinetis MicrocontrollersのトピックRe: Hard fault caused by Processor Expert</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-caused-by-Processor-Expert/m-p/230143#M4880</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's because the clocks are not gated to that module, because there is no init code.&lt;/P&gt;&lt;P&gt;This will cause a hard fault, when you try to interact with it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Jan 2013 18:40:22 GMT</pubDate>
    <dc:creator>JimDon</dc:creator>
    <dc:date>2013-01-18T18:40:22Z</dc:date>
    <item>
      <title>Hard fault caused by Processor Expert</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-caused-by-Processor-Expert/m-p/230142#M4879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a new user of the Kinetis MCU's.&lt;/P&gt;&lt;P&gt;I am experimenting with the Freedom board.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a simple program on the Freedom board which blinks the RGB leds. Initially, I created the project using "Device Initialization".&lt;/P&gt;&lt;P&gt;Using the Hardware Prespective, I setup the LED ports and the System Timer (SysTick). I then accidentally, clicked on the "DAC0" block in the IC outline, which immediatly generated the following code in the MCUInit module...&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #3f7f5f; font-size: 10pt;"&gt;/* ### Init_DAC &lt;SPAN style="text-decoration: underline;"&gt;init&lt;/SPAN&gt; code */&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style=": ; color: #3f7f5f; font-size: 10pt;"&gt;/* DAC0_C0: DACEN=0,DACRFS=0,DACTRGSEL=0,DACSWTRG=0,LPEN=0,DACBTIEN=0,DACBBIEN=0 */&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;DAC0_C0 &amp;amp;= ( &lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)~(&lt;/SPAN&gt;&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)0xFBU; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* DAC0_SR: DACBFRPTF=0,DACBFRPBF=0 */&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DAC0_SR &amp;amp;= (&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)~(&lt;/SPAN&gt;&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)0xFBU; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* DAC0_DAT0L: DATA0=0 */&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DAC0_DAT0L = (&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)0x00U;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* DAC0_DAT0H: DATA1=0 */&lt;/P&gt;&lt;P&gt;DAC0_DAT0H = (&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)0x00U;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* DAC0_C1: DMAEN=0,DACBFMD=0,DACBFEN=0 */&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DAC0_C1 &amp;amp;= (&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)~(&lt;/SPAN&gt;&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)0xE5U;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* DAC0_C0: DACEN=0,DACRFS=0,DACTRGSEL=0,DACSWTRG=0,LPEN=0,DACBTIEN=0,DACBBIEN=0 */&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DAC0_C0 &amp;amp;= (&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)~(&lt;/SPAN&gt;&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)0xFBU;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&lt;SPAN style=": ; color: #3f7f5f; font-size: 10pt;"&gt;/* ### Init_DAC &lt;SPAN style="text-decoration: underline;"&gt;init&lt;/SPAN&gt; code */&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: 10pt;"&gt;/* CMP0_DACCR: DACEN=0,VRSEL=0,VOSEL=0 */&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CMP0_DACCR = (&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)0x00U;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;The component inspector for the DAC shows that; pins, interrupts, and device initialization are disabled, however, code is ALWAYS generated when the&amp;nbsp; "Generate Code" button is clicked in the Hardware Prespective.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;This in itself would not be a problem, except that apparently, a Hard Fault is generated when the first line of the DAC initialization code is executed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;EM&gt;DAC0_C0 &amp;amp;= ( &lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)~(&lt;/SPAN&gt;&lt;SPAN style="color: #005032; font-size: 10pt;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)0xFBU; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;According to the data sheet, this statement should do nothing more than leave the register as it was before it was called.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Commenting out the initialization code corrects the problem, and allows my test program to run fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;The question is: what is this statement doing to cause a Hard Fault.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I have attached the entire MCUInit module which is causing the fault&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Thanks in advance,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Mike&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337688"&gt;MCUinit.c.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jan 2013 16:13:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-caused-by-Processor-Expert/m-p/230142#M4879</guid>
      <dc:creator>mikethomas</dc:creator>
      <dc:date>2013-01-18T16:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Hard fault caused by Processor Expert</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-caused-by-Processor-Expert/m-p/230143#M4880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's because the clocks are not gated to that module, because there is no init code.&lt;/P&gt;&lt;P&gt;This will cause a hard fault, when you try to interact with it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jan 2013 18:40:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-caused-by-Processor-Expert/m-p/230143#M4880</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2013-01-18T18:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Hard fault caused by Processor Expert</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-caused-by-Processor-Expert/m-p/230144#M4881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Jim for pointing me in the right direction.&lt;/P&gt;&lt;P&gt;Sure enough, when you mouse hover over the DAC clock gate settings in the Component Inspector you get a warning message.&lt;/P&gt;&lt;P&gt;See attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;KLQRUG mentions the need to enable&amp;nbsp; clock gate for; DMA, ADC, UART, TPM, but I did not see it for DAC. I should've assumed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jan 2013 20:59:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-caused-by-Processor-Expert/m-p/230144#M4881</guid>
      <dc:creator>mikethomas</dc:creator>
      <dc:date>2013-01-18T20:59:32Z</dc:date>
    </item>
  </channel>
</rss>

