2 ChibiOS - (C) 2015-2016 flabbergast <s3+flabbergast@sdfeu.org>
\r
4 Licensed under the Apache License, Version 2.0 (the "License");
\r
5 you may not use this file except in compliance with the License.
\r
6 You may obtain a copy of the License at
\r
8 http://www.apache.org/licenses/LICENSE-2.0
\r
10 Unless required by applicable law or agreed to in writing, software
\r
11 distributed under the License is distributed on an "AS IS" BASIS,
\r
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 See the License for the specific language governing permissions and
\r
14 limitations under the License.
\r
20 #define KL2x_MCUCONF
\r
23 * HAL driver system settings.
\r
26 /* High-frequency internal RC, 48MHz, possible USB clock recovery */
\r
27 #define KINETIS_MCGLITE_MODE KINETIS_MCGLITE_MODE_HIRC
\r
28 #define KINETIS_SYSCLK_FREQUENCY 48000000UL
\r
29 #define KINETIS_CLKDIV1_OUTDIV1 1
\r
33 /* Low-frequency internal RC, 8 MHz mode */
\r
34 #define KINETIS_MCGLITE_MODE KINETIS_MCGLITE_MODE_LIRC8M
\r
35 #define KINETIS_SYSCLK_FREQUENCY 8000000UL
\r
36 #define KINETIS_CLKDIV1_OUTDIV1 1
\r
40 * SERIAL driver system settings.
\r
42 #define KINETIS_SERIAL_USE_UART0 TRUE
\r
45 * USB driver settings
\r
47 #define KINETIS_USB_USE_USB0 TRUE
\r
48 /* need to redefine this, since the default is for K20x */
\r
49 #define KINETIS_USB_USB0_IRQ_PRIORITY 2
\r
52 * Kinetis FOPT configuration byte
\r
55 #define KINETIS_NV_FOPT_BYTE 0x39
\r
56 #define KINETIS_NV_FSEC_BYTE 0x7E
\r
57 /* NV_FOPT: bit7-6/BOOTSRC_SEL=0b00 (11=from ROM; 00=from FLASH)
\r
58 bit5/FAST_INIT=1, bit4/LPBOOT1=1,
\r
59 bit3/RESET_PIN_CFG=1, bit2/NMI_DIS=1,
\r
60 bit1/BOOTPIN_OPT=0, bit0/LPBOOT0=1 */
\r
61 /* BOOTPIN_OPT: 1=boot depends on BOOTSRC_SEL
\r
62 0=boot samples BOOTCFG0=NMI pin */
\r
63 /* Boot sequence, page 88 of manual:
\r
64 * - If the NMI/BOOTCFG0 input is high or the NMI function is disabled in FTFA_FOPT, the CPU begins execution at the PC location.
\r
65 * - If the NMI/BOOTCFG0 input is low, the NMI function is enabled in FTFA_FOPT, and FTFA_FOPT[BOOTPIN_OPT] = 1, this results in an NMI interrupt. The processor executes an Exception Entry and reads the NMI interrupt handler address from vector-table offset 8. The CPU begins execution at the NMI interrupt handler.
\r
66 * - When FTFA_FOPT[BOOTPIN_OPT] = 0, it forces boot from ROM if NMI/BOOTCFG0 pin set to 0.
\r
68 * Observed behaviour:
\r
69 * - when BOOTPIN_OPT=0, BOOTSRC_SEL still matters:
\r
70 * - if 0b11 (from ROM), it still boots from ROM, even if BOOTCFG0 pin
\r
71 * is high/floating, but leaves ROM and runs user app after
\r
73 * - if 0b00 (from FLASH), reset/powerup jumps to user app unless
\r
74 * BOOTCFG0 pin is asserted.
\r
75 * - in any case, reset when in bootloader induces the 5 second delay
\r
76 * before starting the user app.
\r
80 #endif /* _MCUCONF_H_ */
\r