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.

TMS320C6657: Modified GEL file works in no boot mode but causes issues with PCIe in SPI NOR Flash boot mode

Part Number: TMS320C6657

I have modified the default GEL file to initialize DDR3 memory and PLL1 and PLL2. When debugging in no boot mode there are no issues. However when booting from SPI NOR Flash, the DSP successfully boots ( this is confirmed by LED blinking code ). Using LED's I have pinpointed the first line in our DSP code that triggers a exit. We have a "configurePCIe()" function in our main_startupTask that fails. Inside the "configurePCIe()" function we run the following code succesfully: 

// Raise the PCIE Reset Line BHS
GPIO_write(FPGA_PCIE_RST, GPIO_PIN_VAL_LOW);
cycleDelay(100000);
GPIO_write(FPGA_PCIE_RST, GPIO_PIN_VAL_HIGH);


pcieRet_e retVal;
int32_t deviceNum = 0;
pcieBarCfg_t barCfg;
pcieIbTransCfg_t ibCfg;
uint16_t lock=0;
void *pcieBase;

if ((retVal = Pcie_init (&pcieInitCfg)) != pcie_RET_OK)
{
printf("LLD device configuration failed\n");
exit(1);
}

/* Turn on the PCIe power domain */
if (CSL_PSC_getPowerDomainState (CSL_PSC_PD_PCIE) != PSC_PDSTATE_ON)
{
/* Enable the domain */
CSL_PSC_enablePowerDomain (CSL_PSC_PD_PCIE);
/* Enable MDCTL */
CSL_PSC_setModuleNextState (CSL_PSC_LPSC_PCIE, PSC_MODSTATE_ENABLE);
/* Apply the domain */
CSL_PSC_startStateTransition (CSL_PSC_PD_PCIE);
/* Wait for it to finish */
while (! CSL_PSC_isStateTransitionDone (CSL_PSC_PD_PCIE));
}
else
{
printf("Power domain is already enabled. You probably re-ran without device reset (which is OK)\n");
}

if ((retVal = Pcie_open(deviceNum, &handle)) != pcie_RET_OK)
{
printf("Pcie Open failed (%d)\n", (int)retVal);

exit(1);
}

/* Configure SERDES*/
uint16_t cfg = 0x01C9; /* value based on PCIe userguide
sprugs6d.pdf, 2.3.1
*/

/* Provide PLL reference clock to SERDES inside PCIESS
Program PLL settings and enable PLL from PCIe SERDES.*/
CSL_BootCfgSetPCIEConfigPLL(cfg);

/*Wait for PLL to lock */
cycleDelay(100000);

/* Set the PCIe mode*/
pcieMode_e PcieMode = pcie_RC_MODE;
if ((retVal = Pcie_setInterfaceMode(handle, PcieMode)) != pcie_RET_OK)
{
printf("Set PCIe Mode failed (%d)\n", (int)retVal);

exit(1);
}

/* Wait until the PCIe SERDES PLL locks */
while (!lock)
{
CSL_BootCfgGetPCIEPLLLock(&lock);
}

printf("PLL configured\n");

After this section we attempt to configure application registers for root complex. This fails. Digging deeper, configuring the application registers for root complex fails when attempting to disable link training. To the deepest level I can dig the program fails here:

if ((retVal = Pcie_readRegs (handle, pcie_LOCATION_LOCAL, regs)) != pcie_RET_OK)
{
displayComment("Read CMD STATUS and DEVICE CMD registers failed!\n");
return retVal;
}

I am not sure why it is failing when booting from SPI NOR Flash yet has no issues when debugging in no boot mode. Any help would be much appreciated.

  • Alex,

    You are on right track.

    Just compare the values of configuration-register-settings in GEl file VS the SPI boot code and its configuration for the same registers.

    Focus more on the peripheral which fails... For example, PLL settings for PCIE in GEl file Vs the SPI boot code.

    Regards

    Shankari G

  • Thanks for the response. There is no code difference between booting from NOR flash and booting in no boot mode. The only difference is the method of boot. Both debugging in no boot mode and booting from NOR flash use the same GEL file. And the boot from NOR flash is successful but fails within the code when configuring PCIe

  • Alex,

    I think it is not.

    Booting from NOR flash should not use GEL file. THAT IS THE PURPOSE OF BOOTING FROM NOR/NAND etc...

    NO-BOOT mode using GEL file is for debugging purpose. 

    1. For product development ----> NO-boot with GEL for developer usage.

    2. For end product release -----> After power on --> Boot from NOR/NAND flash memory...without gel file for end customer usage...

    ----

    Only in no-boot mode, GEL file should be used.

    =============================================

    Please have a look at these FAQs for boot from NOR flash.

    =============================================

    1. How to flash the IBL ( Intermediate Boot loader ) into EEPROM and how to flash the application binary into NOR? How to boot the IBL + Application binary?

    [FAQ] TMS320C6657: How to flash the IBL ( Intermediate Boot loader ) into EEPROM and how to flash the application binary into NOR? How to boot the IBL + Application binary? - Processors forum - Processors - TI E2E support forums

    2. NAND booting - 

     [FAQ] TMS320C6657: How to run the direct NAND-BOOT example on TI-C6657-EVM without IBL ? - Processors forum - Processors - TI E2E support forums

    I hope this helps !

    Regards

    Shankari G

  • We made changes to the app.cfg file in order to enable the DDR3 memory for heap usage. In order to accommodate this change, we began running the GEL file as an initialization script when debugging in No Boot mode. If we debug in no boot mode without running the GEL script we fail in the same PCIe configuration test. The GEL script runs when launching the evm6657ls.ccxml configuration and connecting to the target. Then we are able to program the NOR Flash for SPI NOR Flash boot mode. We then reset the DSP, power off the board, configure our dip switches to SPI NOR Flash mode, and power the board on. This is where we can tell the DSP boots with some blinking LED code. But it errors out configuring the PCIe. If we revert our changes to the app.cfg file that we put in place to initialize the DDR3 memory, then the DSP can boot in SPI NOR Flash mode and not error out in the PCIe configuration functions. So my question is how do we initialize the DDR3 memory without the GEL file. 

  • I believe what I am asking for is how to create and use the "DDR configuration table" and include it in our RBL for booting for SPI NOR Flash

  • Alex,

    RBL cannot be changed.

    But using the ROM_BOOT_example for SPI, you can do it.

     0435.C6657_directROM_Boot_example.zip

    --

    For Direct SPI boot, follow this FAQ:- 

    [FAQ] TMS320C6657: How to run the direct SPI-BOOT example on TI-C6657-EVM without IBL ? - Processors forum - Processors - TI E2E support forums

    And in spiboot.c, you can do the register settings here:- 

    #include <stdio.h>
    #include <string.h>
    #include <stdint.h>
    #include "tiboot.h"
    #include "platform.h"
    
    #pragma  DATA_SECTION (emif4Cfg, ".emif4Cfg")
    const BOOT_EMIF4_TBL_T  emif4Cfg =  {
    
        BOOT_EMIF4_ENABLE_MSW_pllCtl          | \
        BOOT_EMIF4_ENABLE_MSW_sdRamTiming1    | \
        BOOT_EMIF4_ENABLE_MSW_sdRamTiming2    | \
        BOOT_EMIF4_ENABLE_MSW_sdRamTiming3    | \
        BOOT_EMIF4_ENABLE_MSW_ddrPhyCtl1      | \
        BOOT_EMIF4_ENABLE_MSW_sdRamRefreshCtl | \
    	BOOT_EMIF4_ENABLE_MSW_sdRamOutImpdedCalCfg | \
    	BOOT_EMIF4_ENABLE_MSW_sdRamConfig,
    
        BOOT_EMIF_ENABLE_SLSW_config0 | \
    	BOOT_EMIF_ENABLE_SLSW_config6 | \
    	BOOT_EMIF_ENABLE_SLSW_config7 | \
    	BOOT_EMIF_ENABLE_SLSW_config8 | \
    	BOOT_EMIF_ENABLE_SLSW_config9 | \
    	BOOT_EMIF_ENABLE_SLSW_config10 | \
    	BOOT_EMIF_ENABLE_SLSW_config18 | \
    	BOOT_EMIF_ENABLE_SLSW_config19 | \
    	BOOT_EMIF_ENABLE_SLSW_config20 | \
    	BOOT_EMIF_ENABLE_SLSW_config22 | \
    	BOOT_EMIF_ENABLE_SLSW_config12 | \
    	BOOT_EMIF_ENABLE_SLSW_config23 | \
    	BOOT_EMIF_ENABLE_SLSW_config21,      /* Config select slsw */
        0,      /* Config select lsw  */
        
        3,      /* pllPrediv  */
        40,     /* pllMult    */
        2,      /* pllPostDiv */
    
        0x62477AB2,  /* sdRamConfig */
        0,           /* sdRamConfig2, dont care*/
        0x0000144F,  /* sdRamRefreshCtl  */
        0x1333780C,  /* sdRamTiming1 */
        0x30717FE3,  /* sdRamTiming2 */
        0x559F86AF,  /* sdRamTiming3 */
    
        0,           /* lpDdrNvmTiming, dont care */
        0,           /* powerManageCtl, dont care */
        0,           /* iODFTTestLogic, dont care */
        0,           /* performCountCfg, dont care */
        0,           /* performCountMstRegSel, dont care */
        0,           /* readIdleCtl, dont care */
        0,           /* sysVbusmIntEnSet, dont care */
        0x70074c1f,  /* sdRamOutImpdedCalCfg, dont care */
        0,           /* tempAlterCfg, dont care */
    
        0x0010010F,  /* ddrPhyCtl1 */
    
        0,           /* ddrPhyCtl2, dont care */
        0,           /* priClassSvceMap, dont care */
        0,           /* mstId2ClsSvce1Map, dont care */
        0,           /* mstId2ClsSvce2Map, dont care */
        0,           /* eccCtl, dont care */
        0,           /* eccRange1, dont care */
        0,           /* eccRange2, dont care */
        0,           /* rdWrtExcThresh, dont care */
    
        0x87A0047F, 0, 0, 0, 0, 0, 0x33, 0x3A,
        0x2C, 0x2C, 0x21, 0, 0xAF00002, 0, 0, 0,
        0, 0, 0xB7, 0xB1, 0xA4, 0xA4, 0x98, 0x200,
        0, 0, 0, 0, 0, 0, 0, 0,
        
        0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0
    };
    	

    Regards

    Shankari G

  • So I implemented the #pragma DATA_SECTION with the "emif4Cfg" table but the DSP still failed when configuring the PCIe. Upon investigating the tiboot.h and its corresponding c66x.c it appears as though whatever this table is filled with gets ignored for my specific C6657 DSP. So I began another approach. I began converting the GEL file into c to create and "init" function to call from my main_startuptask function. It appears this approach is successful in initializing DDR3 memory and the PLLs. However my DSP still crashed. I am assuming this crash occurred because while I now initialize the DDR3 and configure the PLL, the memory still isn't mapped as it is in the GEL file. How do I replicate the functionality of the "Setup_Memory_Map( )" function in the GEL script? I feel it is also worth noting the tiboot.h file I have is named "tiboot_c66x.h" and it did not have all of the fields for the emif4Cfg table. I tried both leaving it as is and modifying it to match the tiboot.h file you attached. Neither seemed to work.

  • Thanks the problem has been resolved

  • Alex,

    My answers solved your problem? If yes, please click on the "Answered" button.

    or

    You solved by yourself. 

    If you solved by yourself, please share the resolution in details which will help other E2E customers.

    Regards

    Shankari G