23#include "periph_cpu.h"
34static const clock_config_t clock_config = {
43 .clkdiv1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV4(1),
44 .rtc_clc = RTC_CR_SC16P_MASK | RTC_CR_SC4P_MASK | RTC_CR_SC2P_MASK,
49 .osc32ksel = SIM_SOPT1_OSC32KSEL(0),
53 KINETIS_CLOCK_OSC0_EN |
54 KINETIS_CLOCK_RTCOSC_EN |
55 KINETIS_CLOCK_USE_FAST_IRC |
56 KINETIS_CLOCK_MCGIRCLK_EN |
57 KINETIS_CLOCK_MCGIRCLK_STOP_EN |
62 .default_mode = KINETIS_MCG_MODE_FEI,
65 .erc_range = KINETIS_MCG_ERC_RANGE_VERY_HIGH,
68 .oscsel = MCG_C7_OSCSEL(0),
69 .fcrdiv = MCG_SC_FCRDIV(0),
71 .fll_frdiv = MCG_C1_FRDIV(0b101),
72 .fll_factor_fei = KINETIS_MCG_FLL_FACTOR_1464,
73 .fll_factor_fee = KINETIS_MCG_FLL_FACTOR_1280,
76#define CLOCK_RADIOXTAL (32000000ul)
78#define CLOCK_CORECLOCK (48000000ul)
79#define CLOCK_BUSCLOCK (CLOCK_CORECLOCK / 2)
80#define CLOCK_MCGFLLCLK (CLOCK_CORECLOCK)
81#define CLOCK_OSCERCLK (CLOCK_RADIOXTAL)
82#define CLOCK_MCGIRCLK (4000000ul)
96#define LPTMR_NUMOF (1U)
97#define LPTMR_CONFIG { \
100 .base_freq = 32768u, \
102 .irqn = LPTMR0_IRQn, \
105#define TIMER_NUMOF ((PIT_NUMOF) + (LPTMR_NUMOF))
106#define PIT_BASECLOCK (CLOCK_BUSCLOCK)
107#define LPTMR_ISR_0 isr_lptmr0
115#define LPUART_0_SRC 1
118#if (LPUART_0_SRC == 3)
120#define LPUART_0_CLOCK CLOCK_MCGIRCLK
121#define UART_CLOCK_PM_BLOCKER KINETIS_PM_LLS
122#define UART_MAX_UNCLOCKED_BAUDRATE 19200ul
123#elif (LPUART_0_SRC == 2)
124#define LPUART_0_CLOCK CLOCK_OSCERCLK
125#elif (LPUART_0_SRC == 1)
127#define LPUART_0_CLOCK CLOCK_MCGFLLCLK
128#define UART_CLOCK_PM_BLOCKER KINETIS_PM_STOP
129#define UART_MAX_UNCLOCKED_BAUDRATE 57600ul
135 .freq = LPUART_0_CLOCK,
138 .pcr_rx = PORT_PCR_MUX(4) | GPIO_IN_PU,
139 .pcr_tx = PORT_PCR_MUX(4),
140 .irqn = LPUART0_IRQn,
141 .scgc_addr = &SIM->SCGC5,
142 .scgc_bit = SIM_SCGC5_LPUART0_SHIFT,
145#ifdef MODULE_PERIPH_LLWU
146 .llwu_rx = LLWU_WAKEUP_PIN_PTC6,
150#define UART_NUMOF ARRAY_SIZE(uart_config)
151#define LPUART_0_ISR isr_lpuart0
182#define ADC_NUMOF ARRAY_SIZE(adc_config)
189#define ADC_REF_SETTING 1
191#define ADC_REF_VOLTAGE (3.3f)
193#define ADC_REF_VOLTAGE (1.2f)
196#define ADC_TEMPERATURE_CHANNEL (4)
207 .scgc_addr = &SIM->SCGC6,
208 .scgc_bit = SIM_SCGC6_DAC0_SHIFT,
212#define DAC_NUMOF ARRAY_SIZE(dac_config)
219#define HAVE_PWM_MODE_T
221 PWM_LEFT = (TPM_CnSC_MSB_MASK | TPM_CnSC_ELSB_MASK),
229#define PWM_CHAN_MAX (4U)
265#define PWM_NUMOF ARRAY_SIZE(pwm_config)
278static const uint32_t spi_clk_config[] = {
280 SPI_CTAR_PBR(2) | SPI_CTAR_BR(5) |
281 SPI_CTAR_PCSSCK(2) | SPI_CTAR_CSSCK(4) |
282 SPI_CTAR_PASC(2) | SPI_CTAR_ASC(4) |
283 SPI_CTAR_PDT(2) | SPI_CTAR_DT(4)
286 SPI_CTAR_PBR(2) | SPI_CTAR_BR(3) |
287 SPI_CTAR_PCSSCK(2) | SPI_CTAR_CSSCK(2) |
288 SPI_CTAR_PASC(2) | SPI_CTAR_ASC(2) |
289 SPI_CTAR_PDT(2) | SPI_CTAR_DT(2)
292 SPI_CTAR_PBR(0) | SPI_CTAR_BR(3) |
293 SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(3) |
294 SPI_CTAR_PASC(0) | SPI_CTAR_ASC(3) |
295 SPI_CTAR_PDT(0) | SPI_CTAR_DT(3)
298 SPI_CTAR_PBR(0) | SPI_CTAR_BR(0) |
299 SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(1) |
300 SPI_CTAR_PASC(0) | SPI_CTAR_ASC(1) |
301 SPI_CTAR_PDT(0) | SPI_CTAR_DT(1)
304 SPI_CTAR_PBR(0) | SPI_CTAR_BR(0) |
305 SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(0) |
306 SPI_CTAR_PASC(0) | SPI_CTAR_ASC(0) |
307 SPI_CTAR_PDT(0) | SPI_CTAR_DT(0)
324 .pcr = (gpio_pcr_t)(GPIO_AF_2 | GPIO_IN_PU),
325 .simmask = SIM_SCGC6_SPI0_MASK
329#define SPI_NUMOF ARRAY_SIZE(spi_config)
344 .scl_pcr = (PORT_PCR_MUX(3)),
345 .sda_pcr = (PORT_PCR_MUX(3)),
348#define I2C_NUMOF ARRAY_SIZE(i2c_config)
349#define I2C_0_ISR (isr_i2c1)
356#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.
#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.
ADC_TypeDef * dev
ADC device used.
DAC line configuration data.
I2C configuration structure.
I2C_Type * i2c
Pointer to hardware module registers.
PWM device configuration.
uint8_t ftm_chan
the actual FTM channel used
uint8_t af
alternate function mapping
gpio_t pin
GPIO pin used, set to GPIO_UNDEF.
uint8_t tpm_num
FTM number used.
SPI device configuration.
SPI_t * dev
pointer to the used SPI device
UART device configuration.
USART_t * dev
pointer to the used UART device