25 #include "periph_cpu.h"
36 static const clock_config_t clock_config = {
44 .clkdiv1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(0) |
45 SIM_CLKDIV1_OUTDIV4(1),
47 .osc32ksel = SIM_SOPT1_OSC32KSEL(2),
50 KINETIS_CLOCK_RTCOSC_EN |
51 KINETIS_CLOCK_USE_FAST_IRC |
53 .default_mode = KINETIS_MCG_MODE_PEE,
55 .erc_range = KINETIS_MCG_ERC_RANGE_HIGH,
57 .oscsel = MCG_C7_OSCSEL(0),
58 .fcrdiv = MCG_SC_FCRDIV(0),
59 .fll_frdiv = MCG_C1_FRDIV(0b010),
60 .fll_factor_fei = KINETIS_MCG_FLL_FACTOR_1464,
61 .fll_factor_fee = KINETIS_MCG_FLL_FACTOR_1280,
62 .pll_prdiv = MCG_C5_PRDIV0(0b00001),
63 .pll_vdiv = MCG_C6_VDIV0(0b00000),
65 #define CLOCK_CORECLOCK (48000000ul)
66 #define CLOCK_BUSCLOCK (CLOCK_CORECLOCK / 1)
73 #define PIT_NUMOF (2U)
74 #define PIT_CONFIG { \
84 #define LPTMR_NUMOF (0U)
85 #define LPTMR_CONFIG {}
86 #define TIMER_NUMOF ((PIT_NUMOF) + (LPTMR_NUMOF))
88 #define PIT_BASECLOCK (CLOCK_BUSCLOCK)
89 #define PIT_ISR_0 isr_pit1
90 #define PIT_ISR_1 isr_pit3
91 #define LPTMR_ISR_0 isr_lptmr0
101 .freq = CLOCK_BUSCLOCK,
104 .pcr_rx = PORT_PCR_MUX(3),
105 .pcr_tx = PORT_PCR_MUX(3),
106 .irqn = UART2_RX_TX_IRQn,
107 .scgc_addr = &SIM->SCGC4,
108 .scgc_bit = SIM_SCGC4_UART2_SHIFT,
117 .pcr_rx = PORT_PCR_MUX(3),
118 .pcr_tx = PORT_PCR_MUX(3),
119 .irqn = UART0_RX_TX_IRQn,
120 .scgc_addr = &SIM->SCGC4,
121 .scgc_bit = SIM_SCGC4_UART0_SHIFT,
127 #define UART_0_ISR (isr_uart2_rx_tx)
128 #define UART_1_ISR (isr_uart0_rx_tx)
130 #define UART_NUMOF ARRAY_SIZE(uart_config)
146 #define ADC_NUMOF ARRAY_SIZE(adc_config)
152 #define ADC_REF_SETTING 0
173 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
189 SPI_CTAR_PBR(0) | SPI_CTAR_BR(8) |
190 SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(8) |
191 SPI_CTAR_PASC(0) | SPI_CTAR_ASC(8) |
192 SPI_CTAR_PDT(0) | SPI_CTAR_DT(8)
195 SPI_CTAR_PBR(0) | SPI_CTAR_BR(6) |
196 SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(6) |
197 SPI_CTAR_PASC(0) | SPI_CTAR_ASC(6) |
198 SPI_CTAR_PDT(0) | SPI_CTAR_DT(6)
201 SPI_CTAR_PBR(1) | SPI_CTAR_BR(4) |
202 SPI_CTAR_PCSSCK(1) | SPI_CTAR_CSSCK(3) |
203 SPI_CTAR_PASC(1) | SPI_CTAR_ASC(3) |
204 SPI_CTAR_PDT(1) | SPI_CTAR_DT(3)
207 SPI_CTAR_PBR(2) | SPI_CTAR_BR(0) |
208 SPI_CTAR_PCSSCK(2) | SPI_CTAR_CSSCK(0) |
209 SPI_CTAR_PASC(2) | SPI_CTAR_ASC(0) |
210 SPI_CTAR_PDT(2) | SPI_CTAR_DT(0)
213 SPI_CTAR_PBR(1) | SPI_CTAR_BR(0) |
214 SPI_CTAR_PCSSCK(1) | SPI_CTAR_CSSCK(0) |
215 SPI_CTAR_PASC(1) | SPI_CTAR_ASC(0) |
216 SPI_CTAR_PDT(1) | SPI_CTAR_DT(0)
234 .simmask = SIM_SCGC6_SPI0_MASK
249 .simmask = SIM_SCGC6_SPI1_MASK
253 #define SPI_NUMOF ARRAY_SIZE(spi_config)
266 .freq = CLOCK_BUSCLOCK,
269 .scl_pcr = (PORT_PCR_MUX(6) | PORT_PCR_ODE_MASK),
270 .sda_pcr = (PORT_PCR_MUX(6) | PORT_PCR_ODE_MASK),
273 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
274 #define I2C_0_ISR (isr_i2c1)