<?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: Problem with memory shared between USB, DMA and CPU in an iMX 51. in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-memory-shared-between-USB-DMA-and-CPU-in-an-iMX-51/m-p/209543#M12375</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Grant&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem was in the hardware. So it is solved by hardware changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a nice day.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Nov 2013 12:25:38 GMT</pubDate>
    <dc:creator>ClausStovgaard</dc:creator>
    <dc:date>2013-11-22T12:25:38Z</dc:date>
    <item>
      <title>Problem with memory shared between USB, DMA and CPU in an iMX 51.</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-memory-shared-between-USB-DMA-and-CPU-in-an-iMX-51/m-p/209540#M12372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having a problem, where the memory controller / TLB and cache system on an iMx 51 seems to play tricks on me.&lt;/P&gt;&lt;P&gt;The problem can be described by the following pice of code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="_jivemacro_uid_13556717067026301 jive_text_macro jive_macro_code" jivemacro_uid="_13556717067026301"&gt;volatile EndpointTransferDescriptorStruct* dTDPtr = dTDHandlerPtr-&amp;gt;dTD;
// 4K apart buffer page pointers
U32 currentStartAddress = (U32)(transfer.requestStartAddress + currentOffset);
dTDPtr-&amp;gt;BufferPointerPage0 = currentStartAddress;
dTDPtr-&amp;gt;BufferPointerPage1 = dTDPtr-&amp;gt;BufferPointerPage0 + 4096;
dTDPtr-&amp;gt;BufferPointerPage2 = dTDPtr-&amp;gt;BufferPointerPage1 + 4096;
dTDPtr-&amp;gt;BufferPointerPage3 = dTDPtr-&amp;gt;BufferPointerPage2 + 4096;
dTDPtr-&amp;gt;BufferPointerPage4 = dTDPtr-&amp;gt;BufferPointerPage3 + 4096;

U32 tempPtr = dTDHandlerPtr-&amp;gt;dTD-&amp;gt;BufferPointerPage0;
if (tempPtr)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (tempPtr dTD);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; U32 timeout = 100;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (timeout)
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; U32 tempPtrTwo = dTDHandlerPtr-&amp;gt;dTD-&amp;gt;BufferPointerPage0;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRACEE("Buffer pointer 0 0x%x, @ %dms\n", tempPtrTwo, GetTimeMs());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (tempPtrTwo == currentStartAddress)
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wait(1);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; timeout--;
&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; TRACE( "stop\n" );
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRACE("temp 0x%x, 0x%x, 0x%x", tempPtr, dTDPtr, dTDHandlerPtr-&amp;gt;dTD);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRACE("temp 2 0x%x\n", currentStartAddress);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ASSERT(0);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This piece of code is part of a bigger system, which runs in some time, until the following is printed, and I can break it by my debugger at the "stop" trace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;
&lt;P&gt;How could this happens startAddr = 0xaf3e0380, tempPtr 0x4000380, dTDPtr 0xaf32c0e0, dTD 0xaf32c0e0??&lt;/P&gt;
&lt;P&gt;Buffer pointer 0 0xaf3e0380, @ 95930ms&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;The address in startAddr is correct, where tempPtr is not correct. Looking at the structure with BufferPointerPage1-4 its address is not correct, as it uses the 0x4000380 address as value for BufferPointerPage0. When I read BufferPointerPage0 ones more at line 18 the value is correct. Some how either the write seems "lazy" compared to the read. Or the read fails some times before it is refreshed and is correct later.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;For fully understanding this, you will need to know, that dTDPtr pointer is pointing to the top of the LPDDR memory, which is setup to be uncached seen from the CPU. The dTRPtr is also declared volatile all places it is used, as it is handed over to hardware later. All in all is there 12 mb of uncached memory, which contains the QH, a pool of dTDs. Just next to this area (starting inside the same 1 mb section of memory), some buffers used by the DMA and USB is located. So looking at the memory, it must control access from CPU, DMA and USB, and still maintain correct data in the memory.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;I will like some input to this problem.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Dec 2012 15:15:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Problem-with-memory-shared-between-USB-DMA-and-CPU-in-an-iMX-51/m-p/209540#M12372</guid>
      <dc:creator>ClausStovgaard</dc:creator>
      <dc:date>2012-12-16T15:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with memory shared between USB, DMA and CPU in an iMX 51.</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-memory-shared-between-USB-DMA-and-CPU-in-an-iMX-51/m-p/209541#M12373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just the TLB setup of the uncached memory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="_jivemacro_uid_13556711810022244 jive_text_macro jive_macro_code" jivemacro_uid="_13556711810022244"&gt;
&lt;P&gt;TLBEntry sectionTLB;&lt;/P&gt;
&lt;P&gt;sectionTLB.value = 0;&lt;/P&gt;
&lt;P&gt;sectionTLB.attributes.type01 = 2;&amp;nbsp;&amp;nbsp; // Must be 2 for section TLBs&lt;/P&gt;
&lt;P&gt;sectionTLB.attributes.type2 = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Must be 0 for section TLBs&lt;/P&gt;
&lt;P&gt;sectionTLB.attributes.AP01 = 3;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Access permissions: full access&lt;/P&gt;
&lt;P&gt;sectionTLB.attributes.AP2 = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Access permissions: full access&lt;/P&gt;
&lt;P&gt;sectionTLB.attributes.nG = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Make it global&lt;/P&gt;
&lt;P&gt;sectionTLB.attributes.NS = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Make it secure&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;uncachedRam.value = sectionTLB.value;&lt;/P&gt;
&lt;P&gt;uncachedRam.attributes.B = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Inner: non-cachable&lt;/P&gt;
&lt;P&gt;uncachedRam.attributes.C = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;/P&gt;
&lt;P&gt;uncachedRam.attributes.TEX = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Outer: non-cachable&lt;/P&gt;
&lt;P&gt;uncachedRam.attributes.S = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Shareable&lt;/P&gt;
&lt;P&gt;uncachedRam.attributes.XN = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Execute OK&lt;/P&gt;
&lt;P&gt;uncachedRam.attributes.nG = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // NotGlobal = 1 (i.e. it is not process specific)&lt;/P&gt;
&lt;P&gt;uncachedRam.attributes.NS = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Secure, can translate in both secure and non secure space&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 16 Dec 2012 15:21:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Problem-with-memory-shared-between-USB-DMA-and-CPU-in-an-iMX-51/m-p/209541#M12373</guid>
      <dc:creator>ClausStovgaard</dc:creator>
      <dc:date>2012-12-16T15:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with memory shared between USB, DMA and CPU in an iMX 51.</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-memory-shared-between-USB-DMA-and-CPU-in-an-iMX-51/m-p/209542#M12374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Claus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was looking through some of the older issues in the community and came across this one.&amp;nbsp; Are you still having this issue?&amp;nbsp; If so, do you have an update as to your progress in solving it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Grant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Nov 2013 23:34:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Problem-with-memory-shared-between-USB-DMA-and-CPU-in-an-iMX-51/m-p/209542#M12374</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2013-11-19T23:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with memory shared between USB, DMA and CPU in an iMX 51.</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-memory-shared-between-USB-DMA-and-CPU-in-an-iMX-51/m-p/209543#M12375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Grant&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem was in the hardware. So it is solved by hardware changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a nice day.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 12:25:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Problem-with-memory-shared-between-USB-DMA-and-CPU-in-an-iMX-51/m-p/209543#M12375</guid>
      <dc:creator>ClausStovgaard</dc:creator>
      <dc:date>2013-11-22T12:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with memory shared between USB, DMA and CPU in an iMX 51.</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Problem-with-memory-shared-between-USB-DMA-and-CPU-in-an-iMX-51/m-p/209544#M12376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN style="font-family: Bookman Old Style , serif "&gt;Hi Claus,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Bookman Old Style , serif "&gt;Glad you were able to identify and fix this issue.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Bookman Old Style , serif "&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Bookman Old Style , serif "&gt;Grant&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 14:26:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Problem-with-memory-shared-between-USB-DMA-and-CPU-in-an-iMX-51/m-p/209544#M12376</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2013-11-22T14:26:47Z</dc:date>
    </item>
  </channel>
</rss>

