CMSIS2000  0.0.7
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
bsp_board_olimex_H2103.h
Go to the documentation of this file.
1 /*
2  * CMSIS2000
3  * CMSIS-like sources for LPC2xxx series MCUs
4  *
5  * (C) Copyright 2011-2012, Dmitriy Cherepanov, All Rights Reserved
6  *
7  * Version: 0.0.7
8  * Date of the Last Update: 2013-03-04
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a copy
11  * of this software and associated documentation files (the "Software"), to
12  * deal in the Software without restriction, including without limitation the
13  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
14  * sell copies of the Software, and to permit persons to whom the Software is
15  * furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be included in
18  * all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26  * IN THE SOFTWARE.
27  *
28  * Do not be lasy! For the latest version see http://irtos.sourceforge.net .
29  *
30  *
31 #*/
32 #ifndef BSP_BOARD_DEF_H
33 #define BSP_BOARD_DEF_H 1
34 
35 #ifndef bsp_board_olimex_H2103
36  #define bsp_board_olimex_H2103 1
37 #endif
38 /*-----------i_ is the i_DENTIFICATION DEFENITIONS --------------------------*/
39 #define i_ARCH ARM7
40 
41 #define i_MCU_FAMILY LPC2xxx
42 
43 #define i_MCU_MODEL 2103
44 
45 #define i_BOARD olimex_H2103
46 
47 #define i_VENDOR olimex
48 
49 #define i_VERSION 0x010000
50 /*----------------------------------------------------------------------------*/
51 #define BSP_BOARD_HAS_UART0 1
52 #define BSP_BOARD_HAS_UART1 1
53 /*----------------------------------------------------------------------------*/
54 /** \brief Setting the Phased Lock Loop (PLL) for Olimex LPC-H2103 14.7456 MHz crystal
55  *
56  * ----------------------------------
57  *
58  * Olimex LPC-H2103 has a 14.7456 mhz crystal
59  *
60  * We'd like the LPC2106 to run at 53.2368 mhz (has to be an even multiple of crystal)
61  *
62  * According to the Philips LPC2106 manual:
63  * M = cclk / Fosc where: M = PLL multiplier (bits 0-4 of PLLCFG)
64  * cclk = 53236800 hz
65  * Fosc = 14745600 hz
66  *
67  * Solving: M = 53236800 / 14745600 = 3.6103515625
68  * M = 4 (round up)
69  *
70  *Note: M - 1 must be entered into bits 0-4 of PLLCFG (assign 3 to these bits)
71  *
72  *
73  * The Current Controlled Oscilator (CCO) must operate in the range 156 mhz to 320 mhz
74  *
75  * According to the Philips LPC2106 manual:
76  * Fcco = cclk * 2 * P where: Fcco = CCO frequency
77  * cclk = 53236800 hz
78  * P = PLL divisor (bits 5-6 of PLLCFG)
79  *
80  * Solving: Fcco = 53236800 * 2 * P
81  * P = 2 (trial value)
82  * Fcco = 53236800 * 2 * 2
83  * Fcc0 = 212947200 hz
84  * (good choice for P since it's within the 156 mhz to 320 mhz range
85  *
86  * From Table 19 (page 48) of Philips LPC2106 manual
87  * P = 2, PLLCFG bits 5-6 = 1 (assign 1 to these bits)
88  *
89  * Finally: PLLCFG = 0 01 00011 = 0x23
90  *
91  * Final note: to load PLLCFG register,
92  * we must use the 0xAA followed 0x55 write sequence to the PLLFEED register
93  * this is done in the short function feed() below
94  **/
95 
96 #define XTAL_HZ 14745600UL
97 /* Fcck = 48Mhz, Fosc = 288Mhz, and USB 48Mhz */
98 /*Fcck = 2 * (PLL_MValue + 1) * F_OSC_HZ)/(PLL_NValue + 1) /(CCLKCFG_Val + 1))
99  Fcck = 2 * 12 * 12 = 288Mhz
100  Fcck = Fosc * (PLL_MValue + 1) = 14,7456 * (3 + 1 ) = 58,9824 Mhz --> useful for UART 57600 baud and etc.
101  Fcco = Fcck * 2 *(1<<PLL_Palue) = 48Mhz FCCO must be in the range of 156 MHz to 320 MHz.
102 */
103 #define PLL_MValue 3
104 #define PLL_PValue 1
105 /*-----------Peripheral clock selsection -------------------------------------*/
106 
107 #define PCLK_DIVIDER 4
108 #endif /*BSP_BOARD_DEF_H*/