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.

XCLKIN in F28027 (Piccolo)

Other Parts Discussed in Thread: TMS320F28027, CONTROLSUITE

Hi,

I wish using the XCLKIN in TMS320F28027. I use the following code:

    myClk = CLK_init((void *)CLK_BASE_ADDR, sizeof(CLK_Obj));
    myCpu = CPU_init((void *)NULL, sizeof(CPU_Obj));
    myFlash = FLASH_init((void *)FLASH_BASE_ADDR, sizeof(FLASH_Obj));
    myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj));
    myPie = PIE_init((void *)PIE_BASE_ADDR, sizeof(PIE_Obj));
    myPll = PLL_init((void *)PLL_BASE_ADDR, sizeof(PLL_Obj));
    myWDog = WDOG_init((void *)WDOG_BASE_ADDR, sizeof(WDOG_Obj));

    WDOG_disable(myWDog);
    CLK_enableAdcClock(myClk);
    (*Device_cal)();
    CLK_disableAdcClock(myClk);

    CLK_setOscSrc(myClk, CLK_OscSrc_External);

The problem is that in gpio.h do not have the "GPIO_setMode" suitable for XCLKIN (GPIO_19 because I'm using the board Piccolo). I have not found in ControlSuite code examples using the XCLKIN. I appreciate any help.

.,

Danilo.

  • Hi Danilo,

    Try using v129 as its more coder friendly - giving you access to header files for detailed configurations.
    C:\ti\controlSUITE\device_support\f2802x\v129\DSP2802x_examples_ccsv4

    Also, GPIO38 is the default selection for XCLKIN. In v129 you can browse DSP2802x_SysCtrl.c file for XCLKIN settings.

    Regards,
    Gautam
  • Danoilo,
    No need for additional GPIO settings. Select GPIO19 as clock source in XCLK[XCLKINSEL] and drive clock.
    -Bharathi.
  • Hi Bharathi,

    I'm developing through of drivers, and I know no how make "GPIO19 as clock source in XCLK[XCLKINSEL]" in drivers (I used the GPIO_setMode for this). Maybe developer as structs be easier.

    []'s,

    Danilo Pena.

  • Thanks Gautam, I did not know the v129. The problem is that I have to migrate all headers of my project to v129 (I use v230). Is not there a way using the V230?

    []'s,
    Danilo Pena.
  • Yes yes... refer to examples from this sub-folder instead: C:\ti\controlSUITE\device_support\f2802x\v230\f2802x_examples_structs

    Regards,
    Gautam
  • I have a new problem. I make this settings:

    myClk = CLK_init((void *)CLK_BASE_ADDR, sizeof(CLK_Obj));
    myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj));
    
    GPIO_setDirection(myGpio, GPIO_Number_19, GPIO_Direction_Input);
    
    CLK_setOscSrc(myClk, CLK_OscSrc_External);
    CLK_enableGpioInputClock(myClk);
    CLK_enableClkIn(myClk); //((CLK_Obj *)myClk)->CLKCTL &= (~CLK_CLKCTL_XCLKINOFF_BITS);
    ((CLK_Obj *)myClk)->XCLK |= CLK_XCLK_XCLKINSEL_BITS;

    I get the following message "No source available for "0x3ff5f5"". I believe that is a bad choice in the time of the settings. I see in "System Control Reference Guide" that "If the clock source is not used or the respective pins are used as GPIOs, the user should disable it at boot time.", then this boot time has something to do with it.

    How to fix it?

    []'s,

    Danilo Pena.

  • I use the GPIO19 because the Piccolo Launchpad.
  • I checked in debugging the problem occurs in:

    CLK_setOscSrc(myClk, CLK_OscSrc_External);

  • Hi Danilo,

    Even though you get No Source available warning, you would still be able to continue with debugging right?

    Check this:



    Regards,
    Gautam

  • Hi Gautam,

    No.
    After debugging much, I discover that I can't write "((CLK_Obj *)myClk)->CLKCTL |= (1<<0);" (one setting for external clock).
    I'd like a sample code that uses XCLKIN (External Clock with wave generator) for TMS320F28027 (Piccolo Launchpad). At least the minimum settings.
    I not found in any sample code or document the required minimum guidelines (the "user guides - TMS320F2802xx Piccolo System Control and Interrupts Reference Guide" is insufficient). I can not use the external clock.

    []'s,
    Danilo.
  • Hi Danilo,

    Can you try with the structured approach instead of driver based?
    You can have a look at these examples: C:\ti\controlSUITE\device_support\f2802x\v129\DSP2802x_examples_ccsv4

    Regards,
    Gautam
  • Hi Danilo,

    The 027 LaunchPad does not have an external oscillator.

    For your own board, you would connect the external OSC to GPIO19 and GPIO38 as described in the datasheet:

     

    Then call the function ExtOscSel() from InitSysCtrl() instead of calling the IntOsc1Sel() or IntOsc2Sel() functions,

    Can you use the internal oscillators for development while using the LaunchPad?

    Jeff

  • Hi Jeff,

    the 027 LaunchPad agree I use the external oscillator through of the GPIO19, that is why I write "((CLK_Obj *)myClk)->XCLK |= CLK_XCLK_XCLKINSEL_BITS;":

    Jeff, the problem is that I do the equivalent "ExtOscSel()" through of the settings in bits, for example:

    ENABLE_PROTECTED_REGISTER_WRITE_MODE;
    ((CLK_Obj *)myClk)->CLKCTL &= ~(1<<9);
    ((CLK_Obj *)myClk)->CLKCTL &= ~(1<<11);
    ((CLK_Obj *)myClk)->CLKCTL |= (1<<14);
    ((CLK_Obj *)myClk)->CLKCTL |= (1<<10);
    ((CLK_Obj *)myClk)->CLKCTL |= (1<<8);
    ((CLK_Obj *)myClk)->CLKCTL |= (1<<0);
    ((CLK_Obj *)myClk)->XCLK |= CLK_XCLK_XCLKINSEL_BITS; // 00100000
    ((CLK_Obj *)myClk)->CLKCTL |= CLK_CLKCTL_XTALOSCOFF_BITS;
    ((CLK_Obj *)myClk)->CLKCTL &= (~CLK_CLKCTL_XCLKINOFF_BITS);
    DISABLE_PROTECTED_REGISTER_WRITE_MODE;

    and does not work.

    I can use the internal oscillator. But my project requires external oscillator.

    []'s,

    Danilo Pena.

  • Okay Danilo, I have asked our XTAL expert to comment.
  • Please whether the following bitfields are set accordingly after you run the code.


    OSCCLKSRCSEL     = 1 (External osc (or) INTOSC2)

    OSCCLKSRC2SEL   = 0 (External oscillator selected)

    INTOSC2OFF              = 1 (INTOSC2 = Turned OFF)

    XCLKINOFF                 = 0 (XCLKIN oscillator input ON)

    XTALOFF                      = 1 (Crystal oscillator OFF)

    XCLKINSEL                 = 1 (GPIO19 = CLKIN)

    Regards,

    Manoj

  • Hi Manoj,

    I write:

    ENABLE_PROTECTED_REGISTER_WRITE_MODE;
    ((CLK_Obj *)myClk)->CLKCTL |= CLK_CLKCTL_OSCCLKSRCSEL_BITS;			// OSCCLKSRCSEL = 1 (External osc (or) INTOSC2
    ((CLK_Obj *)myClk)->CLKCTL &= (~CLK_CLKCTL_OSCCLKSRC2SEL_BITS);		// OSCCLKSRC2SEL = 0 (External oscillator selected)
    ((CLK_Obj *)myClk)->CLKCTL |= CLK_CLKCTL_INTOSC2OFF_BITS;			// INTOSC2OFF = 1 (INTOSC2 = Turned OFF)
    ((CLK_Obj *)myClk)->CLKCTL &= (~CLK_CLKCTL_XCLKINOFF_BITS);			// XCLKINOFF = 0 (XCLKIN oscillator input ON)
    ((CLK_Obj *)myClk)->CLKCTL |= CLK_CLKCTL_XTALOSCOFF_BITS;			// XTALOFF = 1 (Crystal oscillator OFF)
    ((CLK_Obj *)myClk)->XCLK |= CLK_XCLK_XCLKINSEL_BITS;				// XCLKINSEL = 1 (GPIO19 = CLKIN)
    DISABLE_PROTECTED_REGISTER_WRITE_MODE;

    Can not write "((CLK_Obj *)myClk)->CLKCTL |= CLK_CLKCTL_OSCCLKSRCSEL_BITS;", the first bit in CLKCTL will not for one.

    I believe it is falt of oscillator. I will see if I can get a better signal.

    Thank you.

    Danilo.