22#include "periph_cpu.h"
33static const clock_config_t clock_config = {
42 .clkdiv1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV4(1),
43 .rtc_clc = RTC_CR_SC16P_MASK | RTC_CR_SC4P_MASK | RTC_CR_SC2P_MASK,
48 .osc32ksel = SIM_SOPT1_OSC32KSEL(0),
52 KINETIS_CLOCK_OSC0_EN |
53 KINETIS_CLOCK_RTCOSC_EN |
54 KINETIS_CLOCK_USE_FAST_IRC |
55 KINETIS_CLOCK_MCGIRCLK_EN |
56 KINETIS_CLOCK_MCGIRCLK_STOP_EN |
61 .default_mode = KINETIS_MCG_MODE_FEI,
64 .erc_range = KINETIS_MCG_ERC_RANGE_VERY_HIGH,
67 .oscsel = MCG_C7_OSCSEL(0),
68 .fcrdiv = MCG_SC_FCRDIV(0),
70 .fll_frdiv = MCG_C1_FRDIV(0b101),
71 .fll_factor_fei = KINETIS_MCG_FLL_FACTOR_1464,
72 .fll_factor_fee = KINETIS_MCG_FLL_FACTOR_1280,
75#define CLOCK_RADIOXTAL (32000000ul)
77#define CLOCK_CORECLOCK (48000000ul)
78#define CLOCK_BUSCLOCK (CLOCK_CORECLOCK / 2)
79#define CLOCK_MCGFLLCLK (CLOCK_CORECLOCK)
80#define CLOCK_OSCERCLK (CLOCK_RADIOXTAL)
81#define CLOCK_MCGIRCLK (4000000ul)
95#define LPTMR_NUMOF (1U)
96#define LPTMR_CONFIG { \
99 .base_freq = 32768u, \
101 .irqn = LPTMR0_IRQn, \
104#define TIMER_NUMOF ((PIT_NUMOF) + (LPTMR_NUMOF))
105#define PIT_BASECLOCK (CLOCK_BUSCLOCK)
106#define LPTMR_ISR_0 isr_lptmr0
114#define LPUART_0_SRC 1
117#if (LPUART_0_SRC == 3)
119#define LPUART_0_CLOCK CLOCK_MCGIRCLK
120#define UART_CLOCK_PM_BLOCKER KINETIS_PM_LLS
121#define UART_MAX_UNCLOCKED_BAUDRATE 19200ul
122#elif (LPUART_0_SRC == 2)
123#define LPUART_0_CLOCK CLOCK_OSCERCLK
124#elif (LPUART_0_SRC == 1)
126#define LPUART_0_CLOCK CLOCK_MCGFLLCLK
127#define UART_CLOCK_PM_BLOCKER KINETIS_PM_STOP
128#define UART_MAX_UNCLOCKED_BAUDRATE 57600ul
134 .freq = LPUART_0_CLOCK,
137 .pcr_rx = PORT_PCR_MUX(4) | GPIO_IN_PU,
138 .pcr_tx = PORT_PCR_MUX(4),
139 .irqn = LPUART0_IRQn,
140 .scgc_addr = &SIM->SCGC5,
141 .scgc_bit = SIM_SCGC5_LPUART0_SHIFT,
144#ifdef MODULE_PERIPH_LLWU
145 .llwu_rx = LLWU_WAKEUP_PIN_PTC6,
149#define UART_NUMOF ARRAY_SIZE(uart_config)
150#define LPUART_0_ISR isr_lpuart0
181#define ADC_NUMOF ARRAY_SIZE(adc_config)
188#define ADC_REF_SETTING 1
190#define ADC_REF_VOLTAGE (3.3f)
192#define ADC_REF_VOLTAGE (1.2f)
195#define ADC_TEMPERATURE_CHANNEL (4)
206 .scgc_addr = &SIM->SCGC6,
207 .scgc_bit = SIM_SCGC6_DAC0_SHIFT,
211#define DAC_NUMOF ARRAY_SIZE(dac_config)
218#define HAVE_PWM_MODE_T
220 PWM_LEFT = (TPM_CnSC_MSB_MASK | TPM_CnSC_ELSB_MASK),
228#define PWM_CHAN_MAX (4U)
264#define PWM_NUMOF ARRAY_SIZE(pwm_config)
279 SPI_CTAR_PBR(2) | SPI_CTAR_BR(5) |
280 SPI_CTAR_PCSSCK(2) | SPI_CTAR_CSSCK(4) |
281 SPI_CTAR_PASC(2) | SPI_CTAR_ASC(4) |
282 SPI_CTAR_PDT(2) | SPI_CTAR_DT(4)
285 SPI_CTAR_PBR(2) | SPI_CTAR_BR(3) |
286 SPI_CTAR_PCSSCK(2) | SPI_CTAR_CSSCK(2) |
287 SPI_CTAR_PASC(2) | SPI_CTAR_ASC(2) |
288 SPI_CTAR_PDT(2) | SPI_CTAR_DT(2)
291 SPI_CTAR_PBR(0) | SPI_CTAR_BR(3) |
292 SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(3) |
293 SPI_CTAR_PASC(0) | SPI_CTAR_ASC(3) |
294 SPI_CTAR_PDT(0) | SPI_CTAR_DT(3)
297 SPI_CTAR_PBR(0) | SPI_CTAR_BR(0) |
298 SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(1) |
299 SPI_CTAR_PASC(0) | SPI_CTAR_ASC(1) |
300 SPI_CTAR_PDT(0) | SPI_CTAR_DT(1)
303 SPI_CTAR_PBR(0) | SPI_CTAR_BR(0) |
304 SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(0) |
305 SPI_CTAR_PASC(0) | SPI_CTAR_ASC(0) |
306 SPI_CTAR_PDT(0) | SPI_CTAR_DT(0)
323 .pcr = (gpio_pcr_t)(GPIO_AF_2 | GPIO_IN_PU),
324 .simmask = SIM_SCGC6_SPI0_MASK
328#define SPI_NUMOF ARRAY_SIZE(spi_config)
343 .scl_pcr = (PORT_PCR_MUX(3)),
344 .sda_pcr = (PORT_PCR_MUX(3)),
347#define I2C_NUMOF ARRAY_SIZE(i2c_config)
348#define I2C_0_ISR (isr_i2c1)
355#define KINETIS_TRNG TRNG
#define CLOCK_CORECLOCK
Clock configuration.
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
@ PWM_CENTER
center aligned
#define PWM_CHAN_MAX
PWM configuration structure.
static const spi_clk_conf_t spi_clk_config[]
Pre-calculated clock divider values based on a CLOCK_CORECLOCK (32MHz)
#define SPI_CS_UNDEF
Define value for unused CS line.
#define ADC_AVG_NONE
Disable hardware averaging.
@ KINETIS_LPUART
Kinetis Low-power UART (LPUART) module type.
@ UART_MODE_8N1
8 data bits, no parity, 1 stop bit
#define ADC_AVG_MAX
Maximum hardware averaging (32 samples)
ADC device configuration.
DAC line configuration data.
I2C configuration structure.
PWM device configuration.
uint8_t ftm_chan
the actual FTM channel used
gpio_t pin
GPIO pin used, set to GPIO_UNDEF.
gpio_af_t af
alternate function used
uint8_t tpm_num
FTM number used.
SPI device configuration.
UART device configuration.