AnsweredAssumed Answered

What is the sequence to configure the clocks on BF60x processors

Question asked by gvasanth Employee on Mar 26, 2012

It is recommended to use the SysControl() API to do the CGU configuration. This is defined in "cdefBF609_rom.h" header file.

 

Below is the sample code routine to configure the clocks using the API. Here it is assumed CLKIN to be 25 MHz.  Please see the datasheet for the min/max specifications of the clocks.

 

#include "cdefBF609_rom.h"

#include "cdefBF09.h"

 

/* PLL Multiplier and Divisor Selections (Required Value, Bit Position) */

#define MSEL   ((20 << BITP_CGU_CTL_MSEL)       &  BITM_CGU_CTL_MSEL)  /* PLL Multiplier Select [1-127]: PLLCLK = ((CLKIN x MSEL/DF+1))*/

 

#define CSEL   ((1  << BITP_CGU_DIV_CSEL)         &  BITM_CGU_DIV_CSEL)  /* Core Clock Divisor Select [1-31]: (CLKIN x MSEL/DF+1)/CSEL*/

 

#define SYSSEL ((2  << BITP_CGU_DIV_SYSSEL)  &  BITM_CGU_DIV_SYSSEL)  /* System Clock Divisor Select [1-31]: (CLKIN x MSEL/DF+1)/SYSSEL */

 

#define S0SEL  ((2  << BITP_CGU_DIV_S0SEL)      &  BITM_CGU_DIV_S0SEL)  /* SCLK0 Divisor Select [1-7]: SYSCLK/S0SEL */

 

#define S1SEL  ((2  << BITP_CGU_DIV_S1SEL)      &  BITM_CGU_DIV_S1SEL)  /* SCLK1 Divisor Select [1-7]: SYSLCK/S1SEL*/

 

#define DSEL   ((2  << BITP_CGU_DIV_DSEL)        &  BITM_CGU_DIV_DSEL)  /* DDR Clock Divisor Select [1-31]: (CLKIN x MSEL/DF+1)/DSEL */

 

#define OSEL   ((4  << BITP_CGU_DIV_OSEL)       &   BITM_CGU_DIV_OSEL)  /* OUTCLK Divisor Select [1-127]: (CLKIN x MSEL/DF+1)/OSEL */

 

#define CLKOUT 4   /* 0 = CLKIN; 1 = CCLK0/4; 2 = SYSCLK/2; 3 = SCLK0; 4 = SCLK1; 5 = DCLK/2; 6 = USB PLL; 7 = OUT CLK; 8 = USB CLKIN*/


void Config_CGU()

{

 

STRUCT_ROM_SYSCTRL ConfigValues;

 

ConfigValues.ulCGU_CTL =   MSEL;
ConfigValues.ulCGU_DIV =   OSEL | DSEL | S1SEL | S0SEL | SYSSEL | CSEL;
ConfigValues.ulCGU_CLKOUTSEL =   CLKOUT;

 

rom_SysControl((  BITM_ROM_SYSCTRL_CGU_WRITE   |
                               BITM_ROM_SYSCTRL_CGU_CTL        |
                               BITM_ROM_SYSCTRL_CGU_DIV         |
                               BITM_ROM_SYSCTRL_CGU_CLKOUTSEL),

 

                               &ConfigValues, NULL);

 

/* Update the CLKOUTSEL register directly */

*pREG_CGU0_CLKOUTSEL = CLKOUT;

 

}

Outcomes