24 #include "periph_cpu.h"
35 static const clock_config_t clock_config = {
43 .clkdiv1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(0) |
44 SIM_CLKDIV1_OUTDIV4(1),
46 .osc32ksel = SIM_SOPT1_OSC32KSEL(2),
49 KINETIS_CLOCK_RTCOSC_EN |
50 KINETIS_CLOCK_USE_FAST_IRC |
52 .default_mode = KINETIS_MCG_MODE_PEE,
54 .erc_range = KINETIS_MCG_ERC_RANGE_HIGH,
56 .oscsel = MCG_C7_OSCSEL(0),
57 .fcrdiv = MCG_SC_FCRDIV(0),
58 .fll_frdiv = MCG_C1_FRDIV(0b010),
59 .fll_factor_fei = KINETIS_MCG_FLL_FACTOR_1464,
60 .fll_factor_fee = KINETIS_MCG_FLL_FACTOR_1280,
61 .pll_prdiv = MCG_C5_PRDIV0(0b00001),
62 .pll_vdiv = MCG_C6_VDIV0(0b00000),
64 #define CLOCK_CORECLOCK (48000000ul)
65 #define CLOCK_BUSCLOCK (CLOCK_CORECLOCK / 1)
72 #define PIT_NUMOF (2U)
73 #define PIT_CONFIG { \
83 #define LPTMR_NUMOF (0U)
84 #define LPTMR_CONFIG {}
85 #define TIMER_NUMOF ((PIT_NUMOF) + (LPTMR_NUMOF))
87 #define PIT_BASECLOCK (CLOCK_BUSCLOCK)
88 #define PIT_ISR_0 isr_pit1
89 #define PIT_ISR_1 isr_pit3
102 .pcr_rx = PORT_PCR_MUX(3),
103 .pcr_tx = PORT_PCR_MUX(3),
104 .irqn = UART2_RX_TX_IRQn,
105 .scgc_addr = &SIM->SCGC4,
106 .scgc_bit = SIM_SCGC4_UART2_SHIFT,
115 .pcr_rx = PORT_PCR_MUX(3),
116 .pcr_tx = PORT_PCR_MUX(3),
117 .irqn = UART0_RX_TX_IRQn,
118 .scgc_addr = &SIM->SCGC4,
119 .scgc_bit = SIM_SCGC4_UART0_SHIFT,
125 #define UART_0_ISR (isr_uart2_rx_tx)
126 #define UART_1_ISR (isr_uart0_rx_tx)
128 #define UART_NUMOF ARRAY_SIZE(uart_config)
144 #define ADC_NUMOF ARRAY_SIZE(adc_config)
150 #define ADC_REF_SETTING 0
171 #define PWM_NUMOF ARRAY_SIZE(pwm_config)
186 SPI_CTAR_PBR(0) | SPI_CTAR_BR(8) |
187 SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(8) |
188 SPI_CTAR_PASC(0) | SPI_CTAR_ASC(8) |
189 SPI_CTAR_PDT(0) | SPI_CTAR_DT(8)
192 SPI_CTAR_PBR(0) | SPI_CTAR_BR(6) |
193 SPI_CTAR_PCSSCK(0) | SPI_CTAR_CSSCK(6) |
194 SPI_CTAR_PASC(0) | SPI_CTAR_ASC(6) |
195 SPI_CTAR_PDT(0) | SPI_CTAR_DT(6)
198 SPI_CTAR_PBR(1) | SPI_CTAR_BR(4) |
199 SPI_CTAR_PCSSCK(1) | SPI_CTAR_CSSCK(3) |
200 SPI_CTAR_PASC(1) | SPI_CTAR_ASC(3) |
201 SPI_CTAR_PDT(1) | SPI_CTAR_DT(3)
204 SPI_CTAR_PBR(2) | SPI_CTAR_BR(0) |
205 SPI_CTAR_PCSSCK(2) | SPI_CTAR_CSSCK(0) |
206 SPI_CTAR_PASC(2) | SPI_CTAR_ASC(0) |
207 SPI_CTAR_PDT(2) | SPI_CTAR_DT(0)
210 SPI_CTAR_PBR(1) | SPI_CTAR_BR(0) |
211 SPI_CTAR_PCSSCK(1) | SPI_CTAR_CSSCK(0) |
212 SPI_CTAR_PASC(1) | SPI_CTAR_ASC(0) |
213 SPI_CTAR_PDT(1) | SPI_CTAR_DT(0)
231 .simmask = SIM_SCGC6_SPI0_MASK
246 .simmask = SIM_SCGC6_SPI1_MASK
250 #define SPI_NUMOF ARRAY_SIZE(spi_config)
265 .scl_pcr = (PORT_PCR_MUX(6) | PORT_PCR_ODE_MASK),
266 .sda_pcr = (PORT_PCR_MUX(6) | PORT_PCR_ODE_MASK),
269 #define I2C_NUMOF ARRAY_SIZE(i2c_config)
270 #define I2C_0_ISR (isr_i2c1)
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
static const uart_conf_t uart_config[]
UART configuration.
static const spi_conf_t spi_config[]
SPI configuration.
static const i2c_conf_t i2c_config[]
I2C configuration.
static const adc_conf_t adc_config[]
ADC configuration.
static const pwm_conf_t pwm_config[]
Actual PWM configuration.
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 UART0
UART0 register bank.
#define CLOCK_BUSCLOCK
Bus clock frequency, used by several hardware modules in Kinetis CPUs.
#define CLOCK_CORECLOCK
System core clock in Hz.
@ I2C_SPEED_FAST
fast mode: ~400 kbit/s
@ KINETIS_UART
Kinetis UART 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.
I2C configuration structure.
I2C_Type * i2c
Pointer to hardware module registers.
gpio_t pin
GPIO pin mapped to this channel.
PWM device configuration.
pwm_chan_t chan[TIMER_CHANNEL_NUMOF]
channel mapping set to {GPIO_UNDEF, 0} if not 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