Tool/software:
Hi!
I am trying to set up my DMA to be triggered by an EPWM.
After the EPWM trigger, the DMA will grab 2 Bytes (ACnt), 4 times (BCnt), 2 times (CCnt).
I want the DMA to be reconfigured to do the full transfer again (including the CCnt) the next the EPWM triggers.
The issue I am seeing is it only does the transfer once (or twice) at the very beginning, then does not continue the dma transfer upon every time the EPWM triggers. I don't see new data at the destination when I know the source is changing.
If I change this to only do the 2D transfer (i.e. set cCnt = 1, p.srcCIdx = 0; p.destCIdx = 0;) it does do continuous dma transfer and I see new data at the destination
I am currently using AB transfer but open to change if theres a better way.
Here are the params I'm using:
EDMACCPaRAMEntry p;
EDMA_ccPaRAMEntry_init(&p);
p.srcAddr = src_addr;
p.destAddr = dest_addr;
p.aCnt = 2;
p.bCnt = 4;
p.cCnt = 2;
p.bCntReload = p.bCnt;
p.srcBIdx = 0x100;
p.destBIdx = 0x2;
p.srcCIdx = 0x1000;
p.destCIdx = 0x2 * 0x4;
p.srcBIdxExt = 0;
p.destBIdxExt = 0;
p.linkAddr = 0xFFFFU; // Disable linking here, will be set explicitly later.
p.opt = 0U;
if (!is_empty_buffer) {
p.opt |= EDMA_OPT_TCINTEN_MASK;
}
// AB-sync transfer
p.opt |= ((EDMA_SYNC_AB << EDMA_OPT_SYNCDIM_SHIFT) & EDMA_OPT_SYNCDIM_MASK);
uint32_t baseAddr = EDMA_getBaseAddr(gEdmaHandle[0]);
uint32_t regionId = EDMA_getRegionId(gEdmaHandle[0]);
uint32_t channel_id = EDMA_RESOURCE_ALLOC_ANY;
uint32_t tcc = EDMA_RESOURCE_ALLOC_ANY;
uint32_t param = EDMA_RESOURCE_ALLOC_ANY;
EDMA_configureChannelRegion(
baseAddr, regionId, EDMA_CHANNEL_TYPE_DMA, channel_id, tcc, param, 0);
// Clear and set TCC in opt
p.opt &= ~EDMA_OPT_TCC_MASK;
p.opt |= ((static_cast<std::uint32_t>(tcc) << EDMA_OPT_TCC_SHIFT) & EDMA_OPT_TCC_MASK);
EDMA_setPaRAM(baseAddr, param, &p);
// Link the DMA Param to itself to enable continuous operation
EDMA_linkChannel(baseAddr, param, param);
EDMA_enableTransferRegion(baseAddr, regionId, channel_id, EDMA_TRIG_MODE_EVENT);
Would really appreciate if someone could point out how to configure the 3D to link this transfer to continuously run at every epwm trigger.
Thanks!