<?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>MQX Software SolutionsのトピックMFS on USB flash drive - sector not found error</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/MFS-on-USB-flash-drive-sector-not-found-error/m-p/308042#M9883</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am working on a project that is using a USB flash drive.&amp;nbsp; It saves data to a file one character at a time.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The system will run fine for some amount of time, writing characters to the flash drive.&amp;nbsp; At some point though, the write() will result in an MFS_SECTOR_NOT_FOUND error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a test running where a 1000 character string is written to the file on the flash drive every 5 seconds. Different drives will fail after different a number of writes.&amp;nbsp; Some drives will go for several hours before there is an error and others will fail after a couple of minutes.&amp;nbsp; Each drive is fairly consistent with how long it will run before it fails.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the code that handles the write.&amp;nbsp; The file is opened before calling this function.&amp;nbsp; After all characters are written the file is closed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13963754476206107" jivemacro_uid="_13963754476206107" modifiedtitle="true"&gt;
&lt;P&gt;void addCharacterToFile( char *c )&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t error = MFS_NO_ERROR;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( filePointer != NULL )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write( filePointer, c, 1 );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; error = _io_ferror( filePointer );&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( MFS_SECTOR_NOT_FOUND == error )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf( "sector not found\n" );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if ( MFS_NO_ERROR != error )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf( "mfs error\n" );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could writing the string to the file one character at a time be part of the problem?&amp;nbsp; The ability to save data to a flash drive is a change to an existing system - it previously sent this data to a serial port and the code outputs the data one character at a time.&amp;nbsp; If anyone thinks it would help - I could buffer up some arbitrary number of characters before writing to the flash drive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using CodeWarrior 10.5, MQX 4.0, MFS, USB host&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 01 Apr 2014 18:48:39 GMT</pubDate>
    <dc:creator>gorakk</dc:creator>
    <dc:date>2014-04-01T18:48:39Z</dc:date>
    <item>
      <title>MFS on USB flash drive - sector not found error</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MFS-on-USB-flash-drive-sector-not-found-error/m-p/308042#M9883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am working on a project that is using a USB flash drive.&amp;nbsp; It saves data to a file one character at a time.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The system will run fine for some amount of time, writing characters to the flash drive.&amp;nbsp; At some point though, the write() will result in an MFS_SECTOR_NOT_FOUND error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a test running where a 1000 character string is written to the file on the flash drive every 5 seconds. Different drives will fail after different a number of writes.&amp;nbsp; Some drives will go for several hours before there is an error and others will fail after a couple of minutes.&amp;nbsp; Each drive is fairly consistent with how long it will run before it fails.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is the code that handles the write.&amp;nbsp; The file is opened before calling this function.&amp;nbsp; After all characters are written the file is closed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13963754476206107" jivemacro_uid="_13963754476206107" modifiedtitle="true"&gt;
&lt;P&gt;void addCharacterToFile( char *c )&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint32_t error = MFS_NO_ERROR;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( filePointer != NULL )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write( filePointer, c, 1 );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; error = _io_ferror( filePointer );&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ( MFS_SECTOR_NOT_FOUND == error )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf( "sector not found\n" );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if ( MFS_NO_ERROR != error )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf( "mfs error\n" );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could writing the string to the file one character at a time be part of the problem?&amp;nbsp; The ability to save data to a flash drive is a change to an existing system - it previously sent this data to a serial port and the code outputs the data one character at a time.&amp;nbsp; If anyone thinks it would help - I could buffer up some arbitrary number of characters before writing to the flash drive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using CodeWarrior 10.5, MQX 4.0, MFS, USB host&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Apr 2014 18:48:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MFS-on-USB-flash-drive-sector-not-found-error/m-p/308042#M9883</guid>
      <dc:creator>gorakk</dc:creator>
      <dc:date>2014-04-01T18:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: MFS on USB flash drive - sector not found error</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MFS-on-USB-flash-drive-sector-not-found-error/m-p/308043#M9884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="padding: 0 0 1.0pt 0;"&gt;Hi Allen,&lt;/P&gt;&lt;P style="padding: 0 0 1.0pt 0;"&gt;&lt;/P&gt;&lt;P style="padding: 0 0 1.0pt 0;"&gt;Maybe you are getting a Start of Frame (SOF) condition at the same time that an OUT transaction.&lt;/P&gt;&lt;P style="padding: 0 0 1.0pt 0;"&gt;Below you can find a tread talking about such condition and a workaround for it:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif';"&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/thread/320848"&gt;https://community.freescale.com/thread/320848&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Hope this will be useful for you.&lt;BR /&gt;Best regards!&lt;BR /&gt;/Carlos&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2014 21:07:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MFS-on-USB-flash-drive-sector-not-found-error/m-p/308043#M9884</guid>
      <dc:creator>CarlosCasillas</dc:creator>
      <dc:date>2014-04-09T21:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: MFS on USB flash drive - sector not found error</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MFS-on-USB-flash-drive-sector-not-found-error/m-p/308044#M9885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Carlos,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately the solution in the linked thread did not solve the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've created another thread that details what appears to be the same issue when using the HVAC demo:&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/thread/323315" style="font-family: Calibri, sans-serif; font-size: 11pt; line-height: 1.5em;"&gt;https://community.freescale.com/thread/323315&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Allen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 May 2014 13:28:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MFS-on-USB-flash-drive-sector-not-found-error/m-p/308044#M9885</guid>
      <dc:creator>gorakk</dc:creator>
      <dc:date>2014-05-05T13:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: MFS on USB flash drive - sector not found error</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MFS-on-USB-flash-drive-sector-not-found-error/m-p/308045#M9886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Has any work arround or explanation of this been found ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am having pretty much exactly the same problem in MQX 3.8 with a K70. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is totally reproducable. &lt;/P&gt;&lt;P&gt;Though it occurs faster with some USB sticks than others. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2015 21:12:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MFS-on-USB-flash-drive-sector-not-found-error/m-p/308045#M9886</guid>
      <dc:creator>asmith</dc:creator>
      <dc:date>2015-05-13T21:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: MFS on USB flash drive - sector not found error</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/MFS-on-USB-flash-drive-sector-not-found-error/m-p/308046#M9887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry about the delay in responding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We did not find a workaround or explanation.&amp;nbsp; We actually put the feature that uses a USB flash drive on hold in our product - we may revisit at some time in the future.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Allen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 18:51:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/MFS-on-USB-flash-drive-sector-not-found-error/m-p/308046#M9887</guid>
      <dc:creator>gorakk</dc:creator>
      <dc:date>2015-07-09T18:51:45Z</dc:date>
    </item>
  </channel>
</rss>

