Other Parts Discussed in Thread: LAUNCHXL-F28379D, TMDSCNCD28379D, C2000WARE
Hello Experts,
We have been working on LAUNCHXL-F28379D and TMDSCNCD28379D control card for all our development. The launchpad uses 10 MHz crystal and the control card uses 20 MHz crystal.
We now plan to use a 20 MHz single ended clock for our production piece.
Looking into some of the C2000WARE driverlib examples we see the following:
In device.c we have the 'SysCtl_setClock()' function for setting up the PLL
//
// Set up PLL control and clock dividers
//
SysCtl_setClock(DEVICE_SETCLOCK_CFG);
DEVICE_SETCLOCK_CFG is defined in device.h
//*****************************************************************************
//
// Defines related to clock configuration
//
//*****************************************************************************
//
// Launchpad Configuration
//
#ifdef _LAUNCHXL_F28379D
//
// 10MHz XTAL on LaunchPad. For use with SysCtl_getClock().
//
#define DEVICE_OSCSRC_FREQ 10000000U
//
// Define to pass to SysCtl_setClock(). Will configure the clock as follows:
// PLLSYSCLK = 10MHz (XTAL_OSC) * 40 (IMULT) * 1 (FMULT) / 2 (PLLCLK_BY_2)
//
#define DEVICE_SETCLOCK_CFG (SYSCTL_OSCSRC_XTAL | SYSCTL_IMULT(40) | \
SYSCTL_FMULT_NONE | SYSCTL_SYSDIV(2) | \
SYSCTL_PLL_ENABLE)
//
// 200MHz SYSCLK frequency based on the above DEVICE_SETCLOCK_CFG. Update the
// code below if a different clock configuration is used!
//
#define DEVICE_SYSCLK_FREQ ((DEVICE_OSCSRC_FREQ * 40 * 1) / 2)
//
// ControlCARD Configuration
//
#else
//
// 20MHz XTAL on controlCARD. For use with SysCtl_getClock().
//
#define DEVICE_OSCSRC_FREQ 20000000U
//
// Define to pass to SysCtl_setClock(). Will configure the clock as follows:
// PLLSYSCLK = 20MHz (XTAL_OSC) * 20 (IMULT) * 1 (FMULT) / 2 (PLLCLK_BY_2)
//
#define DEVICE_SETCLOCK_CFG (SYSCTL_OSCSRC_XTAL | SYSCTL_IMULT(20) | \
SYSCTL_FMULT_NONE | SYSCTL_SYSDIV(2) | \
SYSCTL_PLL_ENABLE)
//
// 200MHz SYSCLK frequency based on the above DEVICE_SETCLOCK_CFG. Update the
// code below if a different clock configuration is used!
//
#define DEVICE_SYSCLK_FREQ ((DEVICE_OSCSRC_FREQ * 20 * 1) / 2)
#endif
And SYSCTL_OSCSRC_XTAL is defined in 'sysctl.h'
// // Oscillator source // // Also used with the SysCtl_selectOscSource(), SysCtl_turnOnOsc(), // and SysCtl_turnOffOsc() functions as the oscSource parameter. // #define SYSCTL_OSCSRC_M 0x00030000U // Mask for OSCSRC value in config #define SYSCTL_OSCSRC_S 16U // Shift for OSCSRC value in config //! Internal oscillator INTOSC2 #define SYSCTL_OSCSRC_OSC2 0x00000000U //! External oscillator (XTAL) in crystal mode #define SYSCTL_OSCSRC_XTAL 0x00010000U //! Internal oscillator INTOSC1 #define SYSCTL_OSCSRC_OSC1 0x00020000U // // Enable/disable PLL // #define SYSCTL_PLL_ENABLE 0x80000000U //!< Enable PLL #define SYSCTL_PLL_DISABLE 0x00000000U //!< Disable PLL
Now if I want to use a single ended clock if I just add a new #define and increment the Mask, would that be sufficient:
// // Oscillator source // // Also used with the SysCtl_selectOscSource(), SysCtl_turnOnOsc(), // and SysCtl_turnOffOsc() functions as the oscSource parameter. // #define SYSCTL_OSCSRC_M 0x00040000U // Mask for OSCSRC value in config changed from 0x00030000U to 0x00040000U #define SYSCTL_OSCSRC_S 16U // Shift for OSCSRC value in config //! Internal oscillator INTOSC2 #define SYSCTL_OSCSRC_OSC2 0x00000000U //! External oscillator (XTAL) in crystal mode #define SYSCTL_OSCSRC_XTAL 0x00010000U //! Internal oscillator INTOSC1 #define SYSCTL_OSCSRC_OSC1 0x00020000U #define SYSCTL_OSCSRC_XTAL_S 0x00030000U //Newly added
and SYSCTL_OSCSRC_XTAL_S is added to DEVICE_SETCLOCK_CFG:
#define DEVICE_SETCLOCK_CFG (SYSCTL_OSCSRC_XTAL_S | SYSCTL_IMULT(20) | \
SYSCTL_FMULT_NONE | SYSCTL_SYSDIV(2) | \
SYSCTL_PLL_ENABLE)
Thanks!
