Marco Hess

KSDK eDMA edma_software_tcd_t allocation needs to be 'number plus 1'

Discussion created by Marco Hess on Sep 5, 2014
Latest reply on Nov 20, 2014 by Donald Bosley

I found that while using the KSDK EDMA_DRV_ConfigLoopTransfer function, the memory block passed to that function to hold the transfer control descriptors edma_software_tcd_t need to be the number of descriptors indicated plus 1.


This is different from the @param documentation that states that the size needs to be period * sizeof( edma_software_tcd_t )


Also, the documentation states that the memory block needs to be aligned on a 32 byte boundary.


However, stepping through the EDMA_DRV_ConfigLoopTransfer function it appears that internally it expects the size to be size to be (period + 1) * sizeof( edma_software_tcd_t ).


It uses the STDC_ADDR macro to enforce the 32 byte address alignment at the cost of needing an extra 32 bytes allocated.


So my

     edma_software_tcd_t  edma_transfer_descriptors0[2] __attribute__((aligned (32)));


did not work for the 2 descriptors that I needed. It actually needed to allocated 3 descriptors:


     edma_software_tcd_t  edma_transfer_descriptors0[3] __attribute__((aligned (32)));

and when used it ends up using edma_transfer_descriptors0[1] and edma_transfer_descriptors0[2] while ignoring edma_transfer_descriptors0[0].


Just so you know...