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.

Problems pasting PLL initialization from GEL to main

Hi everyone,

thanks for this great forum. I wanna load the LED_BLINK example code to the EEPROM of the USB STICK.

I had build the .out file, then convert .out to .bin with hex55.exe and load this .bin to EEPROM with Programmer_usbkey.out.

The code loaded sucesfull and run in the usbstick, but the led start to blink very slowly. Whet the code is directly executed from ram (via CCS) the led blinks normal, but in the DSP EEPROM very slowly.

I believe that my problem is that i have not any initializing code, such as PLL or peripherals reset that is included in the GEL file. If i try to copy-paste the functions from GEL to Main function i have some errors, like dont recognized the sentence @IO or @data, structure of the GEL functions.

If i removed that part (i.e. @IO) the program dont show any error and load the code sucesfull, but the led Blinks slowly again.

What happen with this? what I have to do? my softwares especification are this:

CCS v. 4.0

programmer_usbkey.out (Released from google page)

C5500 Code Generation Tool  v. 4.3.6 and 4.3.5 and 4.3.4

THANKS A LOT

(P.D. Sorry for my poor english :D)

 

 

 

 

 

  • Include the following lines to ur main.c and call ProgramPLL_100MHz() at the beginning of the main function. Then compile, create led.bin using hex55 and load using programmer.out. I tested it yesterday and it worked.

     

    #define PCGCR1   0x1c02
    #define PCGCR2   0x1c03
    #define CCR2     0x1c1f
    #define CGCR1    0x1c20
    #define CGCR2    0x1c21
    #define CGCR3    0x1c22
    #define CGCR4    0x1c23

    void ProgramPLL_100MHz(void){

    int i;

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

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

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

        *(short *)CGCR2 = 0x8000;
        *(short *)CGCR4 = 0x0000;
        *(short *)CGCR3 = 0x0806;
        *(short *)CGCR1 = 0x82fa;

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

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

        printf("PLL Init Done.");

    }

    Riju

  • Thanks You for the answer.

     

    I tried to do your comment, but the led again blinks very slowly (5-6 seconds), directly in CCS (RAM) the led blinks every second.

     

    Have you another recomendation?

     

    Thanks for your help.

  • Hi again.

    I´m attaching mi principal code, thanks for your possible help.

     

    #include "stdio.h"

    #include "usbstk5505.h"

     

    #define PCGCR1   0x1c02

    #define PCGCR2   0x1c03

    #define CCR2     0x1c1f

    #define CGCR1    0x1c20

    #define CGCR2    0x1c21

    #define CGCR3    0x1c22

    #define CGCR4    0x1c23

     

    void ProgramPLL_100MHz(void)

    {

    int i;

        printf("Configuring PLL (100.00 MHz).\n");

        /* Enable clocks to all peripherals */

        *(short *)PCGCR1 = 0x0;

        *(short *)PCGCR2 = 0x0;

     

        /* Bypass PLL */

        *(short *)CCR2 = 0x0;

     

        /* Set CLR_CNTL = 0 */

        *(short *)CGCR1 = *(short *)CGCR1 & 0x7FFF;

     

        *(short *)CGCR2 = 0x8000;

        *(short *)CGCR4 = 0x0000;

        *(short *)CGCR3 = 0x0806;

        *(short *)CGCR1 = 0x82fa; 

     

        /* Wait for PLL lock */

        for(i=0;i<0x7fff;i++);

     

        /* Switch to PLL clk */ 

        *(short *)CCR2 = 0x1;

     

        printf("PLL Init Done.");

     

    }

    void TEST_execute( Int16 ( *funchandle )( ), char *testname, Int16 testid )

    {

        Int16 status;

     

        /* Display test ID */

        printf( "\n%02d  Testing %s...\n", testid, testname );

     

        /* Call test function */

        status = funchandle( );

     

        /* Check for test fail */

        if ( status != 0 )

        {

            /* Print error message */

            printf( "     FAIL... error code %d... quitting\n", status );

     

            /* Software Breakpoint to Code Composer */

            SW_BREAKPOINT;

        }

        else

        {

            /* Print error message */

            printf( "    PASS\n" );

        }

    }

    extern Int16 led_test( );

     

    void main( void )

    {

        ProgramPLL_100MHz();      

     

        /* Initialize BSL */

        USBSTK5505_init( );

     

        TEST_execute( led_test,  "LEDs", 1 );

     

        printf( "\n***ALL Tests Passed***\n" );

        SW_BREAKPOINT;

  • Which version of hex55 are u using. I use 4.3.5 whic gives good speed. Refer to http://e2e.ti.com/support/dsp/tms320c5000_power-efficient_dsps/f/110/p/11099/43179.aspx#43179 to see which version of hex55 is slow.

    Riju

  • Thanks Rijurekha for your help.

    I tested the program with hex55.exe version 4.3.6, but doesn´t work. Then, i tested with hex55.exe version 4.3.5 and again doesn´t work, The last test was done with hex55.exe vesion 4.3.4 and nothing.

    I am a little desperate with this, because another project doesn´t work when flashing.

    Thanks for your attention.

  • Finally i´ve fixed the issue adding the function InitSystem() to the main code.

    The blinking led is normal.

     

  • Hi  Nemanya, Am facing similar problem.


    Actually am trying sample LCD code to boot from c5535 EEPROM. I now the procedure to convert the .out file to .bin.

    Here i need is to include initialization part to sample lcd code. As you fixed this earlier by adding the initsystem() to main code. Can you please provide the total sample led program which having initialization to boot from EEPROM.

    Thanks,

    Kranthi.