<?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: Is there any API in MQX USB device stack to reset the underlaying USB Device? in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-any-API-in-MQX-USB-device-stack-to-reset-the/m-p/171555#M1975</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Update: it suffice to open the file with &lt;FONT face="andale mono,times"&gt;CreateFile(...,FILE_FLAG_NO_BUFFERING,...)&lt;/FONT&gt;. Other apps (also the same app) re-read the content of the file until the file handle is closed.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Remark: If you want to read the file in the same app, use second handle i.e..:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="1"&gt;&amp;nbsp; hd_unbuf = CreateFile( filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL );&lt;BR /&gt;&amp;nbsp; while( true )&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hd = CreateFile( filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( hd != (HANDLE)-1 )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memset ( buf, 0x00, sizeof(buf) );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //SetFilePointer ( hd, 0, 0, FILE_BEGIN );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReadFile( hd, buf, 10, &amp;amp;bytes, NULL );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( bytes &amp;gt; 0 )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; std::cout &amp;lt;&amp;lt; buf &amp;lt;&amp;lt; std::endl;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CloseHandle( hd );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sleep( 1000 );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; std::cout &amp;lt;&amp;lt; "Error: " &amp;lt;&amp;lt; GetLastError() &amp;lt;&amp;lt; std::endl;&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; CloseHandle( hd_unbuf );&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Jun 2012 17:13:23 GMT</pubDate>
    <dc:creator>Fabi</dc:creator>
    <dc:date>2012-06-06T17:13:23Z</dc:date>
    <item>
      <title>Is there any API in MQX USB device stack to reset the underlaying USB Device?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-any-API-in-MQX-USB-device-stack-to-reset-the/m-p/171551#M1971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi I need information&amp;nbsp; on API information&amp;nbsp;to reset&amp;nbsp; underlaying USB device.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This API to cause the USB device to reenumeration.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subhashini&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Feb 2010 13:07:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-any-API-in-MQX-USB-device-stack-to-reset-the/m-p/171551#M1971</guid>
      <dc:creator>siddu</dc:creator>
      <dc:date>2010-02-01T13:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any API in MQX USB device stack to reset the underlaying USB Device?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-any-API-in-MQX-USB-device-stack-to-reset-the/m-p/171552#M1972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi siddu.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you deployed MQX's USB DDK device, then you cannot reset the device as you want, that command must come from host.&lt;/P&gt;&lt;P&gt;If you deployed MQX's USB HDK host, then you can use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;_usb_host_bus_control(handle, USB_ASSERT_BUS_RESET); and&amp;nbsp; _usb_host_bus_control(handle, USB_DEASSERT_BUS_RESET);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but, unfortunatelly, this is not supported by low-level drivers yet (although, as you see, the API is prepared)...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Feb 2010 17:11:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-any-API-in-MQX-USB-device-stack-to-reset-the/m-p/171552#M1972</guid>
      <dc:creator>JuroV</dc:creator>
      <dc:date>2010-02-08T17:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any API in MQX USB device stack to reset the underlaying USB Device?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-any-API-in-MQX-USB-device-stack-to-reset-the/m-p/171553#M1973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm interested in this also... or actually what I want is a bit different but relates to first post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my software (using mqx 3.7) k60 is &lt;STRONG&gt;connected to pc as a mass storage device&lt;/STRONG&gt; to view files on sd card (&lt;STRONG&gt;READ ONLY&lt;/STRONG&gt;). That's ok so far and I can read my data from usb but then I &lt;STRONG&gt;want to update that data&lt;/STRONG&gt;&amp;nbsp;which means I have to make Windows see the changes. The only way, it seems, would be to &lt;STRONG&gt;reinitialise the usb device connection&lt;/STRONG&gt; but in my situation &lt;STRONG&gt;the device must not be disconnected physically from the pc&lt;/STRONG&gt;. So the usb device reset or reinit has to be done in software but there seems to be no functions for doing that? How can I reset msd on the fly? Any advice would be welcome... &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently I have managed to make the device disconnect from pc by setting usb pullup resistor value but re-enabling it won't reconnect the device. Running TestAppInit() function after that won't reconnect either (As a base for my project I have used usb msc demo project). The other way that works, is to reset the whole system after the data is updated but that isn't quite a solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 22:49:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-any-API-in-MQX-USB-device-stack-to-reset-the/m-p/171553#M1973</guid>
      <dc:creator>Jarpba</dc:creator>
      <dc:date>2012-03-20T22:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any API in MQX USB device stack to reset the underlaying USB Device?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-any-API-in-MQX-USB-device-stack-to-reset-the/m-p/171554#M1974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The host (windows) caches the FAT and file data. However, opening the file with&amp;nbsp;&lt;FONT face="andale mono,times" size="1"&gt;FILE_FLAG_NO_BUFFERING&amp;nbsp;&lt;/FONT&gt; flushes the buffer and induced to re-read the data by the host. Note, this flag requires data read of 512 Bytes minimum, but USB fullspeed endpoint provides 64 Bytes only. So, closing and re-opening the stream without this flag is necessary.&lt;/P&gt;&lt;P&gt;Here's my sample code:&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hd = CreateFile( filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL );&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CloseHandle( hd );&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hd = CreateFile( filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( hd != (HANDLE)-1 )&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReadFile( hd, buf, 10, &amp;amp;bytes, NULL );&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; std::cout &amp;lt;&amp;lt; bytes &amp;lt;&amp;lt; " Bytes read" &amp;lt;&amp;lt; std::endl;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="andale mono,times" size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; std::cout &amp;lt;&amp;lt; "Error: " &amp;lt;&amp;lt; GetLastError() &amp;lt;&amp;lt; std::endl;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;@Jarpba: PLS, Could you provide your code, especially for USB_MSC_DEVICE_READ_REQUEST to adapt SD card to MSD? I want to implement this functionality, too. But If I try read (sdcard_handle, lba_data_ptr-&amp;gt;buff_ptr, lba_data_ptr-&amp;gt;size); I get kerner panic and memory dump with it. TY&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 18:55:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-any-API-in-MQX-USB-device-stack-to-reset-the/m-p/171554#M1974</guid>
      <dc:creator>Fabi</dc:creator>
      <dc:date>2012-05-15T18:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any API in MQX USB device stack to reset the underlaying USB Device?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-any-API-in-MQX-USB-device-stack-to-reset-the/m-p/171555#M1975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Update: it suffice to open the file with &lt;FONT face="andale mono,times"&gt;CreateFile(...,FILE_FLAG_NO_BUFFERING,...)&lt;/FONT&gt;. Other apps (also the same app) re-read the content of the file until the file handle is closed.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Remark: If you want to read the file in the same app, use second handle i.e..:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="andale mono,times" size="1"&gt;&amp;nbsp; hd_unbuf = CreateFile( filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL );&lt;BR /&gt;&amp;nbsp; while( true )&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hd = CreateFile( filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( hd != (HANDLE)-1 )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memset ( buf, 0x00, sizeof(buf) );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //SetFilePointer ( hd, 0, 0, FILE_BEGIN );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReadFile( hd, buf, 10, &amp;amp;bytes, NULL );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( bytes &amp;gt; 0 )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; std::cout &amp;lt;&amp;lt; buf &amp;lt;&amp;lt; std::endl;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CloseHandle( hd );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sleep( 1000 );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; std::cout &amp;lt;&amp;lt; "Error: " &amp;lt;&amp;lt; GetLastError() &amp;lt;&amp;lt; std::endl;&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; CloseHandle( hd_unbuf );&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2012 17:13:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-any-API-in-MQX-USB-device-stack-to-reset-the/m-p/171555#M1975</guid>
      <dc:creator>Fabi</dc:creator>
      <dc:date>2012-06-06T17:13:23Z</dc:date>
    </item>
  </channel>
</rss>

