<?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>Kinetis Software Development KitのトピックRe: KSDK eDMA edma_software_tcd_t allocation needs to be 'number plus 1'</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KSDK-eDMA-edma-software-tcd-t-allocation-needs-to-be-number-plus/m-p/344583#M291</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know if this helps at all but did you try using malloc or memset at all? I needed 1 descriptor for my application on K22, and using malloc and memset I only needed to allocate the actual amount of memory necessary for the TCD. &lt;/P&gt;&lt;P&gt;But you are absolutely correct that the descriptor argument is offset by one - it expects tcd[n] + 1.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I'm not sure where you are getting &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.6000003814697px; font-family: 'courier new', courier; color: #3d3d3d;"&gt;period + 1) * sizeof( edma_software_tcd_t ) for the size argument. In my application and from looking at examples, it appears size is the number of bytes in the data type used in your transfer. I pass in two for int16t with one 1 tcd structure. If you're using 32 bit data with your peripheral, then your algebra happens to work out, but I don't think that's the way it actually works. Check out the SAI (SND really) twr audio examples in KSDK and you'll see a good example of how they handle the size argument. It's purely based on the number of bits in each piece of data, at least for SAI, but I can't imagine that's not a generic feature of the EDMA.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.6000003814697px; font-family: 'courier new', courier; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.6000003814697px; font-family: 'courier new', courier; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.6000003814697px; font-family: 'courier new', courier; color: #3d3d3d;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Nov 2014 03:12:08 GMT</pubDate>
    <dc:creator>bosleymusic_com</dc:creator>
    <dc:date>2014-11-21T03:12:08Z</dc:date>
    <item>
      <title>KSDK eDMA edma_software_tcd_t allocation needs to be 'number plus 1'</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KSDK-eDMA-edma-software-tcd-t-allocation-needs-to-be-number-plus/m-p/344582#M290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found that while using the KSDK &lt;SPAN style="font-family: 'courier new', courier;"&gt;EDMA_DRV_ConfigLoopTransfer&lt;/SPAN&gt; function, the memory block passed to that function to hold the transfer control descriptors &lt;SPAN style="font-family: 'courier new', courier;"&gt;edma_software_tcd_t&lt;/SPAN&gt; need to be the number of descriptors indicated plus 1.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is different from the @param documentation that states that the size needs to be &lt;SPAN style="font-family: 'courier new', courier;"&gt;period * sizeof( edma_software_tcd_t )&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, the documentation states that the memory block needs to be aligned on a 32 byte boundary.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, stepping through the &lt;SPAN style="font-family: 'courier new', courier; font-size: 13.6000003814697px;"&gt;EDMA_DRV_ConfigLoopTransfer&lt;/SPAN&gt; function it appears that internally it expects the size to be size to be (&lt;SPAN style="font-family: 'courier new', courier; font-size: 13.6000003814697px;"&gt;period + 1) * sizeof( edma_software_tcd_t ).&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It uses the &lt;SPAN style="font-family: 'courier new', courier;"&gt;STDC_ADDR&lt;/SPAN&gt; macro to enforce the 32 byte address alignment at the cost of needing an extra 32 bytes allocated.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; edma_software_tcd_t&amp;nbsp; edma_transfer_descriptors0[2] &lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;__attribute__((aligned (32)));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;did not work for the 2 descriptors that I needed. It actually needed to allocated 3 descriptors:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="font-size: 13.6000003814697px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; edma_software_tcd_t&amp;nbsp; edma_transfer_descriptors0[3] &lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;__attribute__((aligned (32)));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and when used it ends up using &lt;SPAN style="font-family: 'courier new', courier; font-size: 13.6000003814697px;"&gt;edma_transfer_descriptors0[1] &lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;and&lt;/SPAN&gt; &lt;SPAN style="font-family: 'courier new', courier; font-size: 13.6000003814697px;"&gt;edma_transfer_descriptors0[2] &lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;while ignoring&lt;/SPAN&gt; &lt;SPAN style="font-family: 'courier new', courier; font-size: 13.6000003814697px;"&gt;edma_transfer_descriptors0[0].&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;Just so you know...&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Sep 2014 02:58:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KSDK-eDMA-edma-software-tcd-t-allocation-needs-to-be-number-plus/m-p/344582#M290</guid>
      <dc:creator>marcohess</dc:creator>
      <dc:date>2014-09-06T02:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: KSDK eDMA edma_software_tcd_t allocation needs to be 'number plus 1'</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KSDK-eDMA-edma-software-tcd-t-allocation-needs-to-be-number-plus/m-p/344583#M291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't know if this helps at all but did you try using malloc or memset at all? I needed 1 descriptor for my application on K22, and using malloc and memset I only needed to allocate the actual amount of memory necessary for the TCD. &lt;/P&gt;&lt;P&gt;But you are absolutely correct that the descriptor argument is offset by one - it expects tcd[n] + 1.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I'm not sure where you are getting &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.6000003814697px; font-family: 'courier new', courier; color: #3d3d3d;"&gt;period + 1) * sizeof( edma_software_tcd_t ) for the size argument. In my application and from looking at examples, it appears size is the number of bytes in the data type used in your transfer. I pass in two for int16t with one 1 tcd structure. If you're using 32 bit data with your peripheral, then your algebra happens to work out, but I don't think that's the way it actually works. Check out the SAI (SND really) twr audio examples in KSDK and you'll see a good example of how they handle the size argument. It's purely based on the number of bits in each piece of data, at least for SAI, but I can't imagine that's not a generic feature of the EDMA.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.6000003814697px; font-family: 'courier new', courier; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.6000003814697px; font-family: 'courier new', courier; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.6000003814697px; font-family: 'courier new', courier; color: #3d3d3d;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Nov 2014 03:12:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/KSDK-eDMA-edma-software-tcd-t-allocation-needs-to-be-number-plus/m-p/344583#M291</guid>
      <dc:creator>bosleymusic_com</dc:creator>
      <dc:date>2014-11-21T03:12:08Z</dc:date>
    </item>
  </channel>
</rss>

