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.

TMS320F2812 DSP problem

Other Parts Discussed in Thread: TMS320F2812

We are facing strange problem. No linking erro no compilation error in our code, but still our DSP based hardware works only with emulator. Removing emulator, it doesn't work. But when we reduce our code size then it works fine even without any emulator. Definitely it is not related to hardware. Something related to memory management, but we are able to locate it as compiler is not showing any linking/compilation error. We are using Code composer studio V3.1 with SIGNUM /SPECTRUM emulator.

Just for verification, We are toggling a port pin in timer interrupt for cross checking the DSP behavior. For smaller size code, we get square wave on CRO, while increasing the variable in RAM & removing the emulator, it stop showing square wave. So it confirms that DSP doesn't work without emulator and as per MAP file no RAM portion is overflowing.

 
  • The emulator will load your program into ram for you, without the emulator you need to get your program to run from flash, or load from flash and then execute from RAM.

     Check out http://focus.ti.com/general/docs/techdocsabstract.tsp?abstractName=spra958g

     Running an Application from Internal Flash Memory on the TMS320F28xx DSP (Rev. G)  (spra958g.pdf)

  • Thanks Rob,

    But we are not running our appliation from RAM. Program is loaded only into FLASH. It works fine if we reduces the global variables(located in RAM) in our code. But as per cmd file, RAM is sufficient to handle the extra bytes & that's why we are not getting any linking error. I am sure without emulator it just lost its intial startup pointer. Now how can I locate my problem? TI engineers are working on it but still no succss...!!  Any clue?? Any setting related to code composer studio...!! 

  • Oh, well that makes the problem a little more difficult. Just so we are on the same page, if you reduce your global variables, compile, flash the device and the remove power to the device and power it back up it runs correctly? but not if you increase the number of global variables? how many do you need to remove for it to work vs not work?

    Can you post your linker cmd files? I assume you are using the boot to 0x3F7FF6

  •  I would check the .gel file and see if it is doing anything while the emulator is connected. 

    For example, if the gel file disables the watchdog but your code doesn't, then maybe this is the issue.  As your variables grow the time it takes to initalize them (before main()) gets larger.  During this time the watchdog might fire and basically keeping your device from doing anything useful.  You could monitor the XRSn pin to see if it is indeed getting reset.  If this happens to turn out to be the problem, then there is a file in the header files/peripheral examples that show how to disable the watchdog before the C initalization (CodeStartBranch.asm) routine. 

     

  • Dear Rob, Yes exactly this is the problem..if we reduce global variables, flash the device and the remove power to the device and power it back up it runs perfectly? but not if we increase the number of global variables.!!

    I am attaching the cmd file & gel File. Plz look into this matter...!!

    CMD


    MEMORY
    {
    PAGE 0:    /* Program Memory */
               /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */

       ZONE0       : origin = 0x002000, length = 0x002000     /* XINTF zone 0 */
       ZONE1       : origin = 0x004000, length = 0x002000     /* XINTF zone 1 */
       RAML0       : origin = 0x008000, length = 0x001000     /* on-chip RAM block L0 */
       ZONE2       : origin = 0x080000, length = 0x080000     /* XINTF zone 2 */
       ZONE6       : origin = 0x100000, length = 0x080000     /* XINTF zone 6 */
       OTP         : origin = 0x3D7800, length = 0x000800     /* on-chip OTP */
       FLASHD      : origin = 0x3D8000, length = 0x014800     /* on-chip FLASH */
       FLASHC      : origin = 0x3EC800, length = 0x007800     /* on-chip FLASH */
       FLASHA      : origin = 0x3F6000, length = 0x001F80     /* on-chip FLASH */
       CSM_RSVD    : origin = 0x3F7F80, length = 0x000076     /* Part of FLASHA.  Program with all 0x0000 when CSM is in use. */
       BEGIN       : origin = 0x3F7FF6, length = 0x000002     /* Part of FLASHA.  Used for "boot to Flash" bootloader mode. */
       CSM_PWL     : origin = 0x3F7FF8, length = 0x000008     /* Part of FLASHA.  CSM password locations in FLASHA */
      
    /* ZONE7       : origin = 0x3FC000, length = 0x003FC0     /* XINTF zone 7 available if MP/MCn=1 */
       ROM         : origin = 0x3FF000, length = 0x000FC0     /* Boot ROM available if MP/MCn=0 */
       RESET       : origin = 0x3FFFC0, length = 0x000002     /* part of boot ROM (MP/MCn=0) or XINTF zone 7 (MP/MCn=1) */
       VECTORS     : origin = 0x3FFFC2, length = 0x00003E     /* part of boot ROM (MP/MCn=0) or XINTF zone 7 (MP/MCn=1) */

    PAGE 1 :   /* Data Memory */
               /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE0 for program allocation */
               /* Registers remain on PAGE1                                                  */

       RAMM0       : origin = 0x000000, length = 0x000400     /* on-chip RAM block M0 */
       RAMM1       : origin = 0x000400, length = 0x000400     /* on-chip RAM block M1 */
       RAML1       : origin = 0x009000, length = 0x001000     /* on-chip RAM block L1 */
       FLASHB      : origin = 0x3F4000, length = 0x002000     /* on-chip FLASH */
       RAMH0       : origin = 0x3F8000, length = 0x002000     /* on-chip RAM block H0 */
    }

    /* Allocate sections to memory blocks.
       Note:
             codestart user defined section in DSP28_CodeStartBranch.asm used to redirect code
                       execution when booting to flash
             ramfuncs  user defined section to store functions that will be copied from Flash into RAM
    */
     
    SECTIONS
    {
    /* .bss: {} = 0x00;*/
       /* Allocate program areas: */
       .cinit              : > FLASHC      PAGE = 0
       .pinit              : > FLASHA,     PAGE = 0
       .text               : > FLASHD      PAGE = 0

       codestart           : > BEGIN       PAGE = 0
       ramfuncs            : LOAD = FLASHD,
                             RUN = RAML0,
                             LOAD_START(_RamfuncsLoadStart),
                             LOAD_END(_RamfuncsLoadEnd),
                             RUN_START(_RamfuncsRunStart),
                             PAGE = 0

       csmpasswds          : > CSM_PWL     PAGE = 0
       csm_rsvd            : > CSM_RSVD    PAGE = 0
      
       /* Allocate uninitalized data sections: */
       .stack              : > RAMM0       PAGE = 1
       .ebss               : > RAMH0       PAGE = 1
       .esysmem            : > RAMM1       PAGE = 1
       .cio                : > RAMH0       PAGE = 1

       /* Initalized sections go in Flash */
       /* For SDFlash to program these, they must be allocated to page 0 */
     /*  .econst             : > FLASHB      PAGE = 1*/
       .econst             : > FLASHD      PAGE = 0
       .switch             : > FLASHA      PAGE = 0     

       /* Allocate IQ math areas: */
       /*IQmath              : > FLASHC      PAGE = 0                  /* Math Code */
     /*   IQmathTables        : > ROM         PAGE = 0, TYPE = NOLOAD   /* Math Tables In ROM */

       /* .reset is a standard section used by the compiler.  It contains the */
       /* the address of the start of _c_int00 for C Code.   /*
       /* When using the boot ROM this section and the CPU vector */
       /* table is not needed.  Thus the default type is set here to  */
       /* DSECT  */
       .reset              : > RESET,      PAGE = 0, TYPE = DSECT
       vectors             : > VECTORS     PAGE = 0, TYPE = DSECT

    }

    MAP FILE :

    MEMORY CONFIGURATION

                      name            origin    length      used    attr    fill
             ----------------------  --------  ---------  --------  ----  --------
    PAGE  0: ZONE0                   00002000   00002000  00000000  RWIX
             ZONE1                   00004000   00002000  00000000  RWIX
             RAML0                   00008000   00001000  0000001b  RWIX
             ZONE2                   00080000   00080000  00000000  RWIX
             ZONE6                   00100000   00080000  00000000  RWIX
             OTP                     003d7800   00000800  00000000  RWIX
             FLASHD                  003d8000   00014800  0000a4f5  RWIX
             FLASHC                  003ec800   00007800  00000480  RWIX
             FLASHA                  003f6000   00001f80  00000000  RWIX
             CSM_RSVD                003f7f80   00000076  00000076  RWIX
             BEGIN                   003f7ff6   00000002  00000002  RWIX
             CSM_PWL                 003f7ff8   00000008  00000008  RWIX
             ROM                     003ff000   00000fc0  00000000  RWIX
             RESET                   003fffc0   00000002  00000000  RWIX
             VECTORS                 003fffc2   0000003e  00000000  RWIX

    PAGE  1: RAMM0                   00000000   00000400  000003e8  RWIX
             RAMM1                   00000400   00000400  00000000  RWIX
             DEV_EMU                 00000880   00000180  000000d2  RWIX
             FLASH_REGS              00000a80   00000060  00000008  RWIX
             CSM                     00000ae0   00000010  00000010  RWIX
             XINTF                   00000b20   00000020  00000020  RWIX
             CPU_TIMER0              00000c00   00000008  00000008  RWIX
             PIE_CTRL                00000ce0   00000020  0000001a  RWIX
             PIE_VECT                00000d00   00000100  00000100  RWIX
             ECANA                   00006000   00000040  00000034  RWIX
             ECANA_LAM               00006040   00000040  00000040  RWIX
             ECANA_MOTS              00006080   00000040  00000040  RWIX
             ECANA_MOTO              000060c0   00000040  00000040  RWIX
             ECANA_MBOX              00006100   00000100  00000100  RWIX
             SYSTEM                  00007010   00000020  00000020  RWIX
             SPIA                    00007040   00000010  00000010  RWIX
             SCIA                    00007050   00000010  00000010  RWIX
             XINTRUPT                00007070   00000010  00000010  RWIX
             GPIOMUX                 000070c0   00000020  00000020  RWIX
             GPIODAT                 000070e0   00000020  00000020  RWIX
             ADC                     00007100   00000020  0000001a  RWIX
             EVA                     00007400   00000040  00000032  RWIX
             EVB                     00007500   00000040  00000032  RWIX
             SCIB                    00007750   00000010  00000010  RWIX
             MCBSPA                  00007800   00000040  00000025  RWIX
             RAML1                   00009000   00001000  00000000  RWIX
             FLASHB                  003f4000   00002000  00000000  RWIX
             CSM_PWL                 003f7ff8   00000008  00000008  RWIX
             RAMH0                   003f8000   00002000  00000924  RWIX


    SECTION ALLOCATION MAP

     output                                  attributes/
    section   page    origin      length       input sections
    --------  ----  ----------  ----------   ----------------
    .text      0    003d8000    00005eae    
                      003d8000    00000044     rts2800_ml.lib : boot.obj (.text)
                      003d8044    0000004a                    : exit.obj (.text)
                      003d808e    00000009                    : _lock.obj (.text)
                      003d8097    00000014                    : args_main.obj (.text)
                      003d80ab    000000e2     CGPLCD.obj (.text)
                      003d818d    00000803     Comm1.obj (.text)
                      003d8990    00000e9b     Control.obj (.text)
                      003d982b    00000077     DSP281x_Adc.obj (.text)
                      003d98a2    00000008     DSP281x_CodeStartBranch.obj (.text)
                      003d98aa    0000004b     DSP281x_CpuTimers.obj (.text)
                      003d98f5    000002d0     DSP281x_DefaultIsr.obj (.text)
                      003d9bc5    00000069     DSP281x_ECan.obj (.text)
                      003d9c2e    00000001     DSP281x_Ev.obj (.text)
                      003d9c2f    0000003b     DSP281x_Gpio.obj (.text)
                      003d9c6a    00000011     DSP281x_InitPeripherals.obj (.text)
                      003d9c7b    00000001     DSP281x_Mcbsp.obj (.text)
                      003d9c7c    00000015     DSP281x_MemCopy.obj (.text)
                      003d9c91    00000028     DSP281x_PieCtrl.obj (.text)
                      003d9cb9    00000020     DSP281x_PieVect.obj (.text)
                      003d9cd9    00000001     DSP281x_Sci.obj (.text)
                      003d9cda    000002e7     DSP281x_Spi.obj (.text)
                      003d9fc1    0000004b     DSP281x_SysCtrl.obj (.text)
                      003da00c    00000001     DSP281x_Xintf.obj (.text)
                      003da00d    00000001     DSP281x_XIntrupt.obj (.text)
                      003da00e    00000090     ExRAM.obj (.text)
                      003da09e    00000006     InitAll.obj (.text)
                      003da0a4    000000ad     KeyPad.obj (.text)
                      003da151    0000004b     KeyQueue.obj (.text)
                      003da19c    00000277     LCDLib.obj (.text)
                      003da413    000014fc     main.obj (.text)
                      003db90f    00001af3     MMI.obj (.text)
                      003dd402    0000038b     ModBus.obj (.text)
                      003dd78d    0000039a     objectmap.obj (.text)
                      003ddb27    00000052     Rtc.obj (.text)
                      003ddb79    000000eb     TimerLib.obj (.text)
                      003ddc64    00000078     rts2800_ml.lib : fs_add.obj (.text)
                      003ddcdc    00000017                    : fs_cmp.obj (.text)
                      003ddcf3    00000083                    : fs_div.obj (.text)
                      003ddd76    0000005a                    : fs_mpy.obj (.text)
                      003dddd0    00000029                    : fs_tol.obj (.text)
                      003dddf9    00000021                    : fs_toul.obj (.text)
                      003dde1a    00000022                    : i_div.obj (.text)
                      003dde3c    0000002a                    : l_div.obj (.text)
                      003dde66    0000001a                    : l_tofs.obj (.text)
                      003dde80    0000000b                    : u_div.obj (.text)
                      003dde8b    00000010                    : u_tofs.obj (.text)
                      003dde9b    00000013                    : ul_tofs.obj (.text)

    .econst    0    003ddeae    0000462c    
                      003ddeae    00001cac     main.obj (.econst)
                      003dfb5a    00001ac0     MMI.obj (.econst)
                      003e161a    00000a0c     Control.obj (.econst)
                      003e2026    00000300     objectmap.obj (.econst)
                      003e2326    00000100     DSP281x_PieVect.obj (.econst)
                      003e2426    0000007a     TimerLib.obj (.econst)
                      003e24a0    00000012     CGPLCD.obj (.econst)
                      003e24b2    00000012     Comm1.obj (.econst)
                      003e24c4    00000011     LCDLib.obj (.econst)
                      003e24d5    00000005     KeyPad.obj (.econst)

    ramfuncs   0    003e24da    0000001b     RUN ADDR = 00008000
                      003e24da    00000017     DSP281x_SysCtrl.obj (ramfuncs)
                      003e24f1    00000004     DSP281x_usDelay.obj (ramfuncs)

    .cinit     0    003ec800    00000480    
                      003ec800    0000000e     rts2800_ml.lib : exit.obj (.cinit)
                      003ec80e    0000000a                    : _lock.obj (.cinit)
                      003ec818    0000000d     Comm1.obj (.cinit)
                      003ec825    00000177     Control.obj (.cinit)
                      003ec99c    00000048     DSP281x_Spi.obj (.cinit)
                      003ec9e4    00000005     ExRAM.obj (.cinit)
                      003ec9e9    00000010     KeyPad.obj (.cinit)
                      003ec9f9    0000001d     KeyQueue.obj (.cinit)
                      003eca16    00000148     main.obj (.cinit)
                      003ecb5e    000000a2     MMI.obj (.cinit)
                      003ecc00    00000043     ModBus.obj (.cinit)
                      003ecc43    00000004     Rtc.obj (.cinit)
                      003ecc47    00000038     TimerLib.obj (.cinit)
                      003ecc7f    00000001     --HOLE-- [fill = 0]

    .pinit     0    003f6000    00000000     UNINITIALIZED

    .switch    0    003f6000    00000000     UNINITIALIZED

    csm_rsvd   0    003f7f80    00000076    
                      003f7f80    00000076     DSP281x_CSMPasswords.obj (csm_rsvd)

    codestart
    *          0    003f7ff6    00000002    
                      003f7ff6    00000002     DSP281x_CodeStartBranch.obj (codestart)

    csmpasswds
    *          0    003f7ff8    00000008    
                      003f7ff8    00000008     DSP281x_CSMPasswords.obj (csmpasswds)

    .reset     0    003fffc0    00000002     DSECT
                      003fffc0    00000002     rts2800_ml.lib : boot.obj (.reset)

    .cio       1    003f8000    00000000     UNINITIALIZED

    .ebss      1    003f8000    00000924     UNINITIALIZED
                      003f8000    000003a4     MMI.obj (.ebss)
                      003f83a4    00000008     DSP281x_CpuTimers.obj (.ebss)
                      003f83ac    00000004     rts2800_ml.lib : _lock.obj (.ebss)
                      003f83b0    00000002     LCDLib.obj (.ebss)
                      003f83b2    00000002     ExRAM.obj (.ebss)
                      003f83b4    00000004     Rtc.obj (.ebss)
                      003f83b8    00000004     objectmap.obj (.ebss)
                      003f83bc    00000004     KeyPad.obj (.ebss)
                      003f83c0    00000140     main.obj (.ebss)
                      003f8500    00000108     Comm1.obj (.ebss)
                      003f8608    00000022     DSP281x_Spi.obj (.ebss)
                      003f862a    0000000e     TimerLib.obj (.ebss)
                      003f8638    00000002     DSP281x_DefaultIsr.obj (.ebss)
                      003f8640    000000fc     Control.obj (.ebss)
                      003f8740    00000090     CGPLCD.obj (.ebss)
                      003f87d0    0000000e     KeyQueue.obj (.ebss)
                      003f8800    00000080     rts2800_ml.lib : exit.obj (.ebss)
                      003f8880    000000a4     ModBus.obj (.ebss)

  • Did you try what Lori suggested?, that is likely your problem.

     http://focus.ti.com/lit/an/spra958g/spra958g.pdf

    Have you read? "7 Disabling the Watchdog Timer During C-Environment Boot" on page 25 of the running from flash application note?

     

     

     

  • Dear Lori,

    We have tried to disable the watchdog also by putting following instruction in our FLASH code:

    void DisableDog(void)
    {
        EALLOW;
        SysCtrlRegs.WDCR= 0x0068;
        EDIS;

    But still same behaviour....!!

    Yes on XRSn Pin I am getting glitches of 30usec at the interval of 330msec. Disabling the watchdog is still creating kicks on reset pin...and yes when we are running it through code composer, there is no kicks on reset pin (XRSn), so perhaps culpit is watchdog

  • If you disable the watchdog in c-code, then it is after the c-initalization.  The C code initialization occurs before you reach main().  I would try disabling the watchdog before the c initalization starts as is shown in the header file examples (CodeStartBranch.asm).

    Lori

     Note: edited to say "if you disable the watchdog in C-code" instead of "in flash"

  • Thanks Lori...!!

     Problem resolved..as per your guidence only...!!

     Thanks Again...!!

  • hi this  s ram frm chennai.. i need one help... we designed tms320f2812 board . in that board JTAG not detected.. i dny know whats the problem.. jtag is near to processor only..  could u pls tel some suggesions  for my question... reply me as soon as possible..  

     

    THANKS IN ADVANCE