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.

Use SD Card after booting from SD Card

Hi,

I've made up a setup with the EVM5515 booting a programm from SD Card. The booting itselfs runs ok (e.g. my LEDs toogle as programmed).

After booting I have to mount the SD-Card at a certain place in the code. For that I did exactly as in the
examples provided by the CSL.
I've called
        MMC_init();
        configSdCard(...)
        ATA_fileInit(...)
       ATA_systemInit(...)
 here I found, the systems hangs after a boot from SD in
  _AtaReadWord() called by _AtaReadByte()

When I ran the same file in my EVM downloaded direclty with CCS the system runs
perfectly, even when making an EVM reset and not reconfiguring with the GEL
file. When booting from SD,it hangs exactly at the first occurence of _AtaReadWord.

It seems the bootloader remains the SDcard interface in a different state as
the driver. Could you please give me an advice how to reconfigure the System
after a boot from the SD card, so that I can use it`in my program?

Micky

  • Just for a quick check, your code does not use SARAM31 which is used by bootloader as scratch memory; and you set PLL setting inside your code.

    Regards.

  • I didnot use SARAM31 as I reserved the following section in the linker command file (and did not place anything else):

    BOOT   (RWIX): origin = 0x04E000, length = 0x001fff  /* BOOT SD Card */

    The system initializes as follows (I took this code out of the GEL Files) - and it boots - when acessing the SD-Card it will hang. This is not the case, if I use the CCS to download the program. As told I disabled the GEL File, just downloading the code, using the SystemInit() as below and the system boots as desired.

     

    //-- Here my  SystemInit()

        volatile int i=0;
        /* Disable interrupts */
        *(int*)0x0003 = *(int*)0x0003 | 0x0800; // Set INTM
        *(int*)0x0000 = 0;      // Clear IER0
        *(int*)0x0000 = 0;      // Clear IER1

        // Zürcksetzen der Peripherie
        *(ioport Uint16*)PSRCR = 0x0020;
        *(ioport Uint16*)PRCR  = 0x00BB;

        // Interrupt vector
        for(i=0;i<0xff;i++);
        *(ioport Uint16*)IVPD = 0x027F; // Load interrupt vector pointer

        /* Enable clocks to all peripherals */
        *(ioport Uint16*) PCGCR1 = 0x0;
        *(ioport Uint16*) PCGCR2 = 0x0;

        /* Bypass PLL */
        *(ioport Uint16*) CCR2 = 0x0;
        /* Set CLR_CNTL = 0 */
        *(ioport Uint16*)CGCR1 = *(ioport Uint16*)CGCR1 & 0x7FFF;
        *(ioport Uint16*)CGCR1 =  0x8BE8;
        *(ioport Uint16*)CGCR2 =  0x8000;
        *(ioport Uint16*)CGCR3 =  0x0806;
        *(ioport Uint16*)CGCR4 =  0x0000;
        /* Wait for PLL lock */
        for(i=0;i<0x7ff;i++);
        /* Switch to PLL clk */
        *(ioport Uint16*)CCR2 = 0x1;

        // SDRAM
        /* reset EMIF */
        *(ioport Uint16*)PRCR = 0x0002;
        for(i=0;i<0xff;i++);

        //enable SDRAM clock
        *(ioport Uint16*)CLKCFGL=0x0001;

        /* enable word writes to EMIF regs */
        *(ioport Uint16*)ESCR = 0;

        /* step 1 */
        *(ioport Uint16*)SDTIMR1 = 0x4710;
        *(ioport Uint16*)SDTIMR2 = 0x3911;
        *(ioport Uint16*)SDSRETR = 0x0007;

        /* step 2 */
        *(ioport Uint16*)SDRCR = 0x04E3;
       
        /* step 3 */
        *(ioport Uint16*)SDCR1 = 0x4720;
        *(ioport Uint16*)SDCR2 = 0x0001;

        /* step 4 */
        for(i=0;i<0xff;i++) asm("\tnop");

        /* step 5 */
        *(ioport Uint16*)SDRCR = 0x061A;
        /* Enable clocks to all peripherals */
        SYS_PCGCR1 = 0x0000;
        SYS_PCGCR2 = 0x0000;

  • Michael;

    I just want to clarify following things:

    1. Your program worked fine when you are using CCS and emulator on a C5515EVM.

    2. But when you burn this program to a SD card and boot from there, then the program halt, correct?

    3. What is your current PLL set frequency and what is your SD clock setting?

    Make sure your SD card clock will not exceed 50MHz. if your PLL setting is high, make sure you set the correct divider for the SD clock, such as 2, 4 or 8

    Regards

    Wen