UM10208_2
© NXP B.V. 2007. All rights reserved.
User manual
Rev. 02 — 1 June 2007
80 of 362
NXP Semiconductors
UM10208
Chapter 7: LPC2800 CGU
/* AHB clock = (1/2) * SYS base clock */
SYSFDCR0 &= ~CGU_FDCR_FDRUN; /* Stop the fractional divider */
SYSFDCR0 = ((SYSFDCR0_MSUB << 11) /* Set MSUB = -n */
| (SYSFDCR0_MADD << 3) /* Set MADD = m - n */
| CGU_FDCR_FDSTRCH /* Enable stretch */
| CGU_FDCR_FDRES); /* Reset fractional divider */
SYSFDCR0 &= ~CGU_FDCR_FDRES; /* Clear reset bit */
SYSFDCR0 |= CGU_FDCR_FDRUN; /* Restart the fractional divider */
/* Setup SYS Fractional Divider #1 for MCI_MCLK, MCI clock of SD/MCI interface */
/* MCI_MCLK, MCI clock for SD/MCI interface = (5/12) * SYS base clock */
SYSFDCR1 &= ~CGU_FDCR_FDRUN; /* Stop the fractional divider */
SYSFDCR1 = ((SYSFDCR1_MSUB << 11) /* Set MSUB = -n */
| (SYSFDCR1_MADD << 3) /* Set MADD = m - n */
| CGU_FDCR_FDSTRCH /* Enable stretch */
| CGU_FDCR_FDRES); /* Reset fractional divider */
SYSFDCR1 &= ~CGU_FDCR_FDRES; /* Clear reset bit */
SYSFDCR1 |= CGU_FDCR_FDRUN; /* Restart the fractional divider */
/* Setup SYS Fractional Divider #3 for LCD_CLK, LCD bus clock of LCD interface */
/* LCD_CLK, LCD bus clock for LCD interface = (1/10) * SYS base clock */
SYSFDCR3 &= ~CGU_FDCR_FDRUN; /* Stop the fractional divider */
SYSFDCR3 = ((SYSFDCR3_MSUB << 11) /* Set MSUB = -n */
| (SYSFDCR3_MADD << 3) /* Set MADD = m - n */
| CGU_FDCR_FDSTRCH /* Enable stretch */
| CGU_FDCR_FDRES); /* Reset fractional divider */
SYSFDCR3 &= ~CGU_FDCR_FDRES; /* Clear reset bit */
SYSFDCR3 |= CGU_FDCR_FDRUN; /* Restart the fractional divider */
/******************************** Spreading stage *************************************/
/* Choose clocks for spreading stages under SYS */
APB0ESR0 = CGU_ESR_FD0; /* Select spreading stage APB0_CLK */
APB1ESR0 = CGU_ESR_FD0; /* Select spreading stage APB1_CLK */
APB2ESR0 = CGU_ESR_FD0; /* Select spreading stage APB2_CLK */
APB3ESR0 = CGU_ESR_FD0; /* Select spreading stage APB3_CLK */
MMIOESR0 = CGU_ESR_FD0; /* Select spreading stage MMIO_HCLK, AHB clock of Interrupt controller */
AHB0ESR = CGU_ESR_FD0; /* Select spreading stage AHB0_CLK */
MCIESR0 = CGU_ESR_FD0; /* Select spreading stage MCI_PCLK, PCLK of SD/MCI interface */
UARTESR0 = CGU_ESR_FD0; /* Select spreading stage UART_PCLK, APB clock of UART */
FLSHESR0 = CGU_ESR_FD0; /* Select spreading stage FLASH_CLK, main clock of flash */
FLSHESR1 = CGU_ESR_FD0; /* Select spreading stage FLASH_TCLK, test clock of flash */
FLSHESR2 = CGU_ESR_FD0; /* Select spreading stage FLASH_PCLK, PCLK of flash */
LCDESR0 = CGU_ESR_FD0; /* Select spreading stage LCD_PCLK, PCLK of LCD interface */
DMAESR0 = CGU_ESR_FD0; /* Select spreading stage DMA_PCLK, PCLK of DMA channels */
DMAESR1 = CGU_ESR_FD0; /* Select spreading stage DMA_GCLK, gated register clock of DMA channels */
USBESR0 = CGU_ESR_FD0; /* Select spreading stage USB_HCLK, AHB clock of USB interface */
CPUESR1 = CGU_ESR_FD0; /* Select spreading stage CPU_PCLK, PCLK of processor */
CPUESR2 = CGU_ESR_FD0; /* Select spreading stage CPU_GCLK, gated HCLK of processor registers */
RAMESR = CGU_ESR_FD0; /* Select spreading stage RAM_CLK, clock of internal RAM */
ROMESR = CGU_ESR_FD0; /* Select spreading stage ROM_CLK, clock of internal ROM */
EMCESR0 = CGU_ESR_FD0; /* Select spreading stage EMC_CLK, external memory controller */