<?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 NXP Bare Metal USB Stack on K20 won't enumerate in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/NXP-Bare-Metal-USB-Stack-on-K20-won-t-enumerate/m-p/491778#M30367</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just taking a shot here.&amp;nbsp; I have known good hardware.&amp;nbsp; I'm using a K20 with a USB3320 PHY.&amp;nbsp; I have an older version of the stack (when it was Freescale) that runs on this same hardware without issue.&amp;nbsp; I'm running High Speed Mode, device mode only, CDC class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to upgrade to a newer version of the stack because the driver code on the older stack, version 3.8.x is virtually incomprehensible from a readability/maintainability standpoint.&amp;nbsp; The upper layers of the CDC class and USB framework are largely the same, though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem I'm having with the 4.1.1. stack is that on the very first enumeration request, the driver sends back all "FF" data in the response packet.&amp;nbsp; I know this because I've traced it with a hardware based USB network analyzer.&amp;nbsp; But the receive side works fine.&amp;nbsp; The incoming setup packet is the correct 8 bytes and the data is correct.&amp;nbsp; The transmit side has the&amp;nbsp; issue.&amp;nbsp; It sends the correct size packet, but the data is garbage.&amp;nbsp; I've verified that the EPLISTADDR is correct, and the DTD pointers look good.&amp;nbsp; I don't see anything obviously wrong.&amp;nbsp; All the functions in the driver are returning success codes.&amp;nbsp; The actual device descriptor, the 18 byte structure, is in memory that should be accessible.&amp;nbsp; Overall, the memory mapping is very similar between the two versions of drivers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does the "FF" filed return paket point to anything basic that I've overlooked?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;rgds,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gary&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 30 Apr 2016 17:06:50 GMT</pubDate>
    <dc:creator>CzechThunder</dc:creator>
    <dc:date>2016-04-30T17:06:50Z</dc:date>
    <item>
      <title>NXP Bare Metal USB Stack on K20 won't enumerate</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/NXP-Bare-Metal-USB-Stack-on-K20-won-t-enumerate/m-p/491778#M30367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just taking a shot here.&amp;nbsp; I have known good hardware.&amp;nbsp; I'm using a K20 with a USB3320 PHY.&amp;nbsp; I have an older version of the stack (when it was Freescale) that runs on this same hardware without issue.&amp;nbsp; I'm running High Speed Mode, device mode only, CDC class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to upgrade to a newer version of the stack because the driver code on the older stack, version 3.8.x is virtually incomprehensible from a readability/maintainability standpoint.&amp;nbsp; The upper layers of the CDC class and USB framework are largely the same, though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem I'm having with the 4.1.1. stack is that on the very first enumeration request, the driver sends back all "FF" data in the response packet.&amp;nbsp; I know this because I've traced it with a hardware based USB network analyzer.&amp;nbsp; But the receive side works fine.&amp;nbsp; The incoming setup packet is the correct 8 bytes and the data is correct.&amp;nbsp; The transmit side has the&amp;nbsp; issue.&amp;nbsp; It sends the correct size packet, but the data is garbage.&amp;nbsp; I've verified that the EPLISTADDR is correct, and the DTD pointers look good.&amp;nbsp; I don't see anything obviously wrong.&amp;nbsp; All the functions in the driver are returning success codes.&amp;nbsp; The actual device descriptor, the 18 byte structure, is in memory that should be accessible.&amp;nbsp; Overall, the memory mapping is very similar between the two versions of drivers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does the "FF" filed return paket point to anything basic that I've overlooked?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;rgds,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gary&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Apr 2016 17:06:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/NXP-Bare-Metal-USB-Stack-on-K20-won-t-enumerate/m-p/491778#M30367</guid>
      <dc:creator>CzechThunder</dc:creator>
      <dc:date>2016-04-30T17:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: NXP Bare Metal USB Stack on K20 won't enumerate</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/NXP-Bare-Metal-USB-Stack-on-K20-won-t-enumerate/m-p/491779#M30368</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;Make sure that the K20 is allowed to read from Flash - it may be trying to respond with a fixed message located in Flash and this causes it to send all 0x00 or possibly all 0xff instead.&lt;/P&gt;&lt;P&gt;To enable this:&lt;/P&gt;&lt;P&gt;FMC_PFAPR |= FMC_FPAPR_USB_HS; // allow USBHS controller to read from Flash&lt;/P&gt;&lt;P&gt;where&lt;/P&gt;&lt;P&gt;#define FMC_FPAPR_USB_HS FMC_PFAPR_M6AP_RD&lt;/P&gt;&lt;P&gt;and &lt;/P&gt;&lt;P&gt;#define FMC_PFAPR_M6AP_RD 0x00001000 // master 6 - read access rights&lt;/P&gt;&lt;P&gt;for the K20F part.&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>Sat, 30 Apr 2016 17:49:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/NXP-Bare-Metal-USB-Stack-on-K20-won-t-enumerate/m-p/491779#M30368</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2016-04-30T17:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: NXP Bare Metal USB Stack on K20 won't enumerate</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/NXP-Bare-Metal-USB-Stack-on-K20-won-t-enumerate/m-p/491780#M30369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much Mark!&amp;nbsp; I will try this and let you know.&amp;nbsp; By the way, we are extremely happy with your HS Flash drive bootloader.&amp;nbsp; Has been working wonderfully for our product.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gary&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Apr 2016 17:52:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/NXP-Bare-Metal-USB-Stack-on-K20-won-t-enumerate/m-p/491780#M30369</guid>
      <dc:creator>CzechThunder</dc:creator>
      <dc:date>2016-04-30T17:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: NXP Bare Metal USB Stack on K20 won't enumerate</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/NXP-Bare-Metal-USB-Stack-on-K20-won-t-enumerate/m-p/491781#M30370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mark's suggestion turned out to be the correct fix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The bare metal stack has a demo project for the Kinetis tower boards.&amp;nbsp; I ported the code from this sample.&amp;nbsp; This project has hardware specific startup that includes the code to unlock flash memory for USBHS access.&amp;nbsp; I didn't include this portion because I have unique hardware and the majority of the sample startup code would not be applicable.&amp;nbsp; But you need this bit because the usb controller needs to access flash memory.&amp;nbsp; The device descriptor is defined as CONST and gets placed in flash memory.&amp;nbsp; Another workaround would be to simply move the descriptor into RAM but it's safer to have in flash as it should be a fixed byte structure in most applications.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again Mark for saving me tearing out the rest of my hair over this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gary&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 May 2016 17:28:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/NXP-Bare-Metal-USB-Stack-on-K20-won-t-enumerate/m-p/491781#M30370</guid>
      <dc:creator>CzechThunder</dc:creator>
      <dc:date>2016-05-01T17:28:56Z</dc:date>
    </item>
  </channel>
</rss>

