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.

6748 edma3 example code crashes

Other Parts Discussed in Thread: SYSBIOS

custom 6748 board

SYSBIOS 6.37.3.30

XDC 3.25.5.94

EDMA3 2.11.14

my code is always crashing at EDMA3_DRV_requestChannel, well more specifically the abort happens when i step over that routine call but it actually happens in EDMA3_RM_allocResource. i apparently cannot step into the routines to debug them. the abort is a write violate that happens because i have the exception module handle memory protection.

i am following example code in the edma code. i am following the example pretty closely but i can't figure out what is crashing the system. this is my first attempt at getting the edma3 working so i have no good code to base anything on.  any ideas?  here is my code snippet (this is being run from a task)

...

memset(hEdma,0,sizeof(hEdma));

Semaphore_Params_init(&semParams);
Error = edma3OsSemCreate(0, &semParams, &AppSemHandle1);
if((Error != EDMA3_DRV_SOK) || (AppSemHandle1 == NULL))
{
printf("Error initializing the Application Semaphore handle\n");
return;
}
Error = edma3OsSemCreate(0, &semParams, &AppSemHandle2);
if((Error != EDMA3_DRV_SOK) || (AppSemHandle2 == NULL))
{
printf("Error initializing the Application Semaphore handle\n");
return;
}

hEdma = edma3init (0, &Error);
if (EDMA3_DRV_SOK != Error)
{
/* EDMA Initialization Failed */
//result = edmaResult;
asm(" NOP");
}
else
{
EDMA3_DRV_SyncType syncType = EDMA3_DRV_SYNC_A;
EDMA3_DRV_Result result = EDMA3_DRV_SOK;
EDMA3_DRV_PaRAMRegs paramSet = {0,0,0,0,0,0,0,0,0,0,0,0};
uint32_t chId = 0;
uint32_t tcc = 0;
int i;
//uint32_t count;
//uint32_t Istestpassed = 0u;
uint32_t numenabled = 0;
uint32_t BRCnt = 0;
int srcbidx = 0, desbidx = 0;
int srccidx = 0, descidx = 0;

memset(temp1, 0xEA, sizeof(temp1));
memset(temp2, NULL, sizeof(temp2));

Cache_wb(temp1, sizeof(temp1), Cache_Type_ALL, FALSE);

/* Setup for Channel 1*/
tcc = EDMA3_DRV_TCC_ANY;
chId = EDMA3_DRV_DMA_CHANNEL_ANY;

/* Request any DMA channel and any TCC */
if (result == EDMA3_DRV_SOK)
{
result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
(EDMA3_RM_EventQueue)0,
&callback1, NULL);
}

...

  • Hi,

    Thanks for your post.

    I guess, it all depends on the value the enum variable "EDMA3_RM_TccStatus" holds when it passes an argument to "callback1" which we need to debug in the code and check the status of enum it takes. Actually, this enum defines the channel specific status codes of an EDMA3 transfer and this would return the actual status  while calling the channel specific callback function. In you case, there might be lesser probability to complete DMA transfer successfully and in my opinion, it would have missed the DMA transfer events, so, kindly ensure the TCC status code which the enum returns and this could relate you to the cause of the issue.

    In normal case, if DMA transfer completed succesfully or submitted to the TC, then it should hold the value of  EDMA3_RM_XFER_COMPLETE = 1 which is of enum typedef  EDMA3_RM_TccStatus. May be you could check the definition of EDMA3_RM_TccStatus enum variable from the below location:

    ~\ti\edma3_lld_02_11_xx_xx\packages\ti\sdo\edma3\rm\edma3_rm.h

    For using EDMA3, there are very good online c6000 embedded workshop videos available in the below wiki:

    http://processors.wiki.ti.com/index.php/C6000_Embedded_Design_Workshop_Using_BIOS#C6000_Architecture_Specific_Topics

    To understand how tasks are configured and prioritized in bios scheduler, please see Chapter 8 on the online wiki video download link, which is part of TI RTOS kernel workshop video tutorial as below:

    http://processors.wiki.ti.com/index.php/TI-RTOS_Workshop

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question

    -------------------------------------------------------------------------------------------------------

  • so after watching the videos and reading the user guide and looking at my code again i have to ask: Why is it crashing at EDMA3_RM_allocResource? the tcc variable should have nothing to do with it at this point since all i am doing is requesting a channel. no transactions have happened as of yet. callback1 should not be invoked because all that is happening with it is setting up the pointer for the HWI

    could it be a HWI issue? i currently have the eventcombiner groups 0 and 1 in use for these interrupts (there doesn't seem to be anything important in groups 2 and 3) and i did not specify the HWI slot or routine as it seems to happen with the edma3init routine. do i have to do something special for the init with the shadow registers and regions? is it possible i am writing/reading to a region that i do not have access to?

    most of the example code, the example projects , and the only useful documentation is so old it is for DSPBIOS or it is an incomplete project such that when i import it that i can't even build it. am i missing something that is more up to date?

    what are the reasons why the EDMA3_RM_allocResource routine would crash my system due to a supervisor read violation? i am calling these things from a task (after sysbios has started, obviously). is there an order to the system boot up that needs to happen prior to me making any of these calls? i could not see anything special in any examples.

    so here is my code, simplified :
    hEdma = edma3init (0, &Error);
    /* Setup for Channel 1*/
    tcc = EDMA3_DRV_TCC_ANY;
    chId = EDMA3_DRV_DMA_CHANNEL_ANY;

    /* Request any DMA channel and any TCC */
    result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
    (EDMA3_RM_EventQueue)0,
    &callback1, NULL);

    here is the error
    A0=0x400 A1=0x0
    A2=0x1 A3=0x400
    A4=0x1 A5=0xa
    A6=0xc17423bc A7=0x1800080
    A8=0xc1abe7e0 A9=0x0
    A10=0x0 A11=0x0
    A12=0x0 A13=0x0
    A14=0x0 A15=0x0
    A16=0x0 A17=0x0
    A18=0xc16ef018 A19=0x0
    A20=0x64 A21=0x0
    A22=0xc1b8f1a4 A23=0x8d
    A24=0x43 A25=0x0
    A26=0x3a A27=0xc1b44bc8
    A28=0x1 A29=0x0
    A30=0x0 A31=0xa
    B0=0x1 B1=0x1
    B2=0x0 B3=0xc1af128c
    B4=0x1c00348 B5=0x401
    B6=0x1 B7=0x1
    B8=0xa B9=0x0
    B10=0x0 B11=0x0
    B12=0x0 B13=0x0
    B14=0xc1b8b1c0 B15=0xc17422e0
    B16=0xc1742234 B17=0xc1b5a218
    B18=0x9f B19=0x38
    B20=0x3c B21=0x1
    B22=0x3c B23=0xc1b914f0
    B24=0xf B25=0xec
    B26=0xcb B27=0x0
    B28=0x2e4 B29=0x1cc
    B30=0xa B31=0x340
    NTSR=0x1800f
    ITSR=0xd
    IRP=0xc1abe88c
    SSR=0x0
    AMR=0x0
    RILC=0x0
    ILC=0x0
    Exception at 0xc1af13ee
    EFR=0x40000000 NRP=0xc1af13ee
    DMC Exception MPFAR=0x1c00348 MPFSR=0x120
    Security violation, Local L1/L2 cache memory Fault
    Supervisor Read violation, Fault ID=0x0
    ti.sysbios.family.c64p.Exception: line 256: E_exceptionMax: pc = 0xc1af13ee, sp = 0xc17422e0.
    xdc.runtime.Error.raise: terminating execution
  • here are my library include paths:
    "C:\CCSv5\edma3_lld_02_11_14_18\packages\ti\sdo\edma3\drv\lib\674\debug\edma3_lld_drv.a674"
    "C:\CCSv5\edma3_lld_02_11_14_18\packages\ti\sdo\edma3\drv\sample\lib\c6748-evm\674\debug\edma3_lld_drv_sample.a674"
    "C:\CCSv5\edma3_lld_02_11_14_18\packages\ti\sdo\edma3\rm\lib\c6748-evm\674\debug\edma3_lld_rm.a674"
    "C:\CCSv5\edma3_lld_02_11_14_18\packages\ti\sdo\edma3\rm\sample\lib\c6748-evm\674\debug\edma3_lld_rm_sample.a674"

  • ok so i figured out my crashing problem - i had a header file that was being included that confused the system about whether it should use the local header file or the system one. i took that out and my crashing seems to have disappeared. sorry for jerking everyone around.

    now i need to figure out how to get a transfer to be successful. apparently my callback function reports a successful transfer, but the destination memory location has nothing in it...soo what parameter do i have wrong?

    U8 temp1[10];
    U8 temp2[10];

    /* Setup for Channel x*/
    tcc = EDMA3_DRV_TCC_ANY;
    chId = EDMA3_DRV_DMA_CHANNEL_ANY;

    /* Request any DMA channel and any TCC */
    result = EDMA3_DRV_requestChannel (hEdma, &chId, &tcc,
    (EDMA3_RM_EventQueue)0,
    &callback1, NULL);

    if (result == EDMA3_DRV_SOK)
    {
    result = EDMA3_DRV_setSrcParams ( hEdma,
    chId,
    (uint32_t)temp1,
    EDMA3_DRV_ADDR_MODE_INCR,
    EDMA3_DRV_W8BIT);

    result = EDMA3_DRV_setDestParams ( hEdma,
    chId,
    (uint32_t)temp2,
    EDMA3_DRV_ADDR_MODE_INCR,
    EDMA3_DRV_W8BIT );

    result = EDMA3_DRV_setSrcIndex ( hEdma,
    chId,
    1,
    0 );

    result = EDMA3_DRV_setDestIndex (hEdma,
    chId,
    1,
    0);

    result = EDMA3_DRV_setTransferParams (
    hEdma,
    chId,
    sizeof(temp1),
    1,
    1,
    0,
    EDMA3_DRV_SYNC_A);

    EDMA3_DRV_setOptField (hEdma, chId, EDMA3_DRV_OPT_FIELD_TCINTEN, EDMA3_DRV_TCINTEN_EN);

    result = EDMA3_DRV_enableTransfer (hEdma,
    chId,
    EDMA3_DRV_TRIG_MODE_MANUAL);

    }
  • Hi,

    Thanks for your update.

    Please debug your code and check all the EDMA initialization parameters end to end to evaluate where is the cause of the issue. Kindly capture the necessary parameters in the watch window related to updating the destination memory and simulataneously, view the memory browser and check whether it is updating any new data in the destination address range.

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question

    -------------------------------------------------------------------------------------------------------

  • how about i ask: were any of the parameters in the code snippet i posted that would not transfer 10 bytes from 1 buffer to another buffer?
  • Nothing looks wrong, but it is pretty hard to act as an EDMA simulator. We do not know the values of your constants or addresses of your variables. A good display to send us would be to run up to the TRIG_MODE_MANUAL line, then go find the PARAM values in the Memory Browser or Variables or Expressions, depending on what is in context. Show us a list of the 8 PARAM words in hex.

    Check whether the addresses for SRC and DST are correct. Compare them to the linker .map file.
    Turn off cache so that does not hide the DMA transfer.

    In this thread, you mentioned having a crash that was solved by fixing a header file situation. You have a new thread here that is also describing a crash, or abort. I trust you understand that it is not likely for us to find a file misplaced in your build, which is why we ask you to "debug your code and check...". I hope you understand the value and need for this direction we take you.

    Regards,
    RandyP

  • i wanted to delete this thread because the other thread is what my real problem is. when i got the EDMA to work i didn't have a problem. i do not need help at this moment with the EDMA transfers. what i need help with is figuring out why my call to edma3init crashes because for the life of me i cannot figure it out or know where to look next. i am not looking for people to be psychic, i was hoping somebody has run into this before or heard of this issue or at the very least know what i should look for because i have never run into this before.

    i'm guessing a lot of people must come on here without debugging their code. i spent over a day trying to debug my stuff before i thought i should ask somebody if they have a better idea than i do.