<?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: _esdhc_read, SD, and cache? in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352099#M11458</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I set PLL1 to 125MHz and I see the same result.&amp;nbsp; Data in DDR is corrupted after ADMA from SDHC controller.&amp;nbsp; I will share the code but it's not ready yet.&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;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Nov 2014 20:40:35 GMT</pubDate>
    <dc:creator>pbanta</dc:creator>
    <dc:date>2014-11-24T20:40:35Z</dc:date>
    <item>
      <title>_esdhc_read, SD, and cache?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352095#M11454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My environment:&amp;nbsp; MQX 4.1, MFS, K70FX, eMMC, DDR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm writing a small ascii file to MFS installed over the SD card driver.&amp;nbsp; When I try to display the contents of the file (using the "type" shell command) I can see corrupted data sometimes.&amp;nbsp; Not all the time.&amp;nbsp; I have noticed that if I create multiple files and then "type" them from the shell, sometimes the data printed to the shell is good and other times the data is corrupted.&amp;nbsp; I have tracked the corruption to the esdhc driver.&amp;nbsp; I am seeing data corruption when the ADMA engine transfers data to DDR.&amp;nbsp; After the transfer is complete the buffer in DDR contains some new data mixed with old data.&amp;nbsp; For example, if I "type" file1.txt and then "type" file2.txt, the data printed to the screen contains file1.txt data intermixed with file2.txt data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't understand the ESDHC_IS_HANDLING_CACHE code.&amp;nbsp; What is the purpose of head, body, and tail?&amp;nbsp; It looks like ESDHC_IS_HANDLING_CACHE is not meant to be optional.&amp;nbsp; It's forced true in esdhc_prv.h.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm also wondering if the problem may be related to the clock domains between the eMMC and DDR.&amp;nbsp; I've run pattern tests, walking ones/zeros over the address range of DDR with no errors.&amp;nbsp; My eMMC clock is running at approximately 750kHz and the DDR clock is 120MHz.&amp;nbsp; I think the ADMA is sitting in the middle transferring data from SDHC_DATPORT to DDR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anyone seen any issues like this before?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 01:49:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352095#M11454</guid>
      <dc:creator>pbanta</dc:creator>
      <dc:date>2014-11-19T01:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: _esdhc_read, SD, and cache?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352096#M11455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can anyone at Freescale confirm that the K70 SDHC errata is accounted for in the MQX 4.1 esdhc driver?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 21:33:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352096#M11455</guid>
      <dc:creator>pbanta</dc:creator>
      <dc:date>2014-11-19T21:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: _esdhc_read, SD, and cache?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352097#M11456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We know about sporadic problem with DDR under MQX4.1.&lt;/P&gt;&lt;P&gt;TWR-K70F120M BSP configures incorrect DDR2 clock frequency. By default it is 120 MHz. JEDEC specifications minimum requires 125 MHz. Maximum allowed by K70 chip is 150 MHz.&lt;/P&gt;&lt;P&gt;There is Freescale MQX RTOS 4.1.0.1 Patch which apply fix for this issue – increase DDR clock.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.freescale.com/webapp/sps/download/license.jsp?colCode=FSLMQXOS_4_1_0_1_PATCH"&gt;https://www.freescale.com/webapp/sps/download/license.jsp?colCode=FSLMQXOS_4_1_0_1_PATCH&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Could you please try applying this patch and testing it again?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this doesn’t help, could you please share here code which you use for writing your files – that we can reproduce it on our side under the same conditions?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;RadekS&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>Fri, 21 Nov 2014 14:00:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352097#M11456</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2014-11-21T14:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: _esdhc_read, SD, and cache?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352098#M11457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had PLL1 set to 150MHz when I discovered the problem.&amp;nbsp; According to the K70 reference manual PLL1 is used to provide clock to the DDR controller.&amp;nbsp; I lowered PLL1 to 120MHz and I still saw the problem.&amp;nbsp; I will try 125MHz and let you know the results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2014 15:59:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352098#M11457</guid>
      <dc:creator>pbanta</dc:creator>
      <dc:date>2014-11-21T15:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: _esdhc_read, SD, and cache?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352099#M11458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I set PLL1 to 125MHz and I see the same result.&amp;nbsp; Data in DDR is corrupted after ADMA from SDHC controller.&amp;nbsp; I will share the code but it's not ready yet.&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;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Nov 2014 20:40:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352099#M11458</guid>
      <dc:creator>pbanta</dc:creator>
      <dc:date>2014-11-24T20:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: _esdhc_read, SD, and cache?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352100#M11459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear pbanta,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ESDHC_IS_HANDLING_CACHE defaults to 1 for platforms which feature data cache. This macro is not a user option - it has to correspond with cache setting (enabled/disabled). Please do not change it unless you are absolutely sure that you know what you are doing (e.g. you have the data cache intentionally disabled or so).&lt;/P&gt;&lt;P&gt;K70 features data cache and I suppose that you have it enabled so PSP_HAS_DATA_CACHE should be 1. Could you, please, verify that it is so?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards, Pavel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 09:38:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352100#M11459</guid>
      <dc:creator>pavel_chromy</dc:creator>
      <dc:date>2014-11-25T09:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: _esdhc_read, SD, and cache?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352101#M11460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Pavel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, I can verify that PSP_HAS_DATA_CACHE is set to 1 in kinetis.h.&amp;nbsp; And from esdhc_prv.h:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#ifndef ESDHC_IS_HANDLING_CACHE&lt;/P&gt;&lt;P&gt;&amp;nbsp; #define ESDHC_IS_HANDLING_CACHE PSP_HAS_DATA_CACHE&lt;/P&gt;&lt;P&gt;#endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 16:01:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352101#M11460</guid>
      <dc:creator>pbanta</dc:creator>
      <dc:date>2014-11-25T16:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: _esdhc_read, SD, and cache?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352102#M11461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi pbanta,&lt;/P&gt;&lt;P&gt;Have you had any success in resolving your issue with the sdcard?&amp;nbsp; I ask because I've had a similar problem which I reported in another forum post (see &lt;A _jive_internal="true" href="https://community.nxp.com/message/476589#476589"&gt;here&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I observed that corruption seems to occur when interrupts occur while data is being copied to/from the sdcard dma buffer.&amp;nbsp; As a test I modified the sdcard driver to disable interrupts while the data is copied and it has significantly improved my problem.&amp;nbsp; I provided details on what I changed in the other post hoping that Freescale will comment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps you could try making the same change and report whether it helps your particular issue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;-Ken&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 16:13:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352102#M11461</guid>
      <dc:creator>KenOverly</dc:creator>
      <dc:date>2015-02-02T16:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: _esdhc_read, SD, and cache?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352103#M11462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've been looking at the sdcard driver in more detail and stepping through the code in the debugger.&amp;nbsp; @pbanta asked about the usage of the head, body, and tail dma transfer buffers.&amp;nbsp; This section of code looks unusual to me as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When executed in the debugger the number of bytes to read (variable n) passed into _eshdc_read() is always 512.&amp;nbsp; The 'head' buffer descriptor always ends up being 32 bytes, the 'body' descriptor is 480 bytes, and the 'tail' descriptor is not used.&amp;nbsp; Also interesting to note is that the head buffer descriptor transfers data from a different area of memory than the body buffer descriptor.&amp;nbsp; The head uses 32 bytes of memory allocated during initialization of the sdcard driver in _eshdc_install(), whereas the body buffer descriptor uses memory passed into _eshdc_read() via the data_ptr variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've also referenced the SD host controller spec PDF document located on the &lt;A href="https://www.sdcard.org/developers/overview/host_controller/simple_spec/Simplified_SD_Host_Controller_Spec.pdf"&gt;sdcard.org website&lt;/A&gt;.&amp;nbsp; It provides specific details of the ADMA transfer process, but did not shed any light on why the MQX driver is designed the way that it is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Does anyone understand why the adma buffer transfer was designed this way?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2015 21:57:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352103#M11462</guid>
      <dc:creator>KenOverly</dc:creator>
      <dc:date>2015-02-04T21:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: _esdhc_read, SD, and cache?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352104#M11463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't understand the head, body, tail ADMA handling in the driver either. Maybe someone could give us some hints?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working with MQX 4.1.2 on the Vybrid M4. I also see problems with with SD-card driver (_esdhc_read) in combination with active caches and cached memory. (but I think in my case it has nothing to do with DDR3 or interrupts)&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it is problem regarding the cache handling in the driver and the cache controller.&lt;/P&gt;&lt;P&gt;In my case I found a workaround in my application to have data consistency after a read access:&lt;/P&gt;&lt;P&gt;flush the data after buffer_read re-init -&amp;gt; then start the read access&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; (open file in filesystem, loop: write access, CRC handling, etc.)&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; memset(buffer_read, 0, accessSize );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //workaround to to fix problem in case of application uses cached memory&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _DCACHE_FLUSH_MBYTES(buffer_read, accessSize );&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; returnSize = read(fd, buffer_read, accessSize ); &lt;/P&gt;&lt;P&gt; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could anyone try or approve this?&lt;/P&gt;&lt;P&gt;BR Tobi &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Mar 2015 13:26:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352104#M11463</guid>
      <dc:creator>tobiasmaurer</dc:creator>
      <dc:date>2015-03-11T13:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: _esdhc_read, SD, and cache?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352105#M11464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ken,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry for the delay in replying.&amp;nbsp; I got busy with other portions of the firmware and forgot about this because I worked around the problem.&amp;nbsp; I got rid of DMA in the driver.&amp;nbsp; Yes, it's slower, but it is reliable and my application doesn't need high speed access to the eMMC and I have "bigger fish to fry".&amp;nbsp; I would like to see this issue addressed and fixed because I would prefer not to have custom modifications in my peripheral IO drivers.&amp;nbsp; I ended up using the Cloning Wizard to export an MQX tree and I made all my changes in the exported tree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Mar 2015 15:52:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352105#M11464</guid>
      <dc:creator>pbanta</dc:creator>
      <dc:date>2015-03-27T15:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: _esdhc_read, SD, and cache?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352106#M11465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know this is dredging up an old thread, but how exactly were you able to get rid of the DMA?&amp;nbsp; Looking at the reference manual (VFxxx Controller Reference Manual Rev 0 figure 10-41) it appears the only way to output data from the SDHC peripheral is via DMA.&amp;nbsp; Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2018 18:50:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352106#M11465</guid>
      <dc:creator>akobyl</dc:creator>
      <dc:date>2018-10-04T18:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: _esdhc_read, SD, and cache?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352107#M11466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you resend the patch again&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2019 15:08:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/esdhc-read-SD-and-cache/m-p/352107#M11466</guid>
      <dc:creator>sohamd</dc:creator>
      <dc:date>2019-05-24T15:08:05Z</dc:date>
    </item>
  </channel>
</rss>

