<?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 when setting USB0_CTL |= ODDRST on K60F</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-when-setting-USB0-CTL-ODDRST-on-K60F/m-p/641089#M38840</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found I forgot to set&amp;nbsp;USBFS in&amp;nbsp;SIM_SCGC4. Problem solved. Thank you very much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Sep 2016 18:55:04 GMT</pubDate>
    <dc:creator>danielcaetano</dc:creator>
    <dc:date>2016-09-22T18:55:04Z</dc:date>
    <item>
      <title>Hard fault when setting USB0_CTL |= ODDRST on K60F</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-when-setting-USB0-CTL-ODDRST-on-K60F/m-p/641086#M38837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to use the FSL_USB_Stack on Kinetis MK60FN1 both on the TWR module and on a custom board. When initializing the registers for USB I get a CPU Hard Fault on the instruction&amp;nbsp;USB0_CTL |= USB_CTL_ODDRST_MASK;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried debugging on Instruction stepping mode and the fault occurs on the instruction&amp;nbsp;ldrb.w r2, which is as seen below.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;270 USB0_CTL |= USB_CTL_ODDRST_MASK;&lt;BR /&gt;00002e50: ldr r3, [pc, #320] ; (0x2f94 &amp;lt;USB0_Init+384&amp;gt;)&lt;BR /&gt;00002e52: ldr r2, [pc, #320] ; (0x2f94 &amp;lt;USB0_Init+384&amp;gt;)&lt;BR /&gt;00002e54: ldrb.w r2, [r2, #148] ; 0x94 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;- this one&lt;BR /&gt;00002e58: uxtb r2, r2&lt;BR /&gt;00002e5a: orr.w r2, r2, #2&lt;BR /&gt;00002e5e: uxtb r2, r2&lt;BR /&gt;00002e60: strb.w r2, [r3, #148] ; 0x94&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value of r2&amp;nbsp;right before execution is 0x40072000, which is the base address for the USB registers. 0x94 is the correct offset to access the USBx_CTL registers.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone shed some light on what might be causing this issue?&lt;/P&gt;&lt;P&gt;The project files are attached and, as you can see, I already tried writing into that register in another ways, unsuccessfully.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel Caetano&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2016 15:01:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-when-setting-USB0-CTL-ODDRST-on-K60F/m-p/641086#M38837</guid>
      <dc:creator>danielcaetano</dc:creator>
      <dc:date>2016-09-22T15:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Hard fault when setting USB0_CTL |= ODDRST on K60F</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-when-setting-USB0-CTL-ODDRST-on-K60F/m-p/641087#M38838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hard faults when reading or writing peripherals on Kinetis are usually because the bus clock isn't enabled for the peripheral.&amp;nbsp; Check the SIM module clock gate registers and make sure the bus clock is enabled first.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2016 15:12:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-when-setting-USB0-CTL-ODDRST-on-K60F/m-p/641087#M38838</guid>
      <dc:creator>davidsherman</dc:creator>
      <dc:date>2016-09-22T15:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: Hard fault when setting USB0_CTL |= ODDRST on K60F</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-when-setting-USB0-CTL-ODDRST-on-K60F/m-p/641088#M38839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the answer David.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Right before I attempt the USB0_CTL operation I affect the SIM_CLKDIV2 and the SIM_SOPT2 registers as follows:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt; /* SIM_CLKDIV2: USBFSDIV=4,USBFSFRAC=1 */&lt;BR /&gt; SIM_CLKDIV2 = (uint32_t)((SIM_CLKDIV2 &amp;amp; (uint32_t)~(uint32_t)(&lt;BR /&gt; SIM_CLKDIV2_USBFSDIV(0x03)&lt;BR /&gt; )) | (uint32_t)(&lt;BR /&gt; SIM_CLKDIV2_USBFSDIV(0x04) |&lt;BR /&gt; SIM_CLKDIV2_USBFSFRAC_MASK&lt;BR /&gt; ));&lt;BR /&gt; /* SIM_SOPT2: USBFSRC=0,USBF_CLKSEL=1 */&lt;BR /&gt; SIM_SOPT2 = (uint32_t)((SIM_SOPT2 &amp;amp; (uint32_t)~(uint32_t)(&lt;BR /&gt; SIM_SOPT2_USBFSRC(0x03)&lt;BR /&gt; )) | (uint32_t)(&lt;BR /&gt; SIM_SOPT2_USBF_CLKSEL_MASK&lt;BR /&gt; ));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;The output of PLL0 is 120MHz, so the settings in CLKDIV should yield 120*2/5=48MHz. In SOPT2 I select the clock source as the output of PLL0.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Am I missing something?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2016 16:38:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-when-setting-USB0-CTL-ODDRST-on-K60F/m-p/641088#M38839</guid>
      <dc:creator>danielcaetano</dc:creator>
      <dc:date>2016-09-22T16:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Hard fault when setting USB0_CTL |= ODDRST on K60F</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-when-setting-USB0-CTL-ODDRST-on-K60F/m-p/641089#M38840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found I forgot to set&amp;nbsp;USBFS in&amp;nbsp;SIM_SCGC4. Problem solved. Thank you very much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Sep 2016 18:55:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Hard-fault-when-setting-USB0-CTL-ODDRST-on-K60F/m-p/641089#M38840</guid>
      <dc:creator>danielcaetano</dc:creator>
      <dc:date>2016-09-22T18:55:04Z</dc:date>
    </item>
  </channel>
</rss>

