<?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: USB Device - dynamically choose interfaces</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Device-dynamically-choose-interfaces/m-p/733187#M44836</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Bruno&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The behavior/control has nothing to do with FreeRTOS - I can do the same with existing FreeRTOS projects - but it is the USB MSD class/file system that actually influences it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you use an SD card together with the MSD? In this case you will need to understand how the FAT and MSD interact together - since I can't help with the NXP stack or fsFAT you will need to either study the details to work it out or request support from the individual sources.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the uTasker case (which is a complete integrated solution and not a collection of libraries from different sources) [it is also free and open source] it is done by controlling the MSD class responses to various UFI requests - for example, the host will usually be polling the state of the disk and so one place to make it dependent is there (although the host will also request some other card details at enumeration, such as format capacity, where similar "unusable" states need to be returned).&lt;BR /&gt;Eg. this is the response to the sense request:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case UFI_REQUEST_SENSE:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CBW_RETURN_SENSE_DATA present_sense_data;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uMemcpy(&amp;amp;present_sense_data, &amp;amp;sense_data_OK, sizeof(sense_data_OK)); // prepare positive response&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((ptrDiskInfo[ucActiveLUN]-&amp;gt;usDiskFlags &amp;amp; (DISK_MOUNTED | DISK_UNFORMATTED)) == 0) { // if the disk is not present&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&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; present_sense_data.ucValid_ErrorCode = (CURRENT_ERRORS); // set that the disk is presently in a non-usable state&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&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; present_sense_data.ucSenseKey = SENSE_NOT_READY;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&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; &lt;STRONG&gt;present_sense_data.ucAdditionalSenseCode = DESC_MEDIUM_NOT_PRESENT;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fnWrite(USBPortID_MSD, (unsigned char *)&amp;amp;present_sense_data, sizeof(present_sense_data)); // return the response&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so if one can control the LUN's disk state one can make MSD think that the disk is not inserted, and then one can set the state back to an inserted/formatted disk when one wants MSD to start working with the disk.&lt;BR /&gt;I just manipulated the &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;ptrDiskInfo[ucActiveLUN]-&amp;gt;usDiskFlags&lt;/SPAN&gt; by adding a controllable mask to do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;if (((ptrDiskInfo[ucActiveLUN]-&amp;gt;usDiskFlags &lt;STRONG&gt;&amp;amp; usLocalMask&lt;/STRONG&gt;) &amp;amp; (DISK_MOUNTED | DISK_UNFORMATTED)) == 0) { // if the disk is not present&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so I can control it by changing &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;usLocalMask&lt;/SPAN&gt; between &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;0&lt;/SPAN&gt; and &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;(DISK_MOUNTED | DISK_UNFORMATTED)&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume that your MSD class has basic support for correctly handling disk state information, otherwise you will first need to expand it before you can start controlling it.&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, 18 Jan 2018 13:22:09 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2018-01-18T13:22:09Z</dc:date>
    <item>
      <title>USB Device - dynamically choose interfaces</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Device-dynamically-choose-interfaces/m-p/733184#M44833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an application&amp;nbsp;running FreeRTOS and USB communication (acts as a Device). My objective is to have one Virtual COM port and on Mass Storage Device over the same USB (composite device), where&amp;nbsp;the MSD should NOT show up automatically. The user can ask through VCOM Port for the Disk to appear or disappear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used one of the examples (usb_device_composite_cdc_msc from SDK 2.3.0 for MK22FN512VLH12) as a base for my application, but I don't understand how to control when the interface should appear, which functions to call, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone point me to the direction?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Bruno&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jan 2018 14:46:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Device-dynamically-choose-interfaces/m-p/733184#M44833</guid>
      <dc:creator>brunoalbrecht</dc:creator>
      <dc:date>2018-01-17T14:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: USB Device - dynamically choose interfaces</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Device-dynamically-choose-interfaces/m-p/733185#M44834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bruno&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached a video showing possible operation as you wish.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I simply inform that there is no card inserted and after a short time I inform that a card 'is' inserted and then the disk drive "appears" (about 0:22 in the video).&lt;BR /&gt;If you look carefully, the disk drive does appear for a fraction of a second when the USB device enumerates but then disappears again.&lt;BR /&gt;As shown in the video the composite USB-CDC operates normally during the period.&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;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;Kinetis: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fkinetis.html" rel="nofollow" target="_blank"&gt;http://www.utasker.com/kinetis.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;USB: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fdocs%2FuTasker%2FUSB_User_Guide.PDF" rel="nofollow" target="_blank"&gt;http://www.utasker.com/docs/uTasker/USB_User_Guide.PDF&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;USB composites: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fkinetis%2FUSB_Device.html" rel="nofollow" target="_blank"&gt;http://www.utasker.com/kinetis/USB_Device.html&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;USB-CDC host&amp;lt;-&amp;gt;device video: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXhISV1czIo4%26list%3DPLWKlVb_MqDQFZAulrUywU30v869JBYi9Q%26index%3D16" rel="nofollow" target="_blank"&gt;https://www.youtube.com/watch?v=XhISV1czIo4&amp;amp;list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q&amp;amp;index=16&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Free Open Source solution: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fgithub.com%2FuTasker%2FuTasker-Kinetis" rel="nofollow" target="_blank"&gt;https://github.com/uTasker/uTasker-Kinetis&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Working project in 15 minutes video: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fyoutu.be%2FK8ScSgpgQ6M" rel="nofollow" target="_blank"&gt;https://youtu.be/K8ScSgpgQ6M&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Professional Kinetis support, one-on-one training and complete fast-track project solutions: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.utasker.com%2Fsupport.html" rel="nofollow" target="_blank"&gt;http://www.utasker.com/support.html&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jan 2018 16:15:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Device-dynamically-choose-interfaces/m-p/733185#M44834</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2018-01-17T16:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: USB Device - dynamically choose interfaces</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Device-dynamically-choose-interfaces/m-p/733186#M44835</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;Very nice, that's basically the kind of feature I want to implement. My application, though, is written using FreeRTOS and NXP's USB&amp;nbsp;stack.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you explain how you didi it? Or at least what should I look for when searching for this info? I tried "detach" or "disconnect", but most results were about a Host connecting to a device.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Bruno&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jan 2018 08:45:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Device-dynamically-choose-interfaces/m-p/733186#M44835</guid>
      <dc:creator>brunoalbrecht</dc:creator>
      <dc:date>2018-01-18T08:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: USB Device - dynamically choose interfaces</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Device-dynamically-choose-interfaces/m-p/733187#M44836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Bruno&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The behavior/control has nothing to do with FreeRTOS - I can do the same with existing FreeRTOS projects - but it is the USB MSD class/file system that actually influences it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you use an SD card together with the MSD? In this case you will need to understand how the FAT and MSD interact together - since I can't help with the NXP stack or fsFAT you will need to either study the details to work it out or request support from the individual sources.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the uTasker case (which is a complete integrated solution and not a collection of libraries from different sources) [it is also free and open source] it is done by controlling the MSD class responses to various UFI requests - for example, the host will usually be polling the state of the disk and so one place to make it dependent is there (although the host will also request some other card details at enumeration, such as format capacity, where similar "unusable" states need to be returned).&lt;BR /&gt;Eg. this is the response to the sense request:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case UFI_REQUEST_SENSE:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CBW_RETURN_SENSE_DATA present_sense_data;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uMemcpy(&amp;amp;present_sense_data, &amp;amp;sense_data_OK, sizeof(sense_data_OK)); // prepare positive response&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((ptrDiskInfo[ucActiveLUN]-&amp;gt;usDiskFlags &amp;amp; (DISK_MOUNTED | DISK_UNFORMATTED)) == 0) { // if the disk is not present&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&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; present_sense_data.ucValid_ErrorCode = (CURRENT_ERRORS); // set that the disk is presently in a non-usable state&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&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; present_sense_data.ucSenseKey = SENSE_NOT_READY;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&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; &lt;STRONG&gt;present_sense_data.ucAdditionalSenseCode = DESC_MEDIUM_NOT_PRESENT;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fnWrite(USBPortID_MSD, (unsigned char *)&amp;amp;present_sense_data, sizeof(present_sense_data)); // return the response&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so if one can control the LUN's disk state one can make MSD think that the disk is not inserted, and then one can set the state back to an inserted/formatted disk when one wants MSD to start working with the disk.&lt;BR /&gt;I just manipulated the &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;ptrDiskInfo[ucActiveLUN]-&amp;gt;usDiskFlags&lt;/SPAN&gt; by adding a controllable mask to do it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new, courier, monospace;"&gt;if (((ptrDiskInfo[ucActiveLUN]-&amp;gt;usDiskFlags &lt;STRONG&gt;&amp;amp; usLocalMask&lt;/STRONG&gt;) &amp;amp; (DISK_MOUNTED | DISK_UNFORMATTED)) == 0) { // if the disk is not present&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so I can control it by changing &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;usLocalMask&lt;/SPAN&gt; between &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;0&lt;/SPAN&gt; and &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;(DISK_MOUNTED | DISK_UNFORMATTED)&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume that your MSD class has basic support for correctly handling disk state information, otherwise you will first need to expand it before you can start controlling it.&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, 18 Jan 2018 13:22:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Device-dynamically-choose-interfaces/m-p/733187#M44836</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2018-01-18T13:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: USB Device - dynamically choose interfaces</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Device-dynamically-choose-interfaces/m-p/733188#M44837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for explanation. I understand now that the control whether the Disk "appears" is closer to the device itself (UFI request) and not something on the USB stack. I do have access and have customized the answers to such messages, thus I'll try this approach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding the disk, it's not an SD Card, but a Flash Memory IC soldered to the board (I don't want it to always show, though). I have whole interface between my software, the memory and the computer implemented (Flash memory driver, FAT FS implementation, answers to USB MSD requests, etc).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could the same approach be used with the VCOM port? If so, which USB request should I check for?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bruno&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2018 09:30:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Device-dynamically-choose-interfaces/m-p/733188#M44837</guid>
      <dc:creator>brunoalbrecht</dc:creator>
      <dc:date>2018-01-22T09:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: USB Device - dynamically choose interfaces</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Device-dynamically-choose-interfaces/m-p/733189#M44838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bruno&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know of a method to do it with VCOM - the Windows driver only really request the UART settings when connecting. You could study the USB-CDC class docs at usb.org to see whether there is anything that might help (like GET_COMM_FEATURE) but it may need a dedicated driver at the PC to actually make use of.&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. Which wear-leveling method do you use with the flash memory?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jan 2018 17:17:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Device-dynamically-choose-interfaces/m-p/733189#M44838</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2018-01-22T17:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: USB Device - dynamically choose interfaces</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Device-dynamically-choose-interfaces/m-p/733190#M44839</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 the info. I'll check the class docs and if I find anything interesting, I'll post here for reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding the wear-leveling method, I'm actually not using one. The flash memory won't be written too many times (I'm just storing some configuration for easier access from the user side).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bruno&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jan 2018 08:45:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/USB-Device-dynamically-choose-interfaces/m-p/733190#M44839</guid>
      <dc:creator>brunoalbrecht</dc:creator>
      <dc:date>2018-01-24T08:45:32Z</dc:date>
    </item>
  </channel>
</rss>

