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.

program run wrong after 4 frames on DM648



Hi, there are 3 tasks on DM648. task1: receive a signal from FPGA through gpio10,;task2 :capture the current frame from the video port 0 once the signal is active; task3: OSD on the captured frame. However, the program run wrongly after loop 4 times. In all the program, there is no Dynamic memory allocation. what wrong with the program? thank you!

  • What do you mean by "the program run wrongly"?  Where's the program at?

    Judah

  • thank, Judah. the program run wrongly means that the program will output a wave through gpio11, which can be measured. However, our program only output 4 times. so, some problem happened, and then we halt the program, the program stop at HWI_RESET.  Thank you!

  • Okay, so something is causing a "reset".  There's a couple of things I know of that can cause a "reset".

    1.  Some code branched to "reset".
         a.  Can you put a breakpoint on "reset" and try to determine how you got there?  B3 is always a clue because its the return address so it tells you where your code was before.

    2.  You got an exception and then another exception occurred while processing the first exception.
         b.  Can you try putting a breakpoint on the NMI vector?  Its usually a few lines before the reset vector.  Also known as Hwi1.

    3.  Sometimes there's like a watchdog timer which can cause a reset.
         c.  If you enabled this, then try disabling it.

    Judah

  • Thank, Judah.  We'll debug the program following your reply. Besides, I have a question that the reset will happen if there is something wrong with memory management or the NMI pin isn't pulled up outside?

  • Well I think some wrong with memory management will cause an Exception not reset.

    Even if NMI pin isn't pulled, if two exceptions happen back to back it could cause a reset.

    Judah

  • thank, Judah. we'll debug the program following your advice. Besides, I hope you to look at our tcf file below and if some problem in it. thank you.

     

    /**********************************************************************/
    //this tcf file is based on the tcf file used by the E:\dvsdk_1_10_00_26_DM648\pspdrivers_1_10_00_09\packages\ti\sdo\pspdrivers\system\dm648\bios\evmDM648\video\sample\build\sd_loopback
    //and the DDR and flash on our custom board used is the same with that on the EVM board, and their connection are same too.
    //the stack for task we've trievd from several kbyte to several Mbyte for the 3 tasks
    /**********************************************************************/
    utils.loadPlatform("ti.platforms.evmDM648");

    /* The following DSP/BIOS Features are enabled */
    bios.enableRealTimeAnalysis(prog);
    bios.enableRtdx(prog);
    bios.enableTskManager(prog);


    /* BIOS Timer Fix - This can be removed later */
    bios.GBL.CLKOUT = 1080.0000;
    bios.CLK.SPECIFYRATE = 1;
    bios.CLK.INPUTCLK = 54.0000;


    /* Enable ECM Handler */
    bios.ECM.ENABLE = 1;


    /* Enable Cache */
    bios.GBL.C64PLUSMAR224to255 = 0x0000ffff;
    bios.MEM.instance("IRAM").len = 0x00040000;
    bios.GBL.C64PLUSL2CFG = "256k";


    /* Import driver TCI files */
    utils.importFile("ti/sdo/pspdrivers/system/dm648/bios/evmDM648/i2c/dm648_spi0.tci");

    utils.importFile("ti/sdo/pspdrivers/system/dm648/bios/evmDM648/video/sample/dm648_vport0.tci");

     

    /* Video Port Init function which does the LPSC and Pin Muxing requirements */
    bios.VP0CAPTURE.initFxn = prog.extern("VPORT0_init");


    /*task1: the GPIO10 is configured as interrupt mode, and we read the register INSTAT to get the INT and write the register INSTAT to chear it; not use the ISR*/
    /*this task pend the semaphore posted by task3 before reading and post a semaphore after having received an INT  during each loop*/
    bios.TSK.create("recINT");
    bios.TSK.instance("recINT").priority = 7;
    bios.TSK.instance("recINT").fxn = prog.extern("task_recinit");
    bios.TSK.instance("recINT").stackMemSeg = prog.get("DDR2");
    bios.TSK.instance("recINT").comment = "task1:receive INT from FPGA";
    bios.TSK.instance("recINT").stackSize = 1048576;

    /*task2: Task for Video capture and snop; the task is capture the current frame from the vp0 and save it to a buffer */
    /*this task pend the semaphore posted by task1 before reading and post a semaphore after having saved the frame  during each loop*/
    bios.TSK.create("video_capture");
    bios.TSK.instance("video_capture").priority = 4;
    bios.TSK.instance("video_capture").fxn = prog.extern("task_capture_snop");
    bios.TSK.instance("video_capture").stackMemSeg = prog.get("DDR2");
    bios.TSK.instance("video_capture").comment = "task: video capture";
    bios.TSK.instance("video_capture").stackSize = 2097152;

    /*task3: Task for image process;this task processes the frame saved by task2. the image data shared wwith task2 use an global array or pointer, the two conditions we both have tried */
    /*this task pend the semaphore posted by task2 before reading and post a semaphore after having processed the image  during each loop*/
    /*we'll osd,jpeg, and write the jpeg picture to pc through SEED XDS560PLUS*/
    bios.TSK.create("image_process");
    bios.TSK.instance("image_process").priority = 4;
    bios.TSK.instance("image_process").fxn = prog.extern("task_image_process");
    bios.TSK.instance("image_process").stackMemSeg = prog.get("DDR2");
    bios.TSK.instance("image_process").comment = "task3: image process";
    bios.TSK.instance("image_process").stackSize = 20971520;

    bios.LOG.create("trace");
    bios.LOG.instance("trace").bufLen = 1024;

    bios.LOG.create("DVTEvent_Log");
    bios.LOG.instance("DVTEvent_Log").bufSeg = prog.get("IRAM");
    bios.LOG.instance("DVTEvent_Log").bufLen = 8192;
    bios.LOG.instance("DVTEvent_Log").comment = "DVT";


    /* HWI-ECM mapping */
    bios.HWI.instance("HWI_INT7").interruptSelectNumber = 0;
    bios.HWI.instance("HWI_INT8").interruptSelectNumber = 1;
    bios.HWI.instance("HWI_INT9").interruptSelectNumber = 2;
    bios.HWI.instance("HWI_INT10").interruptSelectNumber = 3;


    bios.MEM.NOMEMORYHEAPS = 0;
    bios.MEM.instance("DDR2").createHeap = 1;
    bios.MEM.instance("DDR2").enableHeapLabel = 1;
    bios.MEM.instance("DDR2").heapLabel = prog.extern("EXTERNALHEAP");
    bios.MEM.instance("DDR2").heapSize = 0x06000000;


    bios.MEM.BIOSOBJSEG = prog.get("DDR2");
    bios.MEM.MALLOCSEG = prog.get("DDR2");
    bios.MEM.ARGSSEG = prog.get("DDR2");
    bios.MEM.STACKSEG = prog.get("DDR2");
    bios.MEM.GBLINITSEG = prog.get("DDR2");
    bios.MEM.TRCDATASEG = prog.get("DDR2");
    bios.MEM.SYSDATASEG = prog.get("DDR2");
    bios.MEM.OBJSEG = prog.get("DDR2");
    bios.MEM.BIOSSEG = prog.get("DDR2");
    bios.MEM.SYSINITSEG = prog.get("DDR2");
    bios.MEM.HWISEG = prog.get("DDR2");
    bios.MEM.HWIVECSEG = prog.get("DDR2");
    bios.MEM.RTDXTEXTSEG = prog.get("DDR2");
    bios.MEM.TEXTSEG = prog.get("DDR2");
    bios.MEM.SWITCHSEG = prog.get("DDR2");
    bios.MEM.BSSSEG = prog.get("DDR2");
    bios.MEM.FARSEG = prog.get("DDR2");
    bios.MEM.CINITSEG = prog.get("DDR2");
    bios.MEM.PINITSEG = prog.get("DDR2");
    bios.MEM.CONSTSEG = prog.get("DDR2");
    bios.MEM.DATASEG = prog.get("DDR2");
    bios.MEM.CIOSEG = prog.get("DDR2");
    bios.MEM.STACKSIZE = 0x0800;

    // !GRAPHICAL_CONFIG_TOOL_SCRIPT_INSERT_POINT!

    prog.gen();