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.

[OMAP-L137] NDK in spi0 flash boot mode



Hello
I have an EVMOMAPL137 and I want to connecting it to PC via ethernet . I have run a project named "client.prj" from    "ndk_2_0_0\packages\ti\ndk\example\network\client " in CCSv3.3 and I assigned a special  LocalIPAddr to the EVM. it connect to the PC correctly.
I want the program rest on the EVM when I power cycle it and it work completely in SPI0 flash boot mode.
for this I used the procedure that I had used before for running a simple program for blinking leds (it had worked correctly in spi0 flash boot mode).
But the client.prj don't work correctly in spi0 flash boot mode . only ,a part of it works.
I think the reason is about removing .gel file and about configuration functions that I add in client.c .
What is your idea ?
Regards,
Zahra.

  • Remove the GEL file and try to get your code to run stand-alone. You are probably right in that some functions you are executing in the GEL are not in your code so they don't run when you boot from SPI.

    Jeff

  • Dear Jeff

    I removed the GEL file and added necessary function in my code . but it didn't solve the problem!

    Regards,

    Mazaheri.

  • Does that code work in CCS without a GEL file as well?
    Jeff

  • No,it doesn't work  in CCS without a GEL file .It doesn't load without a GEL file and appear this error:


    "error: file loader

    data verification failed at address 0xc00dd000.

    please verify target memory and memory map."

    But the example for blinking LEDs works in CCS without a GEL file!
    I added configuration functions in client.c and I executed them in  this place of client.c:
    int main()
    {
    Setup_System_Config( );
    Setup_Psc_All_On( );
    }

    Is it right?

    Regards,

    Mazaheri.

     

  • Mazaheri,

    Are you initializing DDR?  It looks like your application is using the external DDR memory space.

    -Tommy

  • Dear Tommy,

    How I should initialize  DDR ?

    In the evmomapl137_dsp.gel file these tow line do this work :  

      /* DDR */
        GEL_MapAddStr( 0xB0000000, 0, 0x00008000, "R|W|AS4", 0 );   // EMIFB Control
        GEL_MapAddStr( 0xC0000000, 0, 0x20000000, "R|W|AS4", 0 );   // EMIFB SDRAM Data

    But I don't know what are the equivalent c codes of them that I should write in client.c file,when I remove the evmomapl137_dsp.gel file.

    Please help me!

  • Mazaheri,

    Sorry, I meant to say initialize SDRAM, not DDR.  You would want to execute the code contained in the Setup_EMIFB() function from the GEL file.

    -Tommy

  • Tommy,

    I added these codes in the client.c :

    #define EMIFB_BASE              0xB0000000
    #define EMIFB_SDSTAT            *(unsigned int*)(EMIFB_BASE + 0x04)    //SDRAM Status Register 
    #define EMIFB_SDCFG             *(unsigned int*)(EMIFB_BASE + 0x08)    //SDRAM Bank Config Register
    #define EMIFB_SDREF             *(unsigned int*)(EMIFB_BASE + 0x0C)    //SDRAM Refresh Control Register
    #define EMIFB_SDTIM1            *(unsigned int*)(EMIFB_BASE + 0x10)    //SDRAM Timing Register
    #define EMIFB_SDTIM2            *(unsigned int*)(EMIFB_BASE + 0x14)    //SDRAM Timing Register



    Setup_EMIFB()
    {
        // ISSI IS42S16160B-6BL SDRAM, 2 x 16M x 16 (32-bit data path), 133MHz
        EMIFB_SDCFG = 0         // SDRAM Bank Config Register
            |( 1 << 15)         // Unlock timing registers
            |( 2 << 9 )         // CAS latency is 2
            |( 2 << 4 )         // 4 bank SDRAM devices
            |( 1 << 0 );        // 512-word pages requiring 9 column address bits

        EMIFB_SDREF = 0         // SDRAM Refresh Control Register
            |( 0 << 31)         // Low power mode disabled
            |( 0 << 30)         // MCLK stoping disabled
            |( 0 << 23)         // Selects self refresh instead of power down
            |( 1040 <<0);       // Refresh rate = 7812.5ns / 7.5ns

        EMIFB_SDTIM1 = 0        // SDRAM Timing Register 1
            |( 25 << 25)        // (67.5ns / 7.55ns) - 1 = TRFC  @ 133MHz
            |( 2 << 22 )        // (20ns / 7.5ns) - 1 =TRP
            |( 2 << 19 )        // (20ns / 7.5ns) - 1 = TRCD
            |( 1 << 16 )        // (14ns / 7.5ns) - 1 = TWR
            |( 5 << 11 )        // (45ns / 7.5ns) - 1 = TRAS
            |( 8 <<  6 )        // (67.5ns / 7.5ns) - 1 = TRC
            |( 2 <<  3 );       // *(((4 * 14ns) + (2 * 7.5ns)) / (4 * 7.5ns)) -1. = TRRD
                                // but it says to use this formula if 8 banks but only 4 are used here.
                                // and SDCFG1 register only suports upto 4 banks.

        EMIFB_SDTIM2 = 0        // SDRAM Timing Register 2
            |( 14<< 27)         // not sure how they got this number. the datasheet says value should be
                                // "Maximum number of refresh_rate intervals from Activate to Precharge command"
                                // but has no equation. TRASMAX is 120k.
            |( 9 << 16)         // ( 70 / 7.5) - 1
            |( 5 << 0 );        // ( 45 / 7.5 ) - 1

        EMIFB_SDCFG = 0         // SDRAM Bank Config Register
            |( 1 << 16)
            |( 0 << 15)         // Unlock timing registers
            |( 2 << 9 )         // CAS latency is 2
            |( 2 << 4 )         // 4 bank SDRAM devices
            |( 1 << 0 );        // 512-word pages requiring 9 column address bits

     

    and then I executed the Setup_EMIFB(); function in void main(void) of client.c.

    But it doesn't work without the GEL file. the Error: File Loader appears I want to load my program.

    Is it necessary that you see the client.prj and client.c completely ? Can the problem is about something else?

     

  • Can you copy/paste the error message?

  • Dear Tommy,

    The error is :

    "error: file loader

    data verification failed at address 0xc00dd000.

    please verify target memory and memory map."

  • Hi Tommy,

    Could you find what is the problem?

    I am waiting for your reply!

    Thanks,

    Z Mazaheri.

  • Mazaheri,

    That seems to be the same problem of an incorrectly configured SDRAM memory.  If you are loading the program into SDRAM through CCS, you need to configure the SDRAM first (with a GEL file) so that CCS is able to access the memory space.  You can verify that it is configured correctly by manually poking the memory space through CCS.

    Similar to CCS loading code into SDRAM, your boot application needs to initialize SDRAM before placing data into SDRAM.  Typically this is done by copying a small boot program into internal memory which enables SDRAM and copies the larger application into SDRAM.

    -Tommy

  • Tommy,

    Ok but I don't know what is the small boot program for initializing SDRAM.

    The Setup_EMIFB() do not this work .

    Could you please send me the small boot program for initializing SDRAM that I should add in the client.c page?

    Thanks,

    Z Mazaheri .

  • Hi Mazaheri

    As Tommy explained, since your NDK project seems to be occupying data/program memory in SDRAM, you cannot initialize the SDRAM from your client.c (NDK application itself).The SDRAM needs to be pre-initialized.

    The easiest way to do this (once you don't want to rely on the GEL file for CCS based working alone)  would be to make use of the AISGEN tools , provided with the boot loader appnote.

    I see that you are familiar with the AIS tools , looking at some of the other posts like

    http://e2e.ti.com/support/dsp/tms320c6000_high_performance_dsps/f/115/t/31904.aspx?PageIndex=2

    You can pre-initialize the SDRAM via the GUI , putting the correct SDRAM configuration register values as seen in the gel file. You should find Section 5.3.3 in the bootloader appnote helpful too ( http://focus.ti.com/lit/an/sprab04d/sprab04d.pdf

    Hope this helps.
    Regards

    Mukul

  • Dear Mukul

    What is your mean from this sentence: " You can pre-initialize the SDRAM via the GUI ".

    what is the GUI?

    As mentioned in section 5.3.3 in the bootloader appnote,I checked the Configuring EMIFB SDRAM box in AISgen window and then it  generated the .ais file and finally, I flashed it to the EVM via UART2.

    A wonderful result appears : when Power up the EVM in spi0flash boot mode at the first and second time, the application executes completely , but it does not execute completely after I power cycle the EVM at the third time and at the times after it.

    Can you tell me what is the problem?

    Best Regards,

    Mazaheri.

  • Z Mazaheri said:
    What is your mean from this sentence: " You can pre-initialize the SDRAM via the GUI ".

    what is the GUI?

    I meant the AISGEN tool , sorry to confuse you calling it a GUI. Essentially configuring the SDRAM via the AISGEN lets you pre-initialize it using the ROM boot loader code, such that you don't have to write your own SDRAM initialization routine etc.

    Z Mazaheri said:
    A wonderful result appears : when Power up the EVM in spi0flash boot mode at the first and second time, the application executes completely , but it does not execute completely after I power cycle the EVM at the third time and at the times after it.

    So are you saying with this your NDK app has started working via booting from SPI Flash, at least once/twice ? Please confirm.

    Z Mazaheri said:
    Can you tell me what is the problem?

    Need more details from you on what is working  versus not executing completely mean? Have you see the NDK app work for you reliably for you in your CCS + GEL file environment (trying it multiple times?). I am assuming your third and fourth attempt is also with a power cycle in between , please confirm? When you say it is not completing execution, can you tell us where the program counter is stuck, you should be able to tell this by trying to connect to CCS once your program is stuck, and provide the PC value via view CPU registers etc.

    If possible, when your application is stuck executing the code, please see if you can execute the following diagnostic GEL file and give us the printout from the GEL file

    http://processors.wiki.ti.com/index.php/OMAP-L1x_Debug_Gel_Files

    Regards

    Mukul

  • Mukul Bhatnagar said:
    So are you saying with this your NDK app has started working via booting from SPI Flash, at least once/twice ? Please confirm".



    Yes ,my NDK app has started working completely  via booting from SPI Flash, only once/twice.

    Mukul Bhatnagar said:
    I am assuming your third and fourth attempt is also with a power cycle in between , please confirm?


    Yes , that's right.

    For details:    I put the EVMOMAPL137_LED_on(3 ); in the top of the codes in client.c :

    void main(void)
    {
          /* Initialize BSL */
        EVMOMAPL137_init( );
     
        Setup_Psc_All_On( );

        Setup_System_Config( );

    EVMOMAPL137_LED_init( );

     EVMOMAPL137_LED_on(3 );

    // When USE_OLD_SERVERS set to zero, server daemon is used
    #define USE_OLD_SERVERS 0

    //---------------------------------------------------------------------------
    // Title String
    //
    char *VerStr = "\nTCP/IP Stack Example Client\n";



     and EVMOMAPL137_LED_on(1 ); in the end of codes in client.c .
    After power up in SPI0 boot mode ,The LED number 3 blinks but The LED number 1 is off yet and the webpage of the EVM can not load in my PC.


    And ,as you mentioned, I connected the EVM in CCSv3.3 with OMAPL1x_debug.gel . this is the printout from the GEL file:

    ---------------------------------------------
    |               BOOTROM Info                |
    ---------------------------------------------
    ROM ID: d800k001
    Silicon Revision 1.0
    Boot Mode: SPI0 Flash

    ROM Status Code: 0x000000FF
    Description: Error code not recognized

  • Hi Mazaheri

    Thanks for providing the clarifications. I don't have any specific pointers to pin point on what could be causing your app to not work after the first one/two trials. At this point I can only think of providing additional pointers that might help you narrow down the possible causes

    1) To isolate whether the application is not working due to a boot issue or otherwise, I would recommend seeing if you can get your application to fail the same way the third/fourth time in your CCS based environment (using GEL file and CCS to load and run the project). If multiple re-runs on the CCS version do not show a similar behavior then maybe there is some issue with the boot up process?

    2) Could it be some sort of a network issue rather then a device, EVM or boot issue? Anyway for you to verify that?

    3) Can you try to isolate/zoom in to the exact location where your code is hanging? You could do this either by trying to see where the program counter is by connecting to CCS once your boot app is hanging, and try to relate the program counter location with the .map file and/or symbols for your project. Alternatively you can try to keep moving your LED_on(3) function further in the code, till you stop see it blinking, that should hopefully give you an idea of where your code is stuck

    4) Please see if any of the FAQ on the NDK , helps http://processors.wiki.ti.com/index.php/Network_Developers_Kit_FAQ

    Regards

    Mukul

  • Dear Mukul

    I know that the problem is about pre-initializing the SDRAM before starting to load the application.

    I think if I could flash a simple program for pre-initialize the SDRAM at the address zero of SPI FLASH , and then I flash my application at the address after it ,the problem will be solved.

    What is your idea? how I can do this?

    Kind Regards,

    Z Mazaheri

  • Hi Mazaheri

    You don't have to write your own program to pre-initialize SDRAM, you should be able to make use of the AISgen tools to pre-initialize the SDRAM as explained in Section 5.3.3 in the boot loader appnote. Make sure that if you are using the AISgen tools to initialize the SDRAM, then you do not re-initialize it in your client.c as you were doing earlier.

    Regards

    Mukul