Quantcast
Channel: Processors forum - Recent Threads
Viewing all articles
Browse latest Browse all 17527

TMS320C5515: How to run program in external SDRAM?

$
0
0

Part Number:TMS320C5515

Platform: C5515 + DSP/BIOS + CCS 6.0

The current program is running normally, basically filling up the on-chip DARAM and SARAM.

In order to add functions later, it is necessary to use the external SDRAM to run the program.

Step1. View the compiled .map file and find that the .text segment is the largest, which is 0x000226c0 bytes.

Step2. Open the .tcf file and change the .text section from the original SARAM to SRAM, which is SDRAM.

Step3. Use the GEL file in the .ccxml file.

Only one valid function is kept in the GEL file.

OnTargetConnect()
{
//GEL_Reset();
//Peripheral_Reset();
ProgramPLL_100MHz();
SDRAM_INIT();
GEL_TextOut("Target Connection Complete.\n"); 
}

The two function being called are as follows:

ProgramPLL_100MHz() {
    int i;

    GEL_TextOut("Configuring PLL (100.00 MHz).\n");
    /* Enable clocks to all peripherals */
    *(short *)PCGCR1@IO = 0x0;
    *(short *)PCGCR2@IO = 0x0;

    /* Bypass PLL */
    *(short *)CCR2@IO = 0x0;

    /* Set CLR_CNTL = 0 */
    *(short *)CGCR1@IO = *(short *)CGCR1@IO & 0x7FFF;

    *(short *)CGCR1@IO =  0x8BE8;
    *(short *)CGCR2@IO =  0x8000;
    *(short *)CGCR3@IO =  0x0806;
    *(short *)CGCR4@IO =  0x0000; 

    /* Wait for PLL lock */
    for(i=0;i<0x7fff;i++);

    /* Switch to PLL clk */ 
    *(short *)CCR2@IO = 0x1;

    GEL_TextOut("PLL Init Done.\n");
    
}

/* mSDRAM = MT48H4M16LF-8 */
/* Timings based on EMIF clk = 100MHz */

SDRAM_INIT() 
{
    int i;

    /* reset EMIF */
    *(short *)PRCR@IO = 0x0002;
    for(i=0;i<0xff;i++);

    //enable SDRAM clock
    *(short*)CLKCFGL@IO=0x0001;

    /* enable word writes to EMIF regs */
    *(short *)ESCR@IO = 0;

    /* step 1 */
    *(short *)SDTIMR1@IO = 0x4710;
    *(short *)SDTIMR2@IO = 0x3911;
    *(short *)SDSRETR@IO = 0x0007;

    /* step 2 */
    *(short *)SDRCR@IO = 0x04E3;
    
    /* step 3 */
    *(short *)SDCR1@IO = 0x4720;
    *(short *)SDCR2@IO = 0x0001;

    /* step 4 */
    for(i=0;i<0xff;i++);

    /* step 5 */
    *(short *)SDRCR@IO = 0x061A;

    GEL_TextOut("SDRAM Initialization Complete.\n");
}

Step4. Compile, the online debugging function is normal.

Step5. Convert the compiled .out file to a .bin file via hex55.exe. The contents of the .cmd file used are as follows:

-boot
-v5505
-serial8
-reg_config 0x1C1F,0x0
-reg_config 0x1C20,0x8BB4
-reg_config 0x1C21,0x8000
-reg_config 0x1C22,0x0806
-reg_config 0x1C23,0x0200
-reg_config 0x3000,0x0002
-delay 0x500
-reg_config 0x1C1F,0x1
-reg_config 0x1C05,0x0002
-delay 0x500
-reg_config 0x1c1e,0x0001
-reg_config 0x1c33,0x0000
-reg_config 0x1020,0x4710
-reg_config 0x1021,0x3911
-reg_config 0x103C,0x0007
-reg_config 0x100C,0x04E3
-reg_config 0x1008,0x4720
-reg_config 0x1009,0x0001
-delay 0x500
-reg_config 0x100C,0x061A
-b
-o EVM_Sample.bin
EVM_Sample.out

That is, the two functions of the GEL file are implemented in the .cmd file.

Step6. Burned to SPI flash, it can't run normally.

My question: Is the above operation correct?

If it is not correct, what can I do to run the program in SDRAM?


Viewing all articles
Browse latest Browse all 17527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>