Hello Kinetis fans,
This time I bring to you a document which explains what is and how to configure scatter/gather feature which is present in the Enhanced Direct Memory Access (eDMA). This document includes an example project for the Kinetis Design Studio (KDS) which works in the FRDM-K64F board but the configuration is the same for any MCU which includes the eDMA peripheral.
If you are interested in the channel linking feature, please take a look into the document What is and how to configure the eDMA channel linking feature.
I hope you find this document useful.
Best regards,
Earl Orlando Ramírez-Sánchez
Technical Support Engineer
NXP Semiconductors
Original Attachment has been moved to: eDMACircularBufferWithScatterGather.zip
Excellent document Earl Orlando Ramirez-Sanchez. Perfect timing too as I'm trying to understand how to link two DMA channels together.
I'm using the TWR-K65 EDMA example and the following FSDK call but it is not working as expected. Correct me if I am wrong but this should configure the "primary" channel's software TCD with the channel of the "secondary" channel to trigger automatically when a major loop completes.
EDMA_DRV_PrepareDescriptorChannelLink(stcd, channel2);
The channel1 TCD is configured for a memory to memory SGL transfer:
EDMA_DRV_ConfigScatterGatherTransfer(
&chnState, stcd, kEDMAMemoryToMemory,
EDMA_TRANSFER_SIZE, EDMA_WARTERMARK_LEVEL,
&srcSG, &destSG,
EDMA_CHAIN_LENGTH);
The channel2 TCD is configured in a similar way except its source buffer is the destination buffer of channel 1:
EDMA_DRV_ConfigScatterGatherTransfer(
&chnState2, stcd2, kEDMAMemoryToMemory,
EDMA_TRANSFER_SIZE, EDMA_WARTERMARK_LEVEL,
&srcSG2, &destSG2,
EDMA_CHAIN_LENGTH);
Here is the modified main.c for reference: