projekty/Source/example1/src/config.h

Go to the documentation of this file.
00001 /* 
00002         PLL
00003         
00004    - Main clock F_OSC=14,7MHz @ Olimex LPC-P2119) [limits: 10 MHz to 25 MHz]
00005    - System should run at max. Frequency (60MHz) [limit: max 60 MHz]
00006    - Choose multiplier M=4 
00007      so cclk = M * F_OSC= 4 * 14745000Hz = 58980000 Hz
00008    - MSEL-Bit in PLLCFG (bits 0-4) MSEL = M-1
00009    - F_CCO must be inbetween the limits 156 MHz to 320 MHz
00010      datasheet: F_CCO = F_OSC * M * 2 * P
00011    - choose devider P=2 => F_CCO = 14745000Hz * 4 * 2 * 2
00012      = 235920000 ~=236 MHz
00013    - PSEL0 (Bit5 in PLLCFG) = 1, PSEL1 (Bit6) = 0 (0b01)
00014 */
00015 #define FOSC            24000000
00016 #define PLL_MUL         1
00017 #define MSEL            (PLL_MUL-1)
00018 
00019 // SHAKi
00020 #define CCLK                (FOSC * PLL_MUL) // CPU Clock Freq.
00021 #define PBSD                4           // MUST BE 1, 2, or 4
00022 #define PCLK                (CCLK / PBSD) // Pheripheal Bus Clock Freq.
00023 #define VPBDIV_VALUE  (PBSD & 0x03)     // VPBDIV value
00024 
00025 #define FCCO_MAX      (320000000)       // Max CC Osc Freq.
00026 #define PLL_DIV       4 //(FCCO_MAX / (2 * CCLK)) // PLL Divider
00027 #define FCCO          (FOSC * PLL_MUL * 2 * PLL_DIV) // CC Osc. Freq.
00028 
00029 // Do some value range testing
00030 #if ((FOSC < 10000000) || (FOSC > 25000000))
00031 #error Fosc out of range (10MHz-25MHz)
00032 #error correct and recompile
00033 #endif
00034 
00035 #if ((CCLK < 10000000) || (CCLK > 60000000))
00036 #error cclk out of range (10MHz-60MHz)
00037 #error correct PLL_MUL and recompile
00038 #endif
00039 
00040 #if ((FCCO < 150000000) || (FCCO > 320000000))
00041 #error Fcco out of range (156MHz-320MHz)
00042 #error internal algorithm error
00043 #endif
00044 
00045 #if ((PBSD != 1) && (PBSD != 2) && (PBSD != 4))
00046 #error Pheripheal Bus Speed Divider (PBSD) illegal value (1, 2, or 4)
00047 #endif
00048 
00049 
00050 

Generated on Fri Sep 21 13:41:54 2007 for example1 by  doxygen 1.4.7