23 #include "periph_cpu.h"
34 static 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)
89 #define PIT_NUMOF (1U)
90 #define PIT_CONFIG { \
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,
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)
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)
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