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.

ACPY3_start hangs

 

Hello,

I am trying to use ACPY3 and DMAN3 to do some DMA transfers.  However, the ACPY3_start() function seems to be hanging and I cannot figure out why.  As far as I can tell it is properly setup.

Here is a portion of the initializations code:

 

/* Initialize ACPY3 */

dmaTab.numTransfers = 1;

dmaTab.numWaits = 1;

dmaTab.priority = IDMA3_PRIORITY_MEDIUM;

dmaTab.protocol = &ACPY3_PROTOCOL;

dmaTab.persistent = FALSE;


DMAN3_init();

ACPY3_init();


dmaStatus = DMAN3_createChannels(0, &dmaTab, 1);

memHandle = dmaTab.handle;


if (dmaStatus == DMAN3_SOK) {

   ACPY3_activate(memHandle);

   printf( "ACPY3 activated. \n" );

} else {

   printf( "Channel create failed. Status: %d\n", dmaStatus);

}


acpyPaRam.transferType = ACPY3_1D1D;

acpyPaRam.numElements = 1;

acpyPaRam.numFrames = 1;

acpyPaRam.waitId = 1;


 

And later I define the function Dcpy:

 

void Dcpy(void * destination, void * source, int length) {

/* Wait for previous copy to finish. */

if ( ACPY3_complete(memHandle) == 0 )

ACPY3_wait(memHandle);

printf( "Wait Complete.\n" ); // For debug


/* Setup next DMA copy */

acpyPaRam.srcAddr = source;

acpyPaRam.dstAddr = destination;

acpyPaRam.elementSize = length;


/* Configure ACPY3 */

ACPY3_configure(memHandle, &acpyPaRam, 0);

printf( "ACPY3 Configured.\n" ); // For debug


/* Start ACPY3 memory transfer */

ACPY3_start(memHandle);

printf( "ACPY3 Started.\n" ); // For debug

}

 

 

Any help as to why the transfer will not start?

 

-Nate

 

  • Nate,

    Is this a DM365 you're running on? How are you configuring DMAN3? It's possible that the PaRam base address is not set correctly. Can you provide us with your DMAN3 configuration so we can check it?

    Regards,

        Janet

  • Janet,

    Yes, this is a DM365.  I think you may be right, here is all that is in my .cfg for DMAN3:

     

    var DMAN3 = xdc.useModule('ti.sdo.fc.dman3.DMAN3');

    DMAN3.heapInternal = "L1DHEAP";

    DMAN3.heapExternal = "DDR";

     

     

    I added the following lines, but the problem remains.

     

    var DMAN3 = xdc.useModule('ti.sdo.fc.dman3.DMAN3');

    DMAN3.idma3Internal = false;

    DMAN3.heapInternal = "L1DHEAP";

    DMAN3.heapExternal = "DDR";

    DMAN3.paRamBaseIndex = 78;

    DMAN3.numPaRamEntries = 48;

    DMAN3.numQdmaChannels = 8;

    DMAN3.qdmaChannels = [0,1,2,3,4,5,6,7];

    DMAN3.numPaRamGroup[0] = 48;

    DMAN3.tccAllocationMaskL = 0;

    DMAN3.tccAllocationMaskH = 0xff;

    DMAN3.numTccGroup[0] = 8;

     

     

    Any Ideas?

    -Nate

  • Nate,

    I was able to run the codec engine video1_copy dma example on DM365 using just the default DMAN3 configuration (no added DMAN3 configuration in the .cfg file). Could you try adding trace to your program? You can enable GT trace by adding the following lines to your .cfg file:

        xdc.useModule('ti.sdo.fc.global.Settings').profile = "debug_trace"'

        var GTINFRA = xdc.useModule("ti.sdo.fc.utils.gtinfra.GTINFRA");
        GTINFRA.runtimeEnv = GTINFRA.NONE;

        var GT = xdc.useModule("ti.sdo.utils.trace.GT");
        GT.MALLOCFXN = "myMalloc";
        GT.PRINTFXN = "printfCaller";

    Then in you main(), before you call DMAN3_init(), and the following lines of code:

        GT_init();
        GT_set("ti.sdo.fc.dman3=01234567");

    Make sure to add the following include file, too:

        #include <ti/sdo/utils/trace/gt.h>

    When you run your app there should now be some DMAN3 trace output, which should hopefully tell us if there were any failures.

    Regards,

        Janet

  • Janet,

    I added this code and included the trace output.  I am not familiar enough with DMAN3 to pinpoint what is wrong here though.  Thanks for your help.

     

    @0x0000f973:[T:0x4001f7d0] ti.sdo.fc.dman3 - _DMAN3_initImpl> Enter

    @0x0000fb1f:[T:0x4001f7d0] ti.sdo.fc.dman3 - getNumAssignedTccs> Enter

    @0x0000fbaf:[T:0x4001f7d0] ti.sdo.fc.dman3 - getNumAssignedTccs> Max TCC is 0x20

    @0x0000fc2a:[T:0x4001f7d0] ti.sdo.fc.dman3 - getNumAssignedTccs> Exit

    @0x0000fcce:[T:0x4001f7d0] ti.sdo.fc.dman3 - getNumAssignedTccs> Enter

    @0x0000fd42:[T:0x4001f7d0] ti.sdo.fc.dman3 - getNumAssignedTccs> Max TCC is 0x0

    @0x0000fdb3:[T:0x4001f7d0] ti.sdo.fc.dman3 - getNumAssignedTccs> Exit

    @0x0000ffe7:[T:0x4001f7d0] ti.sdo.fc.dman3 - _DMAN3_initImpl> Created shared memory, key = 0x4e414d44

    @0x00010184:[T:0x4001f7d0] ti.sdo.fc.dman3 - Initializing DMAN3 shared data

    @0x00010411:[T:0x4001f7d0] ti.sdo.fc.dman3 - updateTccAllocationTable> Enter

    @0x000104fe:[T:0x4001f7d0] ti.sdo.fc.dman3 - updateTccAllocationTable> Exit

    @0x0001057e:[T:0x4001f7d0] ti.sdo.fc.dman3 - updateTccAllocationTable> Enter

    @0x000105ec:[T:0x4001f7d0] ti.sdo.fc.dman3 - updateTccAllocationTable> Exit

    @0x00011df8:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> segid = 0, size = 0x34, align = 0x4

    @0x00011ed1:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> bytes remaining before allocation: 0x3b50

    @0x00011f62:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> bytes remaining after allocation: 0x3b1c

    @0x00011fe4:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> returning base address: 0x41f8f4b0

    @0x00012061:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> segid = 0, size = 0xc0, align = 0x4

    @0x000120db:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> bytes remaining before allocation: 0x3b1c

    @0x00012150:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> bytes remaining after allocation: 0x3a5c

    @0x000121cd:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> returning base address: 0x41f8f4e4

    @0x00012278:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> segid = 0, size = 0x34, align = 0x4

    @0x00012305:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> bytes remaining before allocation: 0x3a5c

    @0x0001237f:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> bytes remaining after allocation: 0x3a28

    @0x000123f9:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> returning base address: 0x41f8f5a4

    @0x00012470:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> segid = 0, size = 0x120, align = 0x4

    @0x000124ed:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> bytes remaining before allocation: 0x3a28

    @0x00012564:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> bytes remaining after allocation: 0x3908

    @0x000125da:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3 shmAlloc> returning base address: 0x41f8f5d8

    @0x00012656:[T:0x4001f7d0] ti.sdo.fc.dman3 - _DMAN3_initImpl> Null PaRam is 0

    @0x000126cc:[T:0x4001f7d0] ti.sdo.fc.dman3 - _DMAN3_initImpl> Qdma channel 0 is pointing to the nullPaRam. Change its trigger word bit to 0x7 so it doesn't get triggered when we modify the nullPaRam

    @0x0001277b:[T:0x4001f7d0] ti.sdo.fc.dman3 - _DMAN3_initImpl> Qdma channel 1 is pointing to the nullPaRam. Change its trigger word bit to 0x7 so it doesn't get triggered when we modify the nullPaRam

    @0x00063c1f:[T:0x4001f7d0] ti.sdo.fc.dman3 - _DMAN3_initImpl> Qdma channel 2 is pointing to the nullPaRam. Change its trigger word bit to 0x7 so it doesn't get triggered when we modify the nullPaRam

    @0x00063cf0:[T:0x4001f7d0] ti.sdo.fc.dman3 - _DMAN3_initImpl> Qdma channel 3 is pointing to the nullPaRam. Change its trigger word bit to 0x7 so it doesn't get triggered when we modify the nullPaRam

    @0x00063d8c:[T:0x4001f7d0] ti.sdo.fc.dman3 - _DMAN3_initImpl> Qdma channel 4 is pointing to the nullPaRam. Change its trigger word bit to 0x7 so it doesn't get triggered when we modify the nullPaRam

    @0x00063e1b:[T:0x4001f7d0] ti.sdo.fc.dman3 - _DMAN3_initImpl> Qdma channel 5 is pointing to the nullPaRam. Change its trigger word bit to 0x7 so it doesn't get triggered when we modify the nullPaRam

    @0x00063ea5:[T:0x4001f7d0] ti.sdo.fc.dman3 - _DMAN3_initImpl> Qdma channel 6 is pointing to the nullPaRam. Change its trigger word bit to 0x7 so it doesn't get triggered when we modify the nullPaRam

    @0x00063fc5:[T:0x4001f7d0] ti.sdo.fc.dman3 - _DMAN3_initImpl> Qdma channel 7 is pointing to the nullPaRam. Change its trigger word bit to 0x7 so it doesn't get triggered when we modify the nullPaRam

    @0x00064077:[T:0x4001f7d0] ti.sdo.fc.dman3 - _DMAN3_initImpl> Setting static bit of null paRam (address = 0x41f93000)

    @0x00064146:[T:0x4001f7d0] ti.sdo.fc.dman3 - checkDMAN3Configuration> Enter

    @0x000641d9:[T:0x4001f7d0] ti.sdo.fc.dman3 - checkDMAN3Configuration> DMAN3 max PaRam entries configured to be 128, hardware reads 256

    @0x00064268:[T:0x4001f7d0] ti.sdo.fc.dman3 - checkDMAN3Configuration> DMAN3 max TCs configured to be 8, hardware reads 4

    @0x000642e8:[T:0x4001f7d0] ti.sdo.fc.dman3 - checkDMAN3Configuration> Exit (status=0)

    @0x0006435e:[T:0x4001f7d0] ti.sdo.fc.dman3 - _DMAN3_initImpl> DMAN3 SOC-specific configuration different from hardware, continuing with configured values

    @0x000643da:[T:0x4001f7d0] ti.sdo.fc.dman3 - _initQdmaConfiguration> Enter

    @0x00064472:[T:0x4001f7d0] ti.sdo.fc.dman3 - _initQdmaConfiguration> Exit

    @0x000644f7:[T:0x4001f7d0] ti.sdo.fc.dman3 - _DMAN3_initImpl> Exiting, _DMAN3_data = 0x41f8f000

    @0x00064573:[T:0x4001f7d0] ti.sdo.fc.dman3 - _DMAN3_initImpl> Exit

    @0x000646c9:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3_createChannels> Enter (groupId=0, dmaTab=0x41f8e924, numChans=1

    @0x00064784:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3_createChannels> Total Qdma channels requested1, PaRams requested 1, Tccs requested 1

    @0x00064857:[T:0x4001f7d0] ti.sdo.fc.dman3 - getContext> Enter (pContext=0xbeafec04, groupId=0, nTccs=1, nPaRams=1)

    @0x000648fb:[T:0x4001f7d0] ti.sdo.fc.dman3 - getContext> Context exists for groupId 0, context 0x41f8f0f0

    @0x0006497b:[T:0x4001f7d0] ti.sdo.fc.dman3 - getContext> Creating context for group 0 Tccs 1 PaRams 1

    @0x00064a2f:[T:0x4001f7d0] ti.sdo.fc.dman3 - createContext> Enter (pContext=0xbeafebcc, groupId=0, nTccs=1, nPaRams=1)

    @0x00064ac8:[T:0x4001f7d0] ti.sdo.fc.dman3 - createContext> Allocate memory for the context

    @0x00064b41:[T:0x4001f7d0] ti.sdo.fc.dman3 - createContext> Allocate 32 tccs

    @0x00064c15:[T:0x4001f7d0] ti.sdo.fc.dman3 - createContext> Next free tcc index 0

    @0x00064caf:[T:0x4001f7d0] ti.sdo.fc.dman3 - createContext> Allocate 48 paRams

    @0x00064d31:[T:0x4001f7d0] ti.sdo.fc.dman3 - createContext> NextpaRam index 48

    @0x00064dac:[T:0x4001f7d0] ti.sdo.fc.dman3 - createContext> Exit (status=0)

    @0x00064e1d:[T:0x4001f7d0] ti.sdo.fc.dman3 - getContext> Exit (status=DMAN3_SOK)

    @0x00064e8d:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3_createChannels> Context 0x41f8f0f0

    @0x00064f3d:[T:0x4001f7d0davinci_resizer davinci_resizer.2: RSZ_G_CONFIG:0:1:108] ti.sdo.fc.dmandavinci_previewer davinci_previewer.2: ipipe_set_preview_config3 - createChannedavinci_previewer davinci_previewer.2: ipipe_set_preview_configls> Enter (context=0x41f8f0f0, alg=0x0, groupId=0, dmaTab=0x41f8e924, numChans=1)

    @0x00064ff8:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> Channel 0

    @0x00065089:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> Env Requested memTab[0]: size=0x40,align=0x20, space=IALG_PERSIST, attrs=IALG_DARAM0

    @0x000b606f:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> Creating channel 0, size 0x40, align 0x20, scratchEnv 0x0

    @0x000b6133:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> IDMA3 Object Requested mem[0]: size=0x28, align=0x4 heapId=0

    @0x000b61e0:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> IDMA3 Object Allocated mem[0]: size=0x28, align=0x4, heapId=0, base=0x29b2a8

    @0x000b630e:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> Assigning qdmaChannel 0

    @0x000b63b6:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> Env buffer of size 0x40 requested

    @0x000b644a:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> Env Allocated memTab[0]: size=0x40,align=0x20, heapId=0, base=0x29b2e0

    @0x000b64db:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> Initializing IDMA3_handle

    @0x000b6581:[T:0x4001f7d0] ti.sdo.fc.dman3 - initHandle> Enter (handle=0x29b2a8, dmaTab=0x41f8e924, qdmaChannel=0, env=0x29b2e0, scratchEnv=0x0, context=0x41f8f0f0)

    @0x000b6628:[T:0x4001f7d0] ti.sdo.fc.dman3 - initHandle> Initializing IDMA3 handle with 1 tccs, 1 PaRams, qdmaChannel 0, env 0x29b2e0

    @0x000b66b6:[T:0x4001f7d0] ti.sdo.fc.dman3 - initHandle> Non-zero env handle

    @0x000b6727:[T:0x4001f7d0] ti.sdo.fc.dman3 - initHandle> paRam block 0x41f93600, tcc Table 0x41f8f000

    @0x000b679f:[T:0x4001f7d0] ti.sdo.fc.dman3 - initHandle> Call protocol Init function

    @0x000b6825:[T:0x4001f7d0] ti.sdo.fc.dman3 - initHandle> Exit (status=1)

    @0x000b68ab:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> Assigned Qdma Channel(s):0

    @0x000b6926:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> Assigned PaRam(s):

    @0x000b6995:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> dmaTab[0].handle's paRamAddr 0x41f93600

    @0x000b6a14:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> 48 (Addr 0x41f93600)

    @0x000b6a86:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> Assigned Tcc(s):

    @0x000b6b20:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> 32

    @0x000b6b9e:[T:0x4001f7d0] ti.sdo.fc.dman3 - createChannels> Exit (status=0)

    @0x000b6c1a:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3_createChannels> Assigned Qdma: 0

    @0x000b6c92:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3_createChannels> Assigned PaRam(s):

    @0x000b6d02:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3_createChannels> dmaTab[0].handle's paRamAddr 0x41f93600

    @0x000b6d7b:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3_createChannels> 48 (Addr 0x41f93600)

    @0x000b6df2:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3_createChannels> Assigned Tcc(s):

    @0x000b6e5d:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3_createChannels> 32

    @0x000b6ec9:[T:0x4001f7d0] ti.sdo.fc.dman3 - DMAN3_createChannels> Exit (returnVal=0)

     

     

    -Nate

  • Nate,

    The DMAN3 trace output looks very similar to what I get with my program. Could you try adding ACPY3 trace as well, by adding the following line to your main():

    GT_set("ti.sdo.fc.acpy3=01234567");

    Then could you also simplify  your program to just do one transfer, by calling

        ACPY3_configure();

        ACPY3_start();

        ACPY3_wait();

    instead of calling the Dcpy() function? This way we can verify that ACPY3_wait() does not block.

    Thanks,

        Janet

  • Janet,

    The trace for ACPY3 looks alright up until ACPY3_start.  I have previously tried debugging, rearranging, and stepping through the program to be sure ACPY3_wait() wasn't the problem.  It always seems to be hanging at ACPY3_start().  I've included the trace for ACPY3, but this seems to be the problem.  

    @0x006611e6:[T:0x436f9490] ti.sdo.fc.acpy3 - ACPY3_start> Timed out polling for static bit in paRam 0x41f93000, opts = [0xc01404]

    Could this be a problem from my program being threaded?

    Regards,

    -Nate

  • Nate,

    Do you have another thread that could by using PaRam 0? In your configuration, ACPY3 is using PaRam 0 as a "NULL" PaRam. You can change the null PaRam by adding the following lines to your cfg script:

    DMAN3.nullPaRamIndex = 127;  // Make sure this does not lie within [ DMAN3.paRamBaseIndex, DMAN3.paRamBaseIndex + DMAN3.numPaRamEntries ]

    Thanks,

        Janet

     

     

  • Janet,

    This seems to have done the trick, my program is no longer hanging at ACPY3_start().  Thanks again for your help!

     

    -Nate

  • Nate,

    Glad to hear this solved the problem!

    Regards,

        Janet