<?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: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308107#M13151</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After much faffing around with both IAR and Segger J-Flash, I can confirm that the bin/srec files you supplied for a CDC do not work on my board.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried erasing and re-programming several times without success.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can re-load the MSD example you sent me and that enumerates correctly however the CDC device does not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 May 2014 22:06:49 GMT</pubDate>
    <dc:creator>weblar</dc:creator>
    <dc:date>2014-05-29T22:06:49Z</dc:date>
    <item>
      <title>USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308095#M13139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've taken the K21 USB CDC example from the Freescale USB stack 4.11 and I've customized it to fit my K22 (not much needed changing to be honest).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the application started, I was prompted to install the drive which Freescale kindly supplied with the aforementioned example code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, I now always get a "device cannot start" error in device manager against the "Virtual Com Port" device and I can't for the life of me figure out what's going on. The USB_ISR interrupt seems to trigger correctly - my only thought would be as to whether I have correctly configured the clocking for the USB peripheral. I have an 8MHz crystal as the source with the device running at 120MHz, the following code is how I've configured the USB peripheral...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'courier new', courier;"&gt;void usb_init(void) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&amp;nbsp; // 2 / 5 * 120MHz = 48MHz&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&amp;nbsp; SIM_CLKDIV2 = SIM_CLKDIV2_USBDIV(4) | SIM_CLKDIV2_USBFRAC_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&amp;nbsp; // Clock the USB from the PLL&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&amp;nbsp; SIM-&amp;gt;SOPT2 |= SIM_SOPT2_USBSRC_MASK | SIM_SOPT2_PLLFLLSEL_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&amp;nbsp; // Enable USB OTG module clock&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&amp;nbsp; SIM-&amp;gt;SCGC4 |= SIM_SCGC4_USBOTG_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&amp;nbsp; USB0-&amp;gt;USBTRC0 = 0x40;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&amp;nbsp; // Allow the USBREGEN bit in SOPT1 to be changed&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&amp;nbsp; //SIM-&amp;gt;SOPT1CFG |= SIM_SOPT1CFG_URWE_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&amp;nbsp; // Enable the USB regulator&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&amp;nbsp; SIM-&amp;gt;SOPT1 |= SIM_SOPT1_USBREGEN_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&amp;nbsp; // Clear any pending USB interrupts&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&amp;nbsp; nvic_clear_irq(INT_USB0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&amp;nbsp; // Enable the USB interrupt&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&amp;nbsp; nvic_enable_irq(INT_USB0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: 'courier new', courier;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For reference, here is my mcg init code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;void mcg_init(void) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; // Select the internal load capacitors for a capacitance of about 18pF&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; OSC0-&amp;gt;CR = (uint8_t)(OSC_CR_SC2P_MASK | OSC_CR_SC16P_MASK);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; // Enable the 8MHz crystal&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; MCG-&amp;gt;C2 = (uint8_t)(MCG_C2_EREFS0_MASK | MCG_C2_RANGE0(2));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; // Select the external oscillator and set the FLL reference divider&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; MCG-&amp;gt;C1 = (uint8_t)(MCG_C1_CLKS(2) | MCG_C1_FRDIV(3));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; // Wait for the oscillator to initialize&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; while (!(MCG-&amp;gt;S &amp;amp; MCG_S_OSCINIT0_MASK)) { }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; // Wait for the reference clock to switch to the external reference&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; while (MCG-&amp;gt;S &amp;amp; MCG_S_IREFST_MASK) { }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; // Wait for MCGOUTCLK to switch over to the external reference clock&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; while ((MCG-&amp;gt;S &amp;amp; MCG_S_CLKST_MASK) != MCG_S_CLKST(2)) { }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; // Divide by 2 for a PLL0 frequency of 4MHz&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; MCG-&amp;gt;C5 = (uint8_t)(MCG_C5_PRDIV0(1));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; // PLL0 - Multiply by 30 to give 120MHz&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; MCG-&amp;gt;C6 = (uint8_t)(MCG_C6_CME0_MASK | MCG_C6_PLLS_MASK | MCG_C6_VDIV0(6));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; // Wait for the PLLST bit to be set, when PLLCS has obtained a lock&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; while (!(MCG-&amp;gt;S &amp;amp; MCG_S_PLLST_MASK)) { }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; // Wait for PLL0 to lock&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; while (!(MCG-&amp;gt;S &amp;amp; MCG_S_LOCK0_MASK)) { }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; // Set the clocks to the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; // CORE_CLK = 120MHz (0 = div 1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; // BUS_CLK = 60MHz (1 = div 2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; // FLEXBUS_CLK = 40MHz (3 = div 4)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; // FLASH_CLK = 20MHz (5 = div 6)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; SIM-&amp;gt;CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(1) | SIM_CLKDIV1_OUTDIV3(3) | SIM_CLKDIV1_OUTDIV4(5);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; //MCG_C1 &amp;amp;= ~MCG_C1_CLKS_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; MCG-&amp;gt;C1 = (uint8_t)(MCG_C1_CLKS(0) | MCG_C1_FRDIV(3));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; while ((MCG-&amp;gt;S &amp;amp; MCG_S_CLKST_MASK) != MCG_S_CLKST(3)) { }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; MPU-&amp;gt;CESR = 0x00;&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;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As far as I'm aware, this is all correct as per the K21 example - apart from my device running up at 120MHz.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd be grateful if anyone could provide any hints or tips as to what may be the cause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 12:51:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308095#M13139</guid>
      <dc:creator>weblar</dc:creator>
      <dc:date>2014-05-29T12:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308096#M13140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For reference, I'm running Windows 7 on an AMD64 bit processor - whether this is a driver related issue, I'm not sure.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 13:51:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308096#M13140</guid>
      <dc:creator>weblar</dc:creator>
      <dc:date>2014-05-29T13:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308097#M13141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't have a K22 board to test on but I believe that the K22F120 is identical to the K21F120 in terms of USB and clocks and your clock setup does look to match a K21F120.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Presumably you don't have a USB analyser to monitor the enumeration but if the enumeration is succesful (there will be a point in the code where you could set a breakpoint to determine this) there is probably a driver problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It often makes sense to try with USB-HID mouse or USB-MSD first since these are user-friendlier and don't have potential driver issues - if they operate, USB-CDC will presumably operate as well (baring driver problems).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a USB-MSD loader (binary) for the K21F120 tower board (uses 8MHz oscillator and the USB should be HW independent) at &lt;A href="http://www.utasker.com/SW_Demos.html#K20" title="http://www.utasker.com/SW_Demos.html#K20"&gt;µTasker Test Software and Demos&lt;/A&gt; which you could load to your K22. If it appears as a hard-drive it would prove basic USB operation on your board and you could do a register dump of the clock registers to be sure that there are no differences to your setup (it also configures for 120MHz PLL operation).&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 16:31:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308097#M13141</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-05-29T16:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308098#M13142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your comments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, I don't have a hardware USB analyzer but I do have a software one which I've been using however I'm still unable to determine the root cause. Enumeration doesn't seem to complete successfully however the USB_ISR enters as I expect it to. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good idea about getting a much simpler project up and running - I guess when I initially designed the K22 into my project, I had hoped for a few more examples from Freescale but like you've mentioned, the K21 is almost identical.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the link, I shall give the uTasker demo a try although admittedly, I've never used uTasker before so I may be in touch with further questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 17:02:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308098#M13142</guid>
      <dc:creator>weblar</dc:creator>
      <dc:date>2014-05-29T17:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308099#M13143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I've downloaded the uTasker demo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Presumably, I need to program on the uTaskerSerialLoader first? Or can I just blast the USB_software_1.4.003.bin file on?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 17:18:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308099#M13143</guid>
      <dc:creator>weblar</dc:creator>
      <dc:date>2014-05-29T17:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308100#M13144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Program the file "&lt;STRONG&gt;uTaskerSerialLoader_K21_F120.S19&lt;/STRONG&gt;" to the board to see whether it appears as a hard drive when connected via USB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other files are applications that can be downloaded via the USB connection but are probably not of further interest in checking that the USB is OK.&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 17:30:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308100#M13144</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-05-29T17:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308101#M13145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've just loaded the file in using the Segger J-Flash application. I was prompted to confirm that overwriting location 0 might read-protect the chip but I clicked OK anyway. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having power cycled my board, nothing seems to be happening - could the firmware be looking for other peripherals that aren't present?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 18:02:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308101#M13145</guid>
      <dc:creator>weblar</dc:creator>
      <dc:date>2014-05-29T18:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308102#M13146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Aha, clearly it hadn't programmed correctly the first time. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I now have a uTasker USB MSD Loader USB Device appearing in Device Manager. I guess this confirms that the USB is working correctly...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 18:05:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308102#M13146</guid>
      <dc:creator>weblar</dc:creator>
      <dc:date>2014-05-29T18:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308103#M13147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've since downloaded the Microsoft Message Analyzer tool to try and help diagnose whats going on. To be honest, I don't really know what I'm looking for but as far as I can see, everything appears to be normal - no errors are highlighted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a screenshot of the message trace.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="trace.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/43847i621E019B83E52116/image-size/large?v=v2&amp;amp;px=999" role="button" title="trace.png" alt="trace.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I guess the next thing to do is to compare it to another USB to serial device, such as an FTDI board I have.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Hmmm....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 18:46:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308103#M13147</guid>
      <dc:creator>weblar</dc:creator>
      <dc:date>2014-05-29T18:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308104#M13148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So technically, I'm not comparing apples to apples but I think the test is good enough. Here's a capture of the FTDI trace and there's a lot more stuff going on. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="trace2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/43902i40810F38A1658E41/image-size/large?v=v2&amp;amp;px=999" role="button" title="trace2.png" alt="trace2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For a start there is an "Internal URB_FUNCTION_CONTROL_TRANSFER" which happens immediately after the "URB_FUNCTION_SELECTION_CONFIGURATION" which happens to be the last message in my non-working trace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could this then be an issue with the Freescale USB stack? Anyone from Freescale able to help with this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 18:50:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308104#M13148</guid>
      <dc:creator>weblar</dc:creator>
      <dc:date>2014-05-29T18:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308105#M13149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know how to interpret the message analyzer outputs - also FTDI is probably using a different driver to the standard inbuilt one (&lt;EM&gt;usbser.sys&lt;/EM&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached is an application using USB-CDC on the K21F120 - since the USB-MSD operates on your board this should do also (it doesn't use any other peripherals). There are &lt;STRONG&gt;.bin&lt;/STRONG&gt; and &lt;STRONG&gt;.srec&lt;/STRONG&gt; version plus&amp;nbsp; &lt;STRONG&gt;uTaskerFreescaleVirtualCOM.inf&lt;/STRONG&gt; and &lt;STRONG&gt;uTaskerFreescaleVirtualCOM_64bit.inf&lt;/STRONG&gt; which will be needed so that Windows can install the driver (probably you need the 64 bit one). This uses &lt;STRONG&gt;usbser.sys&lt;/STRONG&gt; (standard one available in Windows). When connected to the interface there will be a command line menu with various possibilities and all debug output is sent there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757; text-decoration: underline;"&gt;To clear up the basic issue faster it may be best if you send me your own bin or srec file so that I can load it to the TWR K21F120 board - with my USB analysers I can quickly see if and where there is a problem. HW analysers see much more that the SW ones, which I never found of much use unless you have a fully working system and need to just check up on application layer messages.&lt;/SPAN&gt;&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;/P&gt;&lt;P&gt;Note also that you can download the uTasker project at &lt;A href="http://www.utasker.com/forum/index.php?topic=1721.0" title="http://www.utasker.com/forum/index.php?topic=1721.0"&gt;KINETIS Project Code&lt;/A&gt; which contains the USB stack that works out-of-the-box on all KL or K processors with USB (supporting various classes). It can be used with CW10.x, KDS, CooCox, IAR, Keil, Rowley or GCC - for any board it takes 5 project settings to get USB-CDC operating [set the processor type, set the board type, set the linker script to match the processor, enable USB interface, select USB-CDC class]&lt;/P&gt;&lt;P&gt;The USB interface is documented here &lt;A href="http://www.utasker.com/docs/uTasker/USB_User_Guide.PDF" title="http://www.utasker.com/docs/uTasker/USB_User_Guide.PDF"&gt;http://www.utasker.com/docs/uTasker/USB_User_Guide.PDF&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The advantages of the USB stack in the uTasker project are that&lt;/P&gt;&lt;P&gt;- it has been proven over several years operation in various industrial projects (also in Coldfire ones using essentially the same software).&lt;/P&gt;&lt;P&gt;- It has small footprint.&lt;/P&gt;&lt;P&gt;- Constructed from three files it is easy to understand and manage, is compatible with all KL and K devices and all build tools &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- HW driver - handling all HW details&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- generic USB module - handling all generic USB needs&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; -- USB application - defining the class and the application layer function&lt;/P&gt;&lt;P&gt;- the generic and application/class code is used also in Coldfire V2 projects with no change (the HW driver is in fact 90% identical to the Coldfire one too).&lt;BR /&gt;- &lt;STRONG&gt;it allows all USB operation to be emulated in the uTasker Kinetis simulator so complete USB projects can be developed, tested and debugged using VisualStudio (&lt;EM&gt;free Express edition is adequate&lt;/EM&gt;). This avoids HW debugging which can otherwise be tricky with USB protocols. The simulator also allows studing and learning USB by executing the emulation process and stepping through the code (including all USB interrupts that take place)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;- The project has a powerful MODBUS extension which supports MODBUS TCP or serial masters and slaves. The USB-CDC interface implementation directly allows MODBUS ASCII over USB!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 20:56:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308105#M13149</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-05-29T20:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308106#M13150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your comprehensive reply - your comments and feedback are greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I shall give the firmware you've supplied a try in a tick once I've figured out why the J-Flash software keeps crashing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached is my bin file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 21:10:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308106#M13150</guid>
      <dc:creator>weblar</dc:creator>
      <dc:date>2014-05-29T21:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308107#M13151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After much faffing around with both IAR and Segger J-Flash, I can confirm that the bin/srec files you supplied for a CDC do not work on my board.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried erasing and re-programming several times without success.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can re-load the MSD example you sent me and that enumerates correctly however the CDC device does not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 22:06:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308107#M13151</guid>
      <dc:creator>weblar</dc:creator>
      <dc:date>2014-05-29T22:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308108#M13152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kevin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I didn't have problems with the &lt;STRONG&gt;.bin&lt;/STRONG&gt; file that I tested in the TWR-K21F120 but maybe there was something in there still that the K22 doesn't like (?) I found that ADC1 was being sampled at 8kHz and passed to DAC0 using DMA (after 1 second delay) so I have disabled this in the attached version (although both devices have ADC1 and DAC0 so I wouldn't expect this to affect operation).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I have loaded your bin to my board and have some results:&lt;/P&gt;&lt;P&gt;- After installing the driver (using &lt;STRONG&gt;fsl_ucwxp.inf&lt;/STRONG&gt;) I get the same error message that you have&lt;/P&gt;&lt;P&gt;- The basic problem is that the enumeration doesn't work fully. It works enough for the driver to be installed but fails when the host requests the Configuration descriptor from the device.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The configuration descriptor informs the host about the interface (that it is a communication control class, its power consumption, the endpoints that are used and the requiremenst of these endpoints). Most of the data content is correct but the overall data is malformed. There is one not-quite-right setting where the device says that it is self-powered but still needs 100mA, but this doesn't cause the failure. The failure actually comes from the fact that the data returned is an incorrect length - there are 198 extra zeroes sent back and the host presumably rejects it due to this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I took a quick look at the Freescale USB Stack v4.1.1 and have the feeling that the define for the length of the data is incorrect.&lt;/P&gt;&lt;P&gt;It is defined as&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;uint_8 USB_DESC_CONST g_config_descriptor[CONFIG_DESC_SIZE] =&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;and there are various sources for the define &lt;STRONG&gt;CONFIG_DESC_SIZE&lt;/STRONG&gt;, whereby it looks like the following may be used&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;#define CONFIG_DESC_SIZE&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;(CONFIG_ONLY_DESC_SIZE + 28 +&amp;nbsp;&amp;nbsp; \&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&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;&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;(CIC_NOTIF_ELEM_SUPPORT &amp;amp; 0x01) \&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&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;&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;* 7 + DATA_CLASS_SUPPORT * 23)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Possibly you have used some configuration/project setting that breaks the code because I don't think that there is any compiler dependency involved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would try removing the length from the definition of the &lt;STRONG&gt;g_config_descriptor[]&lt;/STRONG&gt; because it is not needed. I would also ensure that any code using &lt;STRONG&gt;g_config_descriptor[]&lt;/STRONG&gt; works with the array length and not the &lt;STRONG&gt;CONFIG_DESC_SIZE&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;Eg. a routine sending this descriptor would better use a pointer to &lt;STRONG&gt;g_config_descriptor&lt;/STRONG&gt; and &lt;STRONG&gt;sizeof(g_config_descriptor)&lt;/STRONG&gt; and not a pointer to &lt;STRONG&gt;g_config_descriptor&lt;/STRONG&gt; and &lt;STRONG&gt;CONFIG_DESC_SIZE&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I expect that the CDC driver essentially works but I see that there are a handful of devices supported, each with its own set of project files and some local defines. Probably the code based on the define is "difficult to maintain" code since it may need to be right in all device types/configurations. It may work in one but not work in another because it hasn't been tested or corrections were not made at all locations where neeed. As noted above I don't see any need for this critical define value since the array size should take care of itself.&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;P.S. Such errors are not easy to identify without a HW analyser and I recomment investing in one if working with USB based projects.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2014 23:16:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308108#M13152</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-05-29T23:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308109#M13153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for the late response - I've only just managed to sit down to try your code and also to try the change you suggested.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, loading your new binary still makes no difference - the device won't even enumerate. Also, I've implemented the changed you suggest regarding the g_config_descriptor but it seems to make no difference, I still get a "device cannot start" error message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm now utterly confused as your initial USB MSD example worked perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you again for all your help with this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 May 2014 20:00:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308109#M13153</guid>
      <dc:creator>weblar</dc:creator>
      <dc:date>2014-05-30T20:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308110#M13154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One brief observation is that in the Freescale code in usb_descriptor.c at line 485 which is in the USB_Desc_Get_Descriptor function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've added a printf statement which outputs the type of descriptor and the size of the descriptor being requested, as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;else if (type &amp;lt; USB_MAX_STD_DESCRIPTORS+1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Set return val for descriptor and size */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *descriptor = (uint8_t*)g_std_descriptors [type];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* if there is no descriptor then return error */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(*descriptor == NULL)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return USBERR_INVALID_REQ_TYPE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *size = g_std_desc_size[type];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("Type: %d, Size: %d\r\n", type, *size);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've sent a breakpoint on the first line of the "if" clause and I can see that this code executes 5 times throughout the enumeration process. After the first 3 times, device manager reports no issue with the device, it enumerates and appears available for use. The next two times the code executes seems to be where the error occurs and if I allow the code to continue, the device then reports that it cannot start.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output from the printf is this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Type: 1, Size: 18&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Type: 1, Size: 18&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Type: 2, Size: 5711&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Type: 1, Size: 18&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Type: 2, Size: 5711&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its late so I'm now giving up for the night. It won't beat me!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 May 2014 20:13:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308110#M13154</guid>
      <dc:creator>weblar</dc:creator>
      <dc:date>2014-05-30T20:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308111#M13155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kevin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately I can't explain why the application doesn't want to work (either generally or in relation to the USB interface) on your board since it runs correctly on my TWR-K21F120 and I didn't notice any difference between basic configurations of the K21F120 boot loader (USB-MSD) and the application.&lt;/P&gt;&lt;P&gt;You could load the complete project from &lt;A href="http://www.utasker.com/forum/index.php?topic=1721.0" title="http://www.utasker.com/forum/index.php?topic=1721.0"&gt;KINETIS Project Code&lt;/A&gt; if you like and then you may be able to work out why - I can't imagine it is something big but I can't think what at the moment. Assuming you are using CW10.x you just need to do the following:&lt;/P&gt;&lt;P&gt;1. Copy the CW10.x project settings from \Applications\uTaskerV1.4\KinetisCodeWarrior\ProjectSettings to the top of the project directory (the latest version has KDS files there and they can't co-exist)&lt;/P&gt;&lt;P&gt;2. Import to CW10.6&lt;BR /&gt;3. In \Applications\uTaskerV1.4\config.h enable KINETIS_K20 and TWR_K21F120M to select base family and the board (that should be compatible)&lt;/P&gt;&lt;P&gt;4. In the same file make sure that USB_INTERFACE is enanble to activate USB support&lt;/P&gt;&lt;P&gt;5. In the same file make sure that USE_USB_CDC is enabled (and not other classes)&lt;/P&gt;&lt;P&gt;6. In CW10.x processor settings make sure that Cortex-M4 (and not Cortex-M0+) is used&lt;BR /&gt;7. In the CW10.x linker script setting ensure that the linker script matches the device&amp;nbsp; K_1M_128.lc or K_512_128.lc would be OK, for example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By adjusting 3, 6 and 7 appropriately I can can switch between all K and KL processors/boards that I have (almost all existing ones...) and USB-CDC runs correctly (K22F120 should essentially be a subset of K21F120 since there is no eval board for it).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am also surprised that you don't detect a difference if the &lt;STRONG&gt;g_config_descriptor&lt;/STRONG&gt; length has been corrected - it was certainly the (first) problem since the USB analyser called it a "malformed" frame.&lt;/P&gt;&lt;P&gt;If you send me the latest binary I could give it another go to see whether it gets past this and discovers a further problem (it didn't get any further the last time and there are a number of enumeration steps still to go...) to determine whether there are good chances of a quick fix.&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 May 2014 20:26:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308111#M13155</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-05-30T20:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308112#M13156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sizes should be as follows for USB-CDC:&lt;/P&gt;&lt;P&gt;1, 18&lt;/P&gt;&lt;P&gt;1, 18&lt;/P&gt;&lt;P&gt;2, 67&lt;/P&gt;&lt;P&gt;1, 18&lt;/P&gt;&lt;P&gt;2, 67&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 is the device descriptor which is always 18 bytes in length . The host always requests this a number of times.&lt;/P&gt;&lt;P&gt;2 is the configuration descriptor, again the host usually requests it about twice. The length of this coulld vary slightly (a couple of bytes) depending on exact settings but your values look to be huge.&lt;BR /&gt;It could be that there is a different problem since I saw only that there were about 196 additional zeroes being sent but this may have been limited by the routine not sending more that than and it could have been trying to send thousands too many in the first place...&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 May 2014 20:35:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308112#M13156</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-05-30T20:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308113#M13157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also can't understand why, its really not making any sense to me - especially given that the MSD works perfectly. Given that the silicon is presumably very similar to the K21 devices plus there is nothing in any errata which highlights a USB issue then I would have assumed that it would just work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm actually using IAR but I believe uTasker supports this environment?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Changing the g_config_descriptor length makes absolutely no difference. I'll do a build again tomorrow (I've put the code back as-was) and I'll upload it here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It probably would be beneficial if a Freescale FAE could comment, or maybe someone involved in the stack development. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For reference, what hardware USB analyser do you use? I've used an Ellisys Explorer 200 before now but they're a bit pricey - especially for a home user!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 May 2014 20:40:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308113#M13157</guid>
      <dc:creator>weblar</dc:creator>
      <dc:date>2014-05-30T20:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: USB CDC Device on a K22FN1M0VLH12 - Device Cannot Start</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308114#M13158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, this requires further investigation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for updating what the sizes should be - one thing about the Freescale code that does get baffling, which you've highlighted previously, is the number of #defines accounting for almost every variation of device. It makes it really difficult to follow the path which the code will take. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 May 2014 20:44:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-CDC-Device-on-a-K22FN1M0VLH12-Device-Cannot-Start/m-p/308114#M13158</guid>
      <dc:creator>weblar</dc:creator>
      <dc:date>2014-05-30T20:44:08Z</dc:date>
    </item>
  </channel>
</rss>

