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.

Flash Programing Problem

Hi
I have a problem with flash programing, I have my F2812 custom board and run my program in internal ram then it's work good. i use xds510 emulator,
now i want to load my code into flash for stand alone working.
the problem is my code runnning but some peripheral not work in this mode,ADC_ISR and T0_ISR are work but SCI and SPI not work, i track my code and saw SCI and SPI ISR running but no data send to output,
I readed all ti document about flash programing but dont understand why.
 some of my initialize code and my CMD are here,

i'm really confused,

thank you for your attention.


Amin

-----------------------------------------------------------------------
=======================================================================
extern Uint16 CodefuncsLoadStart;
extern Uint16 CodefuncsLoadEnd;
extern Uint16 CodefuncsRunStart;

extern Uint16 econstLoadStart;
extern Uint16 econstLoadEnd;
extern Uint16 econstRunStart;

#pragma CODE_SECTION(Automatic, "Codefuncs");
#pragma CODE_SECTION(HandleMode, "Codefuncs");
#pragma CODE_SECTION(PosRead, "Codefuncs");
#pragma CODE_SECTION(MasterCheck, "Codefuncs");
#pragma CODE_SECTION(SpeedCheck, "Codefuncs");

#pragma CODE_SECTION(SciaRx_isr, "ramfuncs");
#pragma CODE_SECTION(SciaTx_isr, "ramfuncs");
#pragma CODE_SECTION(ScibRx_isr, "ramfuncs");
#pragma CODE_SECTION(ScibTx_isr, "ramfuncs");
#pragma CODE_SECTION(SpiRx_isr, "ramfuncs");
#pragma CODE_SECTION(SpiTx_isr, "ramfuncs");
#pragma CODE_SECTION(Adc_isr, "ramfuncs");
#pragma CODE_SECTION(T1int_isr, "ramfuncs");


-----------------------------------------------------------------------
=======================================================================
main{
    InitSysCtrl();

    DINT;
    InitPieCtrl();
    IER = 0x0000;
    IFR = 0x0000;
    InitPieVectTable();
    EALLOW;


    PieVectTable.RXAINT = &SciaRx_isr;
    PieVectTable.TXAINT = &SciaTx_isr;

    PieVectTable.RXBINT = &ScibRx_isr;
    PieVectTable.TXBINT = &ScibTx_isr;

    PieVectTable.SPITXINTA = &SpiTx_isr;
    PieVectTable.ADCINT = &Adc_isr;
    PieVectTable.TINT0 = &T1int_isr;
    EDIS;

    MemCopy( &RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);
    MemCopy( &econstLoadStart, &econstLoadEnd, &econstRunStart);
    MemCopy( &CodefuncsLoadStart, &CodefuncsLoadEnd, &CodefuncsRunStart);
    InitFlash();

    InitGpio();
//    InitECan();
//    ECanConfig();
    InitSci();
    InitSpi();
    InitCpuTimers();
    InitAdc();
    Config_ADC_EVA();

    GpioDataRegs.GPDSET.bit.GPIOD0 = 1;
    GpioDataRegs.GPDSET.bit.GPIOD1 = 1;
   
    GpioDataRegs.GPDCLEAR.bit.GPIOD0 = 1;
    GpioDataRegs.GPDCLEAR.bit.GPIOD1 = 1;
       
//    InitXIntrupt();
    for(i=0;i<16;i++){    Receivedata[i] = 0x00;}

// Configure CPU-Timer 0 to interrupt every second:
// 100MHz CPU Freq, 1 second Period (in uSeconds)
//    ConfigCpuTimer(&CpuTimer0, 150, 100000);

    ConfigCpuTimer(&CpuTimer0, 150, 250);// int 250 uS
    StartCpuTimer0();

    PieCtrlRegs.PIECRTL.bit.ENPIE = 1;   // Enable the PIE block
//    PieCtrlRegs.PIEIER6.bit.INTx1=1;   //Enable SPI Rx int
    PieCtrlRegs.PIEIER6.bit.INTx2=1;   //Enable SPI Tx int
    PieCtrlRegs.PIEIER1.bit.INTx6 = 1;    //Enable ADC int
    PieCtrlRegs.PIEIER1.bit.INTx7 = 1;   //Enable Timer0 Int
//    PieCtrlRegs.PIECRTL.bit.ENPIE = 1;   // Enable the PIE block
    PieCtrlRegs.PIEIER9.bit.INTx3=1;     // PIE Group 9, INT3 //Enable SciB Rx
    PieCtrlRegs.PIEIER9.bit.INTx4=1;     // PIE Group 9, INT4 //Enable SciB Tx

    PieCtrlRegs.PIEIER9.bit.INTx1=1;     // PIE Group 9, INT3 //Enable SciB Rx
    PieCtrlRegs.PIEIER9.bit.INTx2=1;     // PIE Group 9, INT4 //Enable SciB Tx

    //    PieCtrlRegs.PIEACK.bit.ACK9 = 1;

    IER |= M_INT1;
    IER |= M_INT6;
    IER |= M_INT9;
    EINT;     // Enable Global Interrupts
==========================================================================
--------------------------------------------------------------------------
SECTIONS
{
   /* Allocate program areas: */
   .cinit              : > FLASHA      PAGE = 0
   .pinit              : > FLASHA     PAGE = 0
   .text               : > FLASHD      PAGE = 0

   csmpasswds          : > CSM_PWL     PAGE = 0
   csm_rsvd            : > CSM_RSVD    PAGE = 0
   codestart           : > BEGIN       PAGE = 0

   ramfuncs            : LOAD = FLASHC,
                         RUN = RAML0,
                         LOAD_START(_RamfuncsLoadStart),
                         LOAD_END(_RamfuncsLoadEnd),
                         RUN_START(_RamfuncsRunStart),
                         PAGE = 0

   codefuncs            : LOAD = FLASHD,
                         RUN = RAMH0,
                         LOAD_START(_CodefuncsLoadStart),
                         LOAD_END(_CodefuncsLoadEnd),
                         RUN_START(_CodefuncsRunStart),
                         PAGE = 0


   /* Allocate uninitalized data sections: */
   .stack              : > RAMM0       PAGE = 1
   .ebss               : > RAMM1       PAGE = 1
   .esysmem            : > RAMM1       PAGE = 1


   .econst         : LOAD = FLASHC,PAGE = 0
                         RUN = RAMH0, PAGE = 0
                         LOAD_START(_econstLoadStart),
                         LOAD_END(_econstLoadEnd),
                         RUN_START(_econstRunStart)


   .switch             : > FLASHC      PAGE = 0     

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

   .reset              : > RESET,      PAGE = 0, TYPE = DSECT
   vectors             : > VECTORS     PAGE = 0, TYPE = DSECT
}
=========================================================================
-------------------------------------------------------------------------

  • Hi Amin,

    It is difficult to guess what could be the reason.... The two ISR that are not running, are they running in RAM or in FLASH?
    Did you have a look into the FAQ Section of the Wiki? This thread http://e2e.ti.com/support/microcontrollers/tms320c2000_32-bit_real-time_mcus/f/172/p/21893/84408.aspx#84408 lists a bunch FLASH related issues and their solutions...

    Best regards

    Andreas

  • Hi andreas

    thanks for your attention, yes in my code all ISR routin load from Flash and run in RAM.  they are in ramfunction

    /////////////////////////////////////////

    #pragma CODE_SECTION(SciaRx_isr, "ramfuncs");
    #pragma CODE_SECTION(SciaTx_isr, "ramfuncs");
    #pragma CODE_SECTION(ScibRx_isr, "ramfuncs");
    #pragma CODE_SECTION(ScibTx_isr, "ramfuncs");
    #pragma CODE_SECTION(SpiRx_isr, "ramfuncs");
    #pragma CODE_SECTION(SpiTx_isr, "ramfuncs");
    #pragma CODE_SECTION(Adc_isr, "ramfuncs");
    #pragma CODE_SECTION(T1int_isr, "ramfuncs");

    ////////////////////////////////////////

    sections

    {

      ramfuncs            : LOAD = FLASHC,
                             RUN = RAML0,
                             LOAD_START(_RamfuncsLoadStart),
                             LOAD_END(_RamfuncsLoadEnd),
                             RUN_START(_RamfuncsRunStart),
                             PAGE = 0

    }

    ////////////////////////////////////////