<?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: move or copy a file between multiple MFS (over SD and USB) in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/1657590#M18798</link>
    <description>&lt;P&gt;Hi Garabo,&lt;/P&gt;&lt;P&gt;I am using MQX5 with MFS V5.1(version number:&amp;nbsp;&lt;SPAN&gt;0x0501&lt;/SPAN&gt;) and I try to copy file between SD card and USB disk on my hardware based on RT1050EVK board with above method. Here I met a very strange issue that when read or write more than 512 bytes from or to USB disk, the data is wrong randomly sometimes. However if the read / write data size is less than 512 bytes, there is no such issue. I noticed that the sector size of the USB disk is 512 bytes, so if the size is more than 512 bytes, it will invoke&amp;nbsp;&lt;SPAN&gt;MFS_Read_device_sectors() /&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;MFS_Write_device_sectors() and this code branch will cause such problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;There is no such issue when read / write SD card with same MFS code.&lt;/P&gt;&lt;P&gt;I could not find the root cause and to avoid this issue I have to modify the copy data size less than 512 bytes which causes the slow copy speed and therefore long copy time.&lt;/P&gt;&lt;P&gt;Do you aware of such issue and could you help provide some solution?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;best regards&lt;/P&gt;&lt;P&gt;William&lt;/P&gt;</description>
    <pubDate>Thu, 25 May 2023 10:07:46 GMT</pubDate>
    <dc:creator>WilliamLiSH</dc:creator>
    <dc:date>2023-05-25T10:07:46Z</dc:date>
    <item>
      <title>move or copy a file between multiple MFS (over SD and USB)</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267241#M8086</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;In my MQX4.0 Project, I have installed two MFS, one MFS over SD Card and one MFS over USB device. I have used the shell to test all possible commands&amp;nbsp; successfully (dir, cd, copy, rename, ....).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I have used Input/Output Control Commands for MFS (ioctl) to create subdirectories, to rename files, to move files,.. successfully without to use the shell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I'm trying to move one file from USB to SD Card but without succeed. As support I'm following the steps described in the post &lt;A href="https://community.nxp.com/message/97792"&gt;Re: Use  USB msd class with SD card&lt;/A&gt;&amp;nbsp; but in this case they didn't use MQX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would be very grateful if anyone can help me sharing one demo application or any useful comments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ángel G.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2013 11:16:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267241#M8086</guid>
      <dc:creator>Angelillo</dc:creator>
      <dc:date>2013-02-21T11:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: move or copy a file between multiple MFS (over SD and USB)</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267242#M8087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Angel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void my_task(uint_32)&lt;BR /&gt;{&lt;BR /&gt; char_ptr&amp;nbsp;&amp;nbsp; ARGV[4];&lt;BR /&gt; char&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CMD_LINE[40]="copy a:\\test.txt c:\\my.txt";&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* create lwevent group */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (_lwevent_create(&amp;amp;lwevent_FS,0) != MQX_OK) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("\nMake event failed");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _task_block();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(TRUE)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; snprintf(CMD_LINE, 28, "copy a:\\test.txt c:\\my.txt");&lt;BR /&gt;&amp;nbsp; if (_lwevent_wait_ticks(&amp;amp;lwevent_FS,0b11,TRUE,0) != MQX_OK) &lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; printf("\nEvent Wait failed");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; _task_block();&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; printf("\nbefore copying\n");&lt;BR /&gt;&amp;nbsp; printf("%s",CMD_LINE);&lt;BR /&gt;&amp;nbsp; Shell_parse_command_line(CMD_LINE, ARGV);&lt;BR /&gt;&amp;nbsp; Shell_copy(3, ARGV);&lt;BR /&gt;&amp;nbsp; printf("\nafter copying\n");&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; if (_lwevent_clear(&amp;amp;lwevent_FS,0b11) != MQX_OK) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("\nEvent Clear failed");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _task_block();&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code is attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;-Garabo&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2013 17:16:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267242#M8087</guid>
      <dc:creator>Luis_Garabo</dc:creator>
      <dc:date>2013-02-21T17:16:41Z</dc:date>
    </item>
    <item>
      <title>Re: move or copy a file between multiple MFS (over SD and USB)</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267243#M8088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Angel,&lt;/P&gt;&lt;P&gt;I suspect the problem is in the path implementation.&lt;/P&gt;&lt;P&gt;My quick test is using the ramdish demo:&lt;/P&gt;&lt;P&gt;C:\Freescale\Freescale_MQX_4_0\mfs\examples\ramdisk&lt;/P&gt;&lt;P&gt;My hardware is the TWR-K60D100M tower kit with TWR-MEM card added to have access to MRAM.&lt;/P&gt;&lt;P&gt;The ramdisk demo is defaulted to using the MRAM but can be modified to use internal SRAM of the MCU.&lt;/P&gt;&lt;P&gt;I simply copy-n-pasted the Ram_disk_start() to MRam_disk_start() in Shell_Task.c, changed references to have "a: = SRAM" and "b:=MRAM".&amp;nbsp; I'll attach the source code.&lt;/P&gt;&lt;P&gt;I was then able via the shell to format each device, create a test file, then copy it to the other device.&lt;/P&gt;&lt;P&gt;Terminal Output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="ScreenHunter_02 Feb. 21 11.23.gif"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/119120iCCC90B75B44F1AEB/image-size/large?v=v2&amp;amp;px=999" role="button" title="ScreenHunter_02 Feb. 21 11.23.gif" alt="ScreenHunter_02 Feb. 21 11.23.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this shell example will allow you to get your embedded version working.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2013 17:26:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267243#M8088</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2013-02-21T17:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: move or copy a file between multiple MFS (over SD and USB)</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267244#M8089</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;&lt;/P&gt;&lt;P&gt;Thank you very much Garabo. Now, my application it's working fine copying files from MFS1 over USB ("c:" drive) to MFS2 over SD Card ("a:" drive). Your answer has been very useful for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ángel G.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2013 07:20:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267244#M8089</guid>
      <dc:creator>Angelillo</dc:creator>
      <dc:date>2013-02-26T07:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: move or copy a file between multiple MFS (over SD and USB)</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267245#M8090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your answer. Your explanations are useful for me if I decide to install multiple MFS in different kinds of memory simultaneously.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ángel G.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Feb 2013 07:36:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267245#M8090</guid>
      <dc:creator>Angelillo</dc:creator>
      <dc:date>2013-02-26T07:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: move or copy a file between multiple MFS (over SD and USB)</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267246#M8091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another related question:&lt;/P&gt;&lt;P&gt;I need to copy a file from one subdirectory(folder) to the root directory. I couldn't find any I/O control command (ioctl) to do it. Instead I used Shell_parse_command_line() and Shell_copy() to do the job. When I add this part in a task it works well but&amp;nbsp; I need to do it through a shell command. It looks like there is a confliction when I call Shell_parse_command_line() within a shell command!&amp;nbsp; any suggestion for me? Any other solution? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Sep 2013 21:18:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267246#M8091</guid>
      <dc:creator>amleng</dc:creator>
      <dc:date>2013-09-06T21:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: move or copy a file between multiple MFS (over SD and USB)</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267247#M8092</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;Actually there is not a IOCTL for copying files. You would need to open the source file in read mode. Open the destiny new file in write mode. Copy everything from one to another using a loop. You can find the source code from the sh_copy.c file very illustrative:&lt;/P&gt;&lt;P&gt;…&lt;/P&gt;&lt;P&gt;in_fd = fopen(abs_path, "r");&lt;/P&gt;&lt;P&gt;…&lt;/P&gt;&lt;P&gt;out_fd = fopen(abs_path, "w");&lt;/P&gt;&lt;P&gt;…&lt;/P&gt;&lt;P&gt;do {&lt;/P&gt;&lt;P&gt;          size = read(in_fd, copybuffer, copysize);&lt;/P&gt;&lt;P&gt;          if (size &amp;gt; 0) {&lt;/P&gt;&lt;P&gt;                wsize = write(out_fd, copybuffer, size);&lt;/P&gt;&lt;P&gt;          }&lt;/P&gt;&lt;P&gt;          else&lt;/P&gt;&lt;P&gt;               break;&lt;/P&gt;&lt;P&gt;} while (wsize == size);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Garabo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Sep 2013 15:59:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267247#M8092</guid>
      <dc:creator>Luis_Garabo</dc:creator>
      <dc:date>2013-09-09T15:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: move or copy a file between multiple MFS (over SD and USB)</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267248#M8093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That helps. Thank you very much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 21:18:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/267248#M8093</guid>
      <dc:creator>amleng</dc:creator>
      <dc:date>2013-09-12T21:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: move or copy a file between multiple MFS (over SD and USB)</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/1657590#M18798</link>
      <description>&lt;P&gt;Hi Garabo,&lt;/P&gt;&lt;P&gt;I am using MQX5 with MFS V5.1(version number:&amp;nbsp;&lt;SPAN&gt;0x0501&lt;/SPAN&gt;) and I try to copy file between SD card and USB disk on my hardware based on RT1050EVK board with above method. Here I met a very strange issue that when read or write more than 512 bytes from or to USB disk, the data is wrong randomly sometimes. However if the read / write data size is less than 512 bytes, there is no such issue. I noticed that the sector size of the USB disk is 512 bytes, so if the size is more than 512 bytes, it will invoke&amp;nbsp;&lt;SPAN&gt;MFS_Read_device_sectors() /&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;MFS_Write_device_sectors() and this code branch will cause such problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;There is no such issue when read / write SD card with same MFS code.&lt;/P&gt;&lt;P&gt;I could not find the root cause and to avoid this issue I have to modify the copy data size less than 512 bytes which causes the slow copy speed and therefore long copy time.&lt;/P&gt;&lt;P&gt;Do you aware of such issue and could you help provide some solution?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;best regards&lt;/P&gt;&lt;P&gt;William&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 10:07:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/move-or-copy-a-file-between-multiple-MFS-over-SD-and-USB/m-p/1657590#M18798</guid>
      <dc:creator>WilliamLiSH</dc:creator>
      <dc:date>2023-05-25T10:07:46Z</dc:date>
    </item>
  </channel>
</rss>

