<?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 USB Stack: Putting enumeration strings in FLASH? in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Stack-Putting-enumeration-strings-in-FLASH/m-p/311103#M13390</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using the USB Stack v4.1.1 (for HID device) on an MK20DX128VLH5, I noticed that the enumeration structures were in RAM due to the following macro definitions at the top of usb_descriptor.c:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if (defined __MCF52xxx_H__) || (defined __MK_xxx_H__)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;/* Put descriptors in RAM */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;#define USB_DESC_CONST&lt;/P&gt;&lt;P&gt;#else&lt;/P&gt;&lt;P&gt;#define USB_DESC_CONST const&lt;/P&gt;&lt;P&gt;#endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where __MK_xxx_H__ is defined in the project.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I change the macro above to only "#if (defined __MCF52xxx_H__)" in order to put the structures into FLASH the code will compile fine (IAR EWARM) but the device will not enumerate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a fundamental reason that the enumeration strings can not be in FLASH?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bill&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 May 2014 16:37:26 GMT</pubDate>
    <dc:creator>wre</dc:creator>
    <dc:date>2014-05-06T16:37:26Z</dc:date>
    <item>
      <title>USB Stack: Putting enumeration strings in FLASH?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Stack-Putting-enumeration-strings-in-FLASH/m-p/311103#M13390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Using the USB Stack v4.1.1 (for HID device) on an MK20DX128VLH5, I noticed that the enumeration structures were in RAM due to the following macro definitions at the top of usb_descriptor.c:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if (defined __MCF52xxx_H__) || (defined __MK_xxx_H__)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;/* Put descriptors in RAM */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;#define USB_DESC_CONST&lt;/P&gt;&lt;P&gt;#else&lt;/P&gt;&lt;P&gt;#define USB_DESC_CONST const&lt;/P&gt;&lt;P&gt;#endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where __MK_xxx_H__ is defined in the project.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I change the macro above to only "#if (defined __MCF52xxx_H__)" in order to put the structures into FLASH the code will compile fine (IAR EWARM) but the device will not enumerate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a fundamental reason that the enumeration strings can not be in FLASH?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bill&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 May 2014 16:37:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Stack-Putting-enumeration-strings-in-FLASH/m-p/311103#M13390</guid>
      <dc:creator>wre</dc:creator>
      <dc:date>2014-05-06T16:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: USB Stack: Putting enumeration strings in FLASH?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Stack-Putting-enumeration-strings-in-FLASH/m-p/311104#M13391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bill&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By default the USB controller doesn't have rights to access Flash and so, when it does, it reads usually 0xff or rubbish, which is then sent out, causing the emuleration to fail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To work with descriptors in Flash do the following initialisations:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;FMC_PFAPR |= FMC_FPAPR_USB_FS;&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;// allow USB controller to read from Flash&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;where FMC_FPAPR_USB_FS is&amp;nbsp; FMC_PFAPR_M3AP_RD (0x00000040) when using a K20 50MHz&lt;/P&gt;&lt;P&gt;or FMC_PFAPR_M4AP_RD (0x00000100) when using a 100MHz K20&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Which bus master number the USB controller has depends on the exact chip]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also set&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;MPU_CESR = 0;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/TD&gt;&lt;TD&gt;&lt;P&gt;// allow concurrent access to MPU controller&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;if you have a 100MHz plus part that has the memory protection unit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The uTasker UBS stack [&lt;A href="http://www.utasker.com/kinetis.html" title="http://www.utasker.com/kinetis.html"&gt;µTasker Kinetis support&lt;/A&gt;] works with all descriptors and strings directly in Flash and handles such processor configuration details transparently.&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>Tue, 06 May 2014 18:50:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Stack-Putting-enumeration-strings-in-FLASH/m-p/311104#M13391</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2014-05-06T18:50:26Z</dc:date>
    </item>
  </channel>
</rss>

