Go to the documentation of this file.
33 #ifndef _PORT_LPC2XXX_PLLCLK_H_
34 #define _PORT_LPC2XXX_PLLCLK_H_ 1
47 #include "bsp_board_def.h"
53 #define IRC_OSC_HZ (4000000UL)
56 #define RTC_CLK_HZ (32768U)
58 #define CLKSRCSEL_IRC 0
59 #define CLKSRCSEL_XTAL 1
60 #define CLKSRCSEL_RTC 2
63 #define CLKSRCSEL_Val CLKSRCSEL_XTAL
64 #warning "by default internal oscillator is used IRC please define CLKSRCSEL_Val"
67 #define CLKSRCSEL_Val_0 IRC_OSC_HZ
68 #define CLKSRCSEL_Val_1 XTAL_HZ
69 #define CLKSRCSEL_Val_2 RTC_CLK_HZ
71 #define CLKSRCSEL_concat2(a,b) a##b
72 #define CLKSRCSEL_concat(a,b) CLKSRCSEL_concat2(CLKSRCSEL_Val_,b)
88 #define F_OSC_HZ CLKSRCSEL_concat(,CLKSRCSEL_Val)
91 #error "please define source of frequency (F_OSC_HZ) by CLKSRCSEL_Val!!! may be you should do it in bsp_board_def.h or -DCLKSRCSEL_Val=IRC_OSC_HZ"
94 #error "please define PLL_MValue -- value to PLLCFG!!!"
109 #define F_CCO_HZ (2 * (PLL_MValue + 1) * F_OSC_HZ)/(PLL_NValue + 1)
110 #define F_CCLK_HZ (F_CCO_HZ/(CCLKCFG_Val + 1))
111 #define F_USBCLK_HZ (F_CCO_HZ/(USBCLKCFG_Val + 1))
113 #if (F_CCO_HZ > 550000000UL)
114 #error "F_CCO_HZ is to hight"
116 #if (F_CCO_HZ < 275000000UL)
122 #define F_CCLK_HZ ((PLL_MValue + 1) * F_OSC_HZ)
123 #define F_CCO_HZ (2 * (1 << PLL_PValue) * F_CCLK_HZ)
125 #if (F_CCO_HZ > 320000000UL)
126 #error "F_CCO_HZ is to hight"
128 #if (F_CCO_HZ < 156000000UL)
129 #error "F_CCO_HZ is to low"
133 #if ((F_USBCLK_HZ % 48000000) != 0)
134 #warning F_USBCLK_HZ is not devided by 48000000