<?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のトピックWhy do I get USBRST interrupt right after enabling it?</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-do-I-get-USBRST-interrupt-right-after-enabling-it/m-p/364652#M18705</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to get familiar with USBOTG module in Kinetis K60D512 MCU and I'm encountering some issues I'm not sure about.&lt;/P&gt;&lt;P&gt;First I don't understand why there's an USB interrupt signalizing set USBRST right after I enable only this interrupt source before pulling up D+ to signalize attached device.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code I use is the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14146510824033002" jivemacro_uid="_14146510824033002" modifiedtitle="true"&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;///******* CLOCK configuration *****************&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// Configure USB to be clocked from PLL0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;SIM-&amp;gt;SOPT2 |= SIM_SOPT2_PLLFLLSEL_MASK |SIM_SOPT2_USBSRC_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;
&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// Configure USB divider to be 2 (SYSCLOCK = 96MHz)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// USBclk = PLLclk × [ (USBFRAC+1) / (USBDIV+1) ]&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;SIM-&amp;gt;CLKDIV2 = SIM_CLKDIV2_USBDIV(1);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// Enable USB-OTG IP clocking&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;SIM-&amp;gt;SCGC4 |= SIM_SCGC4_USBOTG_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;///********* USB configuration **********&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// Enable interrupts
&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;NVIC_EnableIRQ(USB0_IRQn);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;
&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// Configure enable USB regulator for device&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;SIM-&amp;gt;SOPT1 |= SIM_SOPT1_USBREGEN_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;
&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// enable USB module&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;CTL |= USB_CTL_USBENSOFEN_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// Module reset&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;USBTRC0 |= USB_USBTRC0_USBRESET_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// set BDT address&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;BDTPAGE1 = (uint8_t) ((uint32_t)&amp;amp;bdt &amp;gt;&amp;gt; 8);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;BDTPAGE2 = (uint8_t) ((uint32_t)&amp;amp;bdt &amp;gt;&amp;gt; 16);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;BDTPAGE3 = (uint8_t) ((uint32_t)&amp;amp;bdt &amp;gt;&amp;gt; 24);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// enable control of pullups&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;OTGCTL |= USB_OTGCTL_OTGEN_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;
&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;// enable weak pull-downs and turn on transceiver&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;USB0-&amp;gt;USBCTRL |= USB_USBCTRL_PDE_MASK;&lt;/P&gt;
&lt;P&gt;USB0-&amp;gt;USBCTRL &amp;amp;= ~USB_USBCTRL_SUSP_MASK;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// clear all USB ISR flags&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;ISTAT = 0xFF;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// enable USB RESET interrupt&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;INTEN |= USB_INTEN_USBRSTEN_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;/// !!!! This chunk is executed from an interrupt handler for a button:&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;
&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// signalize attached device&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;CONTROL |= USB_CONTROL_DPPULLUPNONOTG_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;OTGCTL |= USB_OTGCTL_DPHIGH_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;



&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Right after line &lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;INTEN |= USB_INTEN_USBRSTEN_MASK&lt;/STRONG&gt;&lt;/SPAN&gt; there is an interrupt on USB0_IRQ signalizing USBRST event even though the pullup od D+ is off (I could check in OBSERVE reg). But when I press the button and enter its interrupt handler then the regular USBRST event occurs because Windows signalizes new USB device (of course unsuccessfully installed). So is there any reason for this behavior? Getting USBRST interrupt event right after enabling interrupts? I also tried to change the configuration of USB module commenting out and changing some of the previous register configurations but the result is always the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any documentation on the USB controller used in this kinetis I'm using? The reference manual isn't very comprehensive and I think some things would really deserve more information. USB Stack examples really doesn't cover this too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for any help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Oct 2014 06:03:44 GMT</pubDate>
    <dc:creator>flaggermusman</dc:creator>
    <dc:date>2014-10-30T06:03:44Z</dc:date>
    <item>
      <title>Why do I get USBRST interrupt right after enabling it?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-do-I-get-USBRST-interrupt-right-after-enabling-it/m-p/364652#M18705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to get familiar with USBOTG module in Kinetis K60D512 MCU and I'm encountering some issues I'm not sure about.&lt;/P&gt;&lt;P&gt;First I don't understand why there's an USB interrupt signalizing set USBRST right after I enable only this interrupt source before pulling up D+ to signalize attached device.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code I use is the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14146510824033002" jivemacro_uid="_14146510824033002" modifiedtitle="true"&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;///******* CLOCK configuration *****************&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// Configure USB to be clocked from PLL0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;SIM-&amp;gt;SOPT2 |= SIM_SOPT2_PLLFLLSEL_MASK |SIM_SOPT2_USBSRC_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;
&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// Configure USB divider to be 2 (SYSCLOCK = 96MHz)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// USBclk = PLLclk × [ (USBFRAC+1) / (USBDIV+1) ]&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;SIM-&amp;gt;CLKDIV2 = SIM_CLKDIV2_USBDIV(1);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// Enable USB-OTG IP clocking&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;SIM-&amp;gt;SCGC4 |= SIM_SCGC4_USBOTG_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;///********* USB configuration **********&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// Enable interrupts
&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;NVIC_EnableIRQ(USB0_IRQn);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;
&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// Configure enable USB regulator for device&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;SIM-&amp;gt;SOPT1 |= SIM_SOPT1_USBREGEN_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;
&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// enable USB module&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;CTL |= USB_CTL_USBENSOFEN_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// Module reset&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;USBTRC0 |= USB_USBTRC0_USBRESET_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// set BDT address&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;BDTPAGE1 = (uint8_t) ((uint32_t)&amp;amp;bdt &amp;gt;&amp;gt; 8);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;BDTPAGE2 = (uint8_t) ((uint32_t)&amp;amp;bdt &amp;gt;&amp;gt; 16);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;BDTPAGE3 = (uint8_t) ((uint32_t)&amp;amp;bdt &amp;gt;&amp;gt; 24);&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// enable control of pullups&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;OTGCTL |= USB_OTGCTL_OTGEN_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;
&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;// enable weak pull-downs and turn on transceiver&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;USB0-&amp;gt;USBCTRL |= USB_USBCTRL_PDE_MASK;&lt;/P&gt;
&lt;P&gt;USB0-&amp;gt;USBCTRL &amp;amp;= ~USB_USBCTRL_SUSP_MASK;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// clear all USB ISR flags&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;ISTAT = 0xFF;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// enable USB RESET interrupt&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;INTEN |= USB_INTEN_USBRSTEN_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;/// !!!! This chunk is executed from an interrupt handler for a button:&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;
&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;// signalize attached device&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;CONTROL |= USB_CONTROL_DPPULLUPNONOTG_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;OTGCTL |= USB_OTGCTL_DPHIGH_MASK;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;



&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Right after line &lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;USB0-&amp;gt;INTEN |= USB_INTEN_USBRSTEN_MASK&lt;/STRONG&gt;&lt;/SPAN&gt; there is an interrupt on USB0_IRQ signalizing USBRST event even though the pullup od D+ is off (I could check in OBSERVE reg). But when I press the button and enter its interrupt handler then the regular USBRST event occurs because Windows signalizes new USB device (of course unsuccessfully installed). So is there any reason for this behavior? Getting USBRST interrupt event right after enabling interrupts? I also tried to change the configuration of USB module commenting out and changing some of the previous register configurations but the result is always the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any documentation on the USB controller used in this kinetis I'm using? The reference manual isn't very comprehensive and I think some things would really deserve more information. USB Stack examples really doesn't cover this too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for any help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 06:03:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-do-I-get-USBRST-interrupt-right-after-enabling-it/m-p/364652#M18705</guid>
      <dc:creator>flaggermusman</dc:creator>
      <dc:date>2014-10-30T06:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Why do I get USBRST interrupt right after enabling it?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-do-I-get-USBRST-interrupt-right-after-enabling-it/m-p/364653#M18706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Buchta&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. After enabling the USB regulator it is usual to disable its standby mode (remove UVSWE bit)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. When commanding the USB controller reset it is usual to wait for the reset to complete with&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;while (USB0-&amp;gt;USBTRC0 &amp;amp; USB_USBTRC0_USBRESET_MASK) {&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;nbsp; &lt;/TD&gt;&lt;TD&gt;// wait for the reset to complete&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;}&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Before enabling the D+ pull up it is recommended to set 0x40 to USB0-&amp;gt;USBTRC0. This is an undocumented bit but it is set in most code examples and ensures correct pull-up operation (for some reason).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. When both bus lines are low for 2.5us it is detected as a USB reset. Therefore I think you should only enable the RST interrupt once you have actually pulled up the D+ line (for FS mode) and you will need to clear the pending interupt before as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.utasker.com/kinetis.html" title="http://www.utasker.com/kinetis.html"&gt;http://www.utasker.com/kinetis.html&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 21:26:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Why-do-I-get-USBRST-interrupt-right-after-enabling-it/m-p/364653#M18706</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-10-30T21:26:51Z</dc:date>
    </item>
  </channel>
</rss>

