This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28386D: I'm testing DMA (Direct Memory Access).

Part Number: TMS320F28386D


Tool/software:

Hello experts

I'm testing DMA block. 

I use 3 DMA Channels.

My source Address are same. ( the name is "fsiRxDataBuf" );

I can get CPU1_FSI_PACKETs_RX from fsiRxDataBuf.

but CPU1_FSI_PACKETs_RX2 and CPU1_FSI_PACKETs_RX3 buffers are not valid.

I want to select my dest buffer. 

Can I change the dest buffer using DMA?

Thank you for reading.

TypeNumFSI = frameDataRX[0] & 0x0F00;

switch(TypeNumFSI){
case 0x0000: 
DMA_startChannel(DMA_CH1_BASE);
DMA_forceTrigger(DMA_CH1_BASE);
break;

case 0x0100: 
DMA_startChannel(DMA_CH2_BASE);
DMA_forceTrigger(DMA_CH2_BASE);
break;

case 0x0200: 
DMA_startChannel(DMA_CH3_BASE);
DMA_forceTrigger(DMA_CH3_BASE);
break;
}

My init code is:

void initDMA1(void)
{

DMA_ConfigParams transfParams;
const void *destAddr;
const void *srcAddr;
srcAddr = (const void *)fsiRxDataBuf;
destAddr = (const void *)CPU1_FSI_PACKETs_RX;


//
// configure DMA CH1
//
transfParams.transferTrigger = DMA_TRIGGER_SOFTWARE;
transfParams.interruptMode = DMA_INT_AT_END;
transfParams.enableInterrupt = 1;
transfParams.configSize = DMA_CFG_SIZE_16BIT;
transfParams.transferMode = DMA_CFG_ONESHOT_DISABLE;
transfParams.reinitMode = DMA_CFG_CONTINUOUS_DISABLE;
transfParams.burstSize = 8;
transfParams.transferSize = 6; //48/8
transfParams.srcWrapSize = 0xFFFF;
transfParams.destWrapSize = 0xFFFF;
transfParams.destAddr = (uint32_t)destAddr;
transfParams.srcAddr = (uint32_t)srcAddr;
transfParams.srcBurstStep = 1;
transfParams.destBurstStep = 1;
transfParams.srcTransferStep = 1;
transfParams.destTransferStep = 1;
transfParams.srcWrapStep = 0;
transfParams.destWrapStep = 0;

DMA_configChannel(DMA_CH1_BASE, &transfParams);
}

void initDMA2(void)
{

DMA_ConfigParams transfParams;
const void *destAddr;
const void *srcAddr;
srcAddr = (const void *)fsiRxDataBuf;
destAddr = (const void *)CPU1_FSI_PACKETs_RX2;


//
// configure DMA CH2
//
transfParams.transferTrigger = DMA_TRIGGER_SOFTWARE;
transfParams.interruptMode = DMA_INT_AT_END;
transfParams.enableInterrupt = 1;
transfParams.configSize = DMA_CFG_SIZE_16BIT;
transfParams.transferMode = DMA_CFG_ONESHOT_DISABLE;
transfParams.reinitMode = DMA_CFG_CONTINUOUS_DISABLE;;
transfParams.burstSize = 8;
transfParams.transferSize = 6; //48/8
transfParams.srcWrapSize = 0xFFFF;
transfParams.destWrapSize = 0xFFFF;
transfParams.destAddr = (uint32_t)destAddr;
transfParams.srcAddr = (uint32_t)srcAddr;
transfParams.srcBurstStep = 1;
transfParams.destBurstStep = 1;
transfParams.srcTransferStep = 1;
transfParams.destTransferStep = 1;
transfParams.srcWrapStep = 0;
transfParams.destWrapStep = 0;

DMA_configChannel(DMA_CH2_BASE, &transfParams);
}

void initDMA3(void)
{

DMA_ConfigParams transfParams;
const void *destAddr;
const void *srcAddr;
srcAddr = (const void *)fsiRxDataBuf;
destAddr = (const void *)CPU1_FSI_PACKETs_RX3;


//
// configure DMA CH3
//
transfParams.transferTrigger = DMA_TRIGGER_SOFTWARE;
transfParams.interruptMode = DMA_INT_AT_END;
transfParams.enableInterrupt = 1;
transfParams.configSize = DMA_CFG_SIZE_16BIT;
transfParams.transferMode = DMA_CFG_ONESHOT_DISABLE;
transfParams.reinitMode = DMA_CFG_CONTINUOUS_DISABLE;;
transfParams.burstSize = 8;
transfParams.transferSize = 6; //48/8
transfParams.srcWrapSize = 0xFFFF;
transfParams.destWrapSize = 0xFFFF;
transfParams.destAddr = (uint32_t)destAddr;
transfParams.srcAddr = (uint32_t)srcAddr;
transfParams.srcBurstStep = 1;
transfParams.destBurstStep = 1;
transfParams.srcTransferStep = 1;
transfParams.destTransferStep = 1;
transfParams.srcWrapStep = 0;
transfParams.destWrapStep = 0;

DMA_configChannel(DMA_CH3_BASE, &transfParams);
}

  • Hi Hahmin,

    If your settings across the different channels are all the same except for the destination address, you can just use one DMA channel and alter the destination address when needed by calling DMA_configAddresses(). The DST_ADDR_SHADOW and DEST_BEG_ADDR_SHADOW registers can be safely updated during a transfer and the updated address will be loaded into the DST_ADDR_ACTIVE and DEST_BEG_ADDR_ACTIVE registers at the start of the next transfer. I would still advise calling the DMA_configAddresses() function inside a DMA end of transfer ISR to avoid any synchronization issues.

    Best Regards,

    Delaney