2019-08-13 18:08:49 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* boards/arm/kl/teensy-lc/include/board.h
|
2015-05-07 15:06:50 +02:00
|
|
|
*
|
2021-03-17 18:14:12 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2015-05-07 15:06:50 +02:00
|
|
|
*
|
2021-03-17 18:14:12 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-05-07 15:06:50 +02:00
|
|
|
*
|
2021-03-17 18:14:12 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2015-05-07 15:06:50 +02:00
|
|
|
*
|
2019-08-13 18:08:49 +02:00
|
|
|
****************************************************************************/
|
2015-05-07 15:06:50 +02:00
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
#ifndef __BOARDS_ARM_KL_TEENSY_LC_INCLUDE_BOARD_H
|
|
|
|
#define __BOARDS_ARM_KL_TEENSY_LC_INCLUDE_BOARD_H
|
2015-05-07 15:06:50 +02:00
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/****************************************************************************
|
2015-05-07 15:06:50 +02:00
|
|
|
* Included Files
|
2019-08-13 18:08:49 +02:00
|
|
|
****************************************************************************/
|
2015-05-07 15:06:50 +02:00
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
# include <stdint.h>
|
|
|
|
#endif
|
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/****************************************************************************
|
2015-05-07 15:06:50 +02:00
|
|
|
* Pre-processor Definitions
|
2019-08-13 18:08:49 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Clocking *****************************************************************/
|
2015-05-07 15:06:50 +02:00
|
|
|
|
|
|
|
/* The board has a 16MHz crystal. */
|
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
#undef BOARD_EXTCLOCK /* Crystal */
|
|
|
|
#define BOARD_XTAL_FREQ 16000000 /* 16 MHz crystal frequency (REFCLK) */
|
2015-05-07 15:06:50 +02:00
|
|
|
|
|
|
|
/* PLL Configuration.
|
|
|
|
*
|
|
|
|
* PLL Input frequency: PLLIN = REFCLK / PRDIV0 = 16MHz / 4 = 4 MHz
|
|
|
|
* PLL Output frequency: PLLOUT = PLLIN * VDIV0 = 4Mhz * 24 = 96 MHz
|
|
|
|
* MCGPLLCLK Frequency: MCGPLLCLK = 96MHz
|
|
|
|
*/
|
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
#define BOARD_PRDIV0 4 /* PLL External Reference Divider */
|
|
|
|
#define BOARD_VDIV0 24 /* PLL VCO Divider (frequency multiplier) */
|
2015-05-07 15:06:50 +02:00
|
|
|
|
|
|
|
#define BOARD_PLLIN_FREQ (BOARD_XTAL_FREQ / BOARD_PRDIV0)
|
|
|
|
#define BOARD_PLLOUT_FREQ (BOARD_PLLIN_FREQ * BOARD_VDIV0)
|
|
|
|
#define BOARD_MCGPLLCLK_FREQ BOARD_PLLOUT_FREQ
|
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/* MCGOUTCLK:
|
|
|
|
* MCG output of either IRC, MCGFLLCLK, MCGPLLCLK, or MCG's external
|
2015-05-07 15:06:50 +02:00
|
|
|
* reference clock that sources the core, system, bus, and flash clock.
|
|
|
|
*
|
|
|
|
* MCGOUTCLK = MCGPLLCLK = 96MHz
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define BOARD_MCGOUTCLK_FREQ BOARD_MCGPLLCLK_FREQ
|
|
|
|
|
|
|
|
/* SIM CLKDIV1 dividers.
|
|
|
|
*
|
|
|
|
* Core/system clock
|
|
|
|
* MCGOUTCLK divided by OUTDIV1, clocks the ARM Cortex-M0+ core
|
|
|
|
*
|
|
|
|
* Bus clock
|
|
|
|
* System clock divided by OUTDIV4, clocks the bus slaves and peripherals.
|
|
|
|
*/
|
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
#define BOARD_OUTDIV1 2 /* Core/system = MCGOUTCLK / 2 = 48 MHz */
|
|
|
|
#define BOARD_OUTDIV4 2 /* Bus clock = System clock / 2 = 24 MHz */
|
2015-05-07 15:06:50 +02:00
|
|
|
|
|
|
|
#define BOARD_CORECLK_FREQ (BOARD_MCGOUTCLK_FREQ / BOARD_OUTDIV1)
|
|
|
|
#define BOARD_BUSCLK_FREQ (BOARD_CORECLK_FREQ / BOARD_OUTDIV4)
|
|
|
|
|
|
|
|
/* PWM Configuration */
|
2019-08-13 18:08:49 +02:00
|
|
|
|
2015-05-07 15:06:50 +02:00
|
|
|
/* TPM0 Channels */
|
|
|
|
|
|
|
|
#define GPIO_TPM0_CH0OUT PIN_TPM0_CH0_2 // Pin 22: PTC1
|
|
|
|
#define GPIO_TPM0_CH1OUT PIN_TPM0_CH1_2 // Pin 23: PTC2
|
|
|
|
#define GPIO_TPM0_CH2OUT PIN_TPM0_CH2_2 // Pin 9: PTC3
|
|
|
|
#define GPIO_TPM0_CH3OUT PIN_TPM0_CH3_1 // Pin 10: PTC4
|
|
|
|
#define GPIO_TPM0_CH4OUT PIN_TPM0_CH4_2 // Pin 6: PTD4
|
|
|
|
#define GPIO_TPM0_CH5OUT PIN_TPM0_CH5_3 // Pin 20: PTD5
|
|
|
|
|
|
|
|
/* TPM1 Channels */
|
|
|
|
|
|
|
|
#define GPIO_TPM1_CH0OUT PIN_TPM1_CH0_2 // Pin 16: PTB0
|
|
|
|
#define GPIO_TPM1_CH1OUT PIN_TPM1_CH1_2 // Pin 17: PTB1
|
|
|
|
|
|
|
|
/* TPM2 Channels */
|
|
|
|
|
|
|
|
#define GPIO_TPM2_CH0OUT PIN_TPM2_CH0_1 // Pin 3: PTA1
|
|
|
|
#define GPIO_TPM2_CH1OUT PIN_TPM2_CH1_1 // Pin 4: PTA2
|
|
|
|
|
2019-08-13 18:08:49 +02:00
|
|
|
/* LED definitions **********************************************************/
|
|
|
|
|
2015-05-07 15:06:50 +02:00
|
|
|
/* The Teensy LC has a single LED. */
|
2019-08-13 18:08:49 +02:00
|
|
|
|
2015-05-07 15:06:50 +02:00
|
|
|
#define LED_STARTED 0 /* LED off */
|
|
|
|
#define LED_HEAPALLOCATE 0 /* LED off */
|
|
|
|
#define LED_IRQSENABLED 0 /* LED off */
|
|
|
|
#define LED_STACKCREATED 1 /* LED on */
|
|
|
|
#define LED_INIRQ 2 /* LED no change */
|
|
|
|
#define LED_SIGNAL 2 /* LED no change */
|
|
|
|
#define LED_ASSERTION 2 /* LED no change */
|
|
|
|
#define LED_PANIC 3 /* LED flashing */
|
|
|
|
|
|
|
|
/* SPI0 Pinout
|
|
|
|
* ===========
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Note that the Teensy maps SCK0 to pin 13 which conflicts with the
|
2019-08-13 18:08:49 +02:00
|
|
|
* LED. Use pin 14 instead.
|
|
|
|
*/
|
|
|
|
|
2015-05-07 15:06:50 +02:00
|
|
|
#define PIN_SPI0_SCK (PIN_SPI0_SCK_3 | PIN_ALT2_PULLUP) // Pin 14: PTD1
|
|
|
|
#define PIN_SPI0_MISO (PIN_SPI0_MISO_4 | PIN_ALT2_PULLUP) // Pin 12: PTC7
|
|
|
|
#define PIN_SPI0_MOSI (PIN_SPI0_MOSI_3 | PIN_ALT2_PULLUP) // Pin 11: PTC6
|
|
|
|
|
|
|
|
#define PIN_SPI1_SCK (PIN_SPI1_SCK_2 | PIN_ALT2_PULLUP) // Pin 20: PTD5
|
|
|
|
#define PIN_SPI1_MISO (PIN_SPI1_MISO_2 | PIN_ALT2_PULLUP) // Pin 1: PTB17
|
|
|
|
#define PIN_SPI1_MOSI (PIN_SPI0_MOSI_1 | PIN_ALT2_PULLUP) // Pin 0: PTB16
|
|
|
|
|
2020-01-31 19:07:39 +01:00
|
|
|
#endif /* __BOARDS_ARM_KL_TEENSY_LC_INCLUDE_BOARD_H */
|