<?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: Descriptor memory allocation on SRAM1 for DMAC in LPC84x etc... in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Descriptor-memory-allocation-on-SRAM1-for-DMAC-in-LPC84x-etc/m-p/1193471#M43144</link>
    <description>&lt;P&gt;HI &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/161666"&gt;@shoichi_kojima&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Continuing with the follow up. Here is the feedback that&amp;nbsp; our team provided me:&lt;/P&gt;
&lt;P&gt;When implementing DMA, there are some limitations for&amp;nbsp;memory use. For example, a right alignment condition might need to be followed.&lt;/P&gt;
&lt;P&gt;To get rid of confusion of these limitations by the customers, the driver usually provides&amp;nbsp;&lt;STRONG&gt; pre-allocated memory&lt;/STRONG&gt; for several memory items (in this case de DMA descriptor table)&amp;nbsp; .This&amp;nbsp; leaves more flexibility to the customers, while they would not see the limitation. Usually, there might be a balance between the performance and flexibility.&lt;/P&gt;
&lt;P&gt;Please note that addres of the DMA channel descriptor memory at DMA-&amp;gt;SRAM_BASE register should be 512 bytes aligned. * Also, a piece of memory , like the descriptor table , should be always allocated when initializing the DMA module, before using it.&lt;/P&gt;
&lt;P&gt;If you want to manage the DMA-&amp;gt;SRAM_BASE it is OK, please try to follow the align condition described above. &lt;STRONG&gt;&amp;nbsp;However,&lt;/STRONG&gt; after the initialization of the DMA controller, changing the DMA-&amp;gt;SRAM_BASE is not recommended.&lt;/P&gt;
&lt;P&gt;We hope this information could help you with your inquiries.&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Diego.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit *:&amp;nbsp; Adding sentence with further details: Also, a piece of memory , like the descriptor table , should be always allocated when initializing the DMA module, before using it.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Dec 2020 20:03:06 GMT</pubDate>
    <dc:creator>diego_charles</dc:creator>
    <dc:date>2020-12-16T20:03:06Z</dc:date>
    <item>
      <title>Descriptor memory allocation on SRAM1 for DMAC in LPC84x etc...</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Descriptor-memory-allocation-on-SRAM1-for-DMAC-in-LPC84x-etc/m-p/1183091#M42874</link>
      <description>&lt;P&gt;Dear fellows,&lt;/P&gt;&lt;P&gt;I'm trying to utilize DMAC at its best performance balance in a system.&lt;/P&gt;&lt;P&gt;Let me pick up LPC845 for examples.&lt;/P&gt;&lt;P&gt;Due the architecture nature of that DMAC, RAM resource must be assigned&lt;/P&gt;&lt;P&gt;as virtual DMAC registers, sometimes called (Head) Descriptor.&lt;/P&gt;&lt;P&gt;Of course it is obvious that assigned SRAM is not the one which is used&lt;/P&gt;&lt;P&gt;by CPU busmaster related accesses such as stack access at interrupt,&lt;/P&gt;&lt;P&gt;write access&amp;nbsp;by MTB etc...&lt;/P&gt;&lt;P&gt;MTB is limited to access only with SRAM0.&lt;/P&gt;&lt;P&gt;So, the RAM which is to be assigned to DMAC had better be SRAM1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In fsl_dma.c/h implementation, I can not&amp;nbsp;enjoy SRAMs as described above.&lt;/P&gt;&lt;P&gt;An API "DMA_InstallDescriptorMemory()" is provided, which set s&lt;/P&gt;&lt;P&gt;SRAMBASE register of DMA. SRAM1's base address 0x10002000 would&lt;/P&gt;&lt;P&gt;be the reasonable setting, I suppose.&lt;/P&gt;&lt;P&gt;But, any of further DMA driver APIs accepting channel parameter ignore&lt;/P&gt;&lt;P&gt;current SRAMBASE setting made on DMA hardware.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why this happens?&lt;/P&gt;&lt;P&gt;Implementation concept of those APIs do not fit SRAM1 assignment ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 10:57:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Descriptor-memory-allocation-on-SRAM1-for-DMAC-in-LPC84x-etc/m-p/1183091#M42874</guid>
      <dc:creator>shoichi_kojima</dc:creator>
      <dc:date>2020-11-13T10:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Descriptor memory allocation on SRAM1 for DMAC in LPC84x etc...</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Descriptor-memory-allocation-on-SRAM1-for-DMAC-in-LPC84x-etc/m-p/1185515#M42925</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/161666"&gt;@shoichi_kojima&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Probably , when you called the DMA_InstallDescriptorMemory() function , the address of the DMA descriptors was set in the&amp;nbsp; SRAMBASE . However the functions that received the DMA channel arguments where using the default address of &lt;STRONG&gt;&lt;EM&gt;s_dma_descriptor_table0&lt;/EM&gt;&lt;/STRONG&gt;, which is&amp;nbsp; placed on SRAM0 at 0x1000_0200&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;void DMA_SubmitChannelTransferParameter(
    dma_handle_t *handle, uint32_t xferCfg, void *srcStartAddr, void *dstStartAddr, void *nextDesc)
{
...
  dma_descriptor_t *descriptor = (dma_descriptor_t *)(&amp;amp;s_dma_descriptor_table[instance][handle-&amp;gt;channel]);

    DMA_SetupDescriptor(descriptor, xferCfg, srcStartAddr, dstStartAddr, nextDesc);
...
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the lpcxpresso845max dma_m2m_polling example I tried to&amp;nbsp; set the DMA descriptors into SRAM1&lt;/P&gt;
&lt;P&gt;1 I created a new&amp;nbsp; memory region, according&amp;nbsp; to the&amp;nbsp; address of SRAM1 region. And then I specified the dma descriptor table to be placed in that&amp;nbsp; area.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="diego_charles_0-1605734129247.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/130421i1D3C76B14C4E9F4E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="diego_charles_0-1605734129247.png" alt="diego_charles_0-1605734129247.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;#include  "cr_section_macros.h"
__DATA(descriptor_RAM ) dma_descriptor_t s_dma_descriptor_table0[(25)]   __attribute__((aligned((512)))); // ;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;2 After the DMA_init was done,&amp;nbsp; the SRAMBASE received the addres of the &lt;STRONG&gt;&lt;EM&gt;s_dma_descriptor_table0&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="diego_charles_1-1605734213136.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/130422iA8E895687EA1EF64/image-size/medium?v=v2&amp;amp;px=400" role="button" title="diego_charles_1-1605734213136.png" alt="diego_charles_1-1605734213136.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3 FInally ,&amp;nbsp; I was able to run the example ,having the DMA descriptors placed into the SRAM1 area.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;DMA memory to memory polling example begin.
Destination Buffer:
0	0	0	0	
DMA memory to memory polling example finish.
Destination Buffer:
1	2	3	4	&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will find more details on how to place variables into specific memory areas in the following post. &lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.nxp.com/t5/Kinetis-Design-Studio-Knowledge/Relocating-Code-and-Data-Using-the-MCUXpresso-IDE/ta-p/1103719" target="_blank"&gt;https://community.nxp.com/t5/Kinetis-Design-Studio-Knowledge/Relocating-Code-and-Data-Using-the-MCUXpresso-IDE/ta-p/1103719&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My&amp;nbsp; apologies for the delayed reply.&lt;/P&gt;
&lt;P&gt;Please let me know if this is what you where looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Diego.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 22:23:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Descriptor-memory-allocation-on-SRAM1-for-DMAC-in-LPC84x-etc/m-p/1185515#M42925</guid>
      <dc:creator>diego_charles</dc:creator>
      <dc:date>2020-11-18T22:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: Descriptor memory allocation on SRAM1 for DMAC in LPC84x etc...</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Descriptor-memory-allocation-on-SRAM1-for-DMAC-in-LPC84x-etc/m-p/1187896#M43004</link>
      <description>&lt;P&gt;Dear staff,&lt;/P&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;I think I understand the mechanism of DMAC and Descriptor SRAM area for DMAC.&lt;/P&gt;&lt;P&gt;Probably, the default array of DMA descriptor named "s_dma_descriptor_table0" is&lt;/P&gt;&lt;P&gt;intended to be a kind of "static-link"-ed variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My understanding and idea is that those area are to be handled as "dynamic-link"-ed ones&lt;/P&gt;&lt;P&gt;like variable vector base of Cortex-M0+.&lt;/P&gt;&lt;P&gt;By some reasons, such as power-management, and memory resource-management&lt;/P&gt;&lt;P&gt;"on-demand" setting might be expected. User may change it to the most reasonable&lt;/P&gt;&lt;P&gt;SRAM resources on-demand. Of course, those SRAM area candidates are strategically&lt;/P&gt;&lt;P&gt;allocated by employing linker's feature, giving them independent region/sections.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the software point of view, especially for "prepared API set", the only value every&lt;/P&gt;&lt;P&gt;corresponding code can ever depend would be the DMAC.SRAMBASE,&lt;/P&gt;&lt;P&gt;not a particular array-variables such as "s_dma_descriptor_table0".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my confusion and the reason why I asked&lt;/P&gt;&lt;P&gt;&amp;gt; Implementation concept of those APIs do not fit SRAM1 assignment ?&lt;/P&gt;&lt;P&gt;Current "fsl_dma" driver API set seems depending on "s_dma_descriptor_table0",&lt;/P&gt;&lt;P&gt;which is just a particularly-named statically-linked variable and is encapsulated among API set.&lt;/P&gt;&lt;P&gt;Why does the implementer team working on "fsl_dma" chose that way that corresponding&lt;/P&gt;&lt;P&gt;DMA API functions never see the CURRENT content of DMAC.SRAMBSE ?&lt;/P&gt;&lt;P&gt;I don't think it cost much even in run-time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Probably, the team has its own design/implementation concept, which is not as same as&lt;/P&gt;&lt;P&gt;I have, at least...&lt;/P&gt;&lt;P&gt;I would like to know theirs as an alternative.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 06:11:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Descriptor-memory-allocation-on-SRAM1-for-DMAC-in-LPC84x-etc/m-p/1187896#M43004</guid>
      <dc:creator>shoichi_kojima</dc:creator>
      <dc:date>2020-11-24T06:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Descriptor memory allocation on SRAM1 for DMAC in LPC84x etc...</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Descriptor-memory-allocation-on-SRAM1-for-DMAC-in-LPC84x-etc/m-p/1191071#M43093</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/161666"&gt;@shoichi_kojima&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just wanted to let you know that I requested feedback from&amp;nbsp; my colleagues before getting back to you with a reply to your inquiries. We are checking further and I will keep you updated on this process.&lt;/P&gt;
&lt;P&gt;My apologies for the delay.&lt;/P&gt;
&lt;P&gt;Yours,&lt;/P&gt;
&lt;P&gt;Diego.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 18:52:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Descriptor-memory-allocation-on-SRAM1-for-DMAC-in-LPC84x-etc/m-p/1191071#M43093</guid>
      <dc:creator>diego_charles</dc:creator>
      <dc:date>2020-11-30T18:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Descriptor memory allocation on SRAM1 for DMAC in LPC84x etc...</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Descriptor-memory-allocation-on-SRAM1-for-DMAC-in-LPC84x-etc/m-p/1193471#M43144</link>
      <description>&lt;P&gt;HI &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/161666"&gt;@shoichi_kojima&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Continuing with the follow up. Here is the feedback that&amp;nbsp; our team provided me:&lt;/P&gt;
&lt;P&gt;When implementing DMA, there are some limitations for&amp;nbsp;memory use. For example, a right alignment condition might need to be followed.&lt;/P&gt;
&lt;P&gt;To get rid of confusion of these limitations by the customers, the driver usually provides&amp;nbsp;&lt;STRONG&gt; pre-allocated memory&lt;/STRONG&gt; for several memory items (in this case de DMA descriptor table)&amp;nbsp; .This&amp;nbsp; leaves more flexibility to the customers, while they would not see the limitation. Usually, there might be a balance between the performance and flexibility.&lt;/P&gt;
&lt;P&gt;Please note that addres of the DMA channel descriptor memory at DMA-&amp;gt;SRAM_BASE register should be 512 bytes aligned. * Also, a piece of memory , like the descriptor table , should be always allocated when initializing the DMA module, before using it.&lt;/P&gt;
&lt;P&gt;If you want to manage the DMA-&amp;gt;SRAM_BASE it is OK, please try to follow the align condition described above. &lt;STRONG&gt;&amp;nbsp;However,&lt;/STRONG&gt; after the initialization of the DMA controller, changing the DMA-&amp;gt;SRAM_BASE is not recommended.&lt;/P&gt;
&lt;P&gt;We hope this information could help you with your inquiries.&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Diego.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit *:&amp;nbsp; Adding sentence with further details: Also, a piece of memory , like the descriptor table , should be always allocated when initializing the DMA module, before using it.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2020 20:03:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Descriptor-memory-allocation-on-SRAM1-for-DMAC-in-LPC84x-etc/m-p/1193471#M43144</guid>
      <dc:creator>diego_charles</dc:creator>
      <dc:date>2020-12-16T20:03:06Z</dc:date>
    </item>
  </channel>
</rss>

