ISSDK  1.7
IoT Sensing Software Development Kit
frdm_kl25z.h
Go to the documentation of this file.
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2016, Freescale Semiconductor, Inc.
4  * Copyright 2016-2017 NXP
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without modification,
8  * are permitted (subject to the limitations in the disclaimer below) provided
9  * that the following conditions are met:
10  *
11  * o Redistributions of source code must retain the above copyright notice, this list
12  * of conditions and the following disclaimer.
13  *
14  * o Redistributions in binary form must reproduce the above copyright notice, this
15  * list of conditions and the following disclaimer in the documentation and/or
16  * other materials provided with the distribution.
17  *
18  * o Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 /**
36  * @file frdm_kl25z.h
37  * @brief The frdm_kl25z.h file defines GPIO pin mappings for FRDM-KL25Z board
38  */
39 
40 #ifndef FRDM_KL25Z_H_
41 #define FRDM_KL25Z_H_
42 
43 #include "pin_mux.h"
44 #include "fsl_smc.h"
45 #include "MKL25Z4.h"
46 #include "RTE_Device.h"
47 #include "gpio_driver.h"
48 
49 // I2C0 Pin Handles
50 extern gpioHandleKSDK_t D15;
51 extern gpioHandleKSDK_t D14;
52 
53 // I2C1 Handle
54 extern gpioHandleKSDK_t A5;
55 extern gpioHandleKSDK_t A4;
56 
57 // SPI0 Handle
58 extern gpioHandleKSDK_t D13;
59 extern gpioHandleKSDK_t D11;
60 extern gpioHandleKSDK_t D12;
61 
62 // UART0 Handle
63 extern gpioHandleKSDK_t D0;
64 extern gpioHandleKSDK_t D1;
65 
66 // FRDM-KL25Z Arduino Connector Pin Defintion
67 extern gpioHandleKSDK_t A1;
68 extern gpioHandleKSDK_t A2;
69 extern gpioHandleKSDK_t A3;
70 extern gpioHandleKSDK_t D2;
71 extern gpioHandleKSDK_t D4;
72 extern gpioHandleKSDK_t D5;
73 extern gpioHandleKSDK_t D6;
74 extern gpioHandleKSDK_t D7;
75 extern gpioHandleKSDK_t D8;
76 extern gpioHandleKSDK_t D9;
77 extern gpioHandleKSDK_t D10;
78 
81 extern gpioHandleKSDK_t INT1;
82 extern gpioHandleKSDK_t INT2;
83 
84 // FRDM-KL25Z Internal Peripheral Pin Definitions
88 
89 // I2C_S1: Pin mapping and driver information for default I2C brought to shield
90 #define I2C_S1_SCL_PIN A5
91 #define I2C_S1_SDA_PIN A4
92 #define I2C_S1_DRIVER Driver_I2C1
93 #define I2C_S1_DEVICE_INDEX I2C1_INDEX
94 #define I2C_S1_SIGNAL_EVENT I2C1_SignalEvent_t
95 
96 // I2C_S2: Pin mapping and driver information for alternate I2C bus on shield
97 #define I2C_S2_SCL_PIN D15
98 #define I2C_S2_SDA_PIN D14
99 #define I2C_S2_DRIVER Driver_I2C0
100 #define I2C_S2_DEVICE_INDEX I2C0_INDEX
101 #define I2C_S2_SIGNAL_EVENT I2C0_SignalEvent_t
102 
103 // I2C_BB: PPin mapping and driver information for I2C routed on KL25Z base board
104 #define I2C_BB_SCL_PIN ACCEL_SCL
105 #define I2C_BB_SDA_PIN ACCEL_SDA
106 #define I2C_BB_DRIVER Driver_I2C0
107 #define I2C_BB_DEVICE_INDEX I2C0_INDEX
108 #define I2C_BB_SIGNAL_EVENT I2C0_SignalEvent_t
109 
110 // SPIS: Pin mapping and driver information default SPI brought to shield
111 #define SPI_S_SCLK D13
112 #define SPI_S_MOSI D11
113 #define SPI_S_MISO D12
114 #define SPI_S_DRIVER Driver_SPI0
115 #define SPI_S_BAUDRATE 500000U ///< Transfer baudrate - 500k
116 #define SPI_S_DEVICE_INDEX SPI0_INDEX
117 #define SPI_S_SIGNAL_EVENT SPI0_SignalEvent_t
118 
119 // UART: Driver information for default UART to communicate with HOST PC.
120 #define HOST_S_DRIVER Driver_USART0
121 #define HOST_S_SIGNAL_EVENT HOST_SignalEvent_t
122 
123 // Bluetooth: Driver information for default UART to communicate with HOST PC.
124 #define HOST_B_DRIVER Driver_USART0
125 #define HOST_B_SIGNAL_EVENT HOST_SignalEvent_t
126 
127 // On-Board MMA8451 Sensor Information
128 #define MMA845x_I2C_ADDR 0x1D
129 #define MMA845x_INT1 INT1
130 #define MMA845x_INT2 INT2
131 
132 /* @brief Ask use input to resume after specified samples have been processed. */
133 #define ASK_USER_TO_RESUME(x) \
134  static volatile bool askResume = true; \
135  static uint16_t samplesToProcess = x - 1; \
136  if (askResume && !samplesToProcess--) \
137  { \
138  PRINTF("\r\n Specified samples processed, press any key to continue... \r\n"); \
139  GETCHAR(); \
140  askResume = false; \
141  }
142 
143 // Sensor Fusion Required Definitions
144 ///@{
145 // Control UART Parameters
146 // use control_lpsci.c instead of control.c for the KL25Z sensor fusion projects.
147 #define CONTROL_UART UART0 ///< KSDK instance name for the debug UART
148 #define CONTROL_UART_PORT_CLKEN kCLOCK_PortA ///< KDSK handle for the pin port clock enable
149 #define CONTROL_UART_PORT PORTA ///< KDSK handle for the pin port associated with this UART
150 #define CONTROL_UART_RX_PIN PIN1_IDX ///< The port number associated with RX
151 #define CONTROL_UART_TX_PIN PIN2_IDX ///< The port number associated with TX
152 #define CONTROL_UART_MUX kPORT_MuxAlt2 ///< KDSK pin mux selector
153 #define CONTROL_UART_IRQHandler UART0_IRQHandler ///< KDSK-specified IRQ handler name
154 #define CONTROL_UART_CLKSRC kCLOCK_CoreSysClk ///< KSDK instance name for the clock feeding this module
155 #define CONTROL_UART_IRQn UART0_IRQn ///< KSDK interrupt vector number
156 // Override default PIT instance name
157 #define PIT_LED_HANDLER PIT_IRQHandler
158 #define PIT_IRQ_ID PIT_IRQn
159 
160 // Miscellaneous Hardware Configuration Parameters
161 #define THIS_BOARD 1 ///< FRDM_KL25Z
162 #define CORE_SYSTICK_HZ 48000000 ///< core and systick clock rate (Hz)
163 #define CALIBRATION_NVM_ADDR 0x0001FC00 ///< start of final 1K (sector size) of 128K flash
164 #define ADS_NVM_ADDR 0x0001F800 ///< start of the next to last 1KB (sector size) of the 128K flash
165 #define FLASH_SECTOR_SIZE_PROPERTY kFLASH_PropertyPflashSectorSize
166 #define FLASH_ERASE_KEY kFLASH_ApiEraseKey
167 
168 // offsets from start of NVM block for calibration coefficients
169 #define MAG_NVM_OFFSET 0 // 68 bytes used
170 #define GYRO_NVM_OFFSET 100 // 16 bytes used
171 #define ACCEL_NVM_OFFSET 140 // 88 bytes used
172 ///@}
173 
174 #endif /* FRDM_KL25Z_H_ */
gpioHandleKSDK_t D13
Definition: frdm_k64f.c:75
gpioHandleKSDK_t BLUE_LED
Definition: frdm_k64f.c:221
gpioHandleKSDK_t D4
Definition: frdm_k64f.c:156
gpioHandleKSDK_t D6
Definition: frdm_k64f.c:170
gpioHandleKSDK_t A4
Definition: frdm_k64f.c:66
gpioHandleKSDK_t D2
Definition: frdm_k64f.c:142
The GPIO pin handle for KSDK.
Definition: gpio_driver.h:75
gpioHandleKSDK_t D7
Definition: frdm_k64f.c:177
gpioHandleKSDK_t D11
Definition: frdm_k64f.c:82
gpioHandleKSDK_t D0
Definition: frdm_k64f.c:98
gpioHandleKSDK_t D14
Definition: frdm_k64f.c:50
gpioHandleKSDK_t RED_LED
Definition: frdm_k64f.c:207
gpioHandleKSDK_t INT1
Definition: frdm_k64f.c:230
gpioHandleKSDK_t A5
Definition: frdm_k64f.c:59
gpioHandleKSDK_t ACCEL_SDA
Definition: frdm_kl25z.c:230
gpioHandleKSDK_t D5
Definition: frdm_k64f.c:163
gpioHandleKSDK_t A3
Definition: frdm_k64f.c:135
gpioHandleKSDK_t A1
Definition: frdm_k64f.c:121
gpioHandleKSDK_t D15
Definition: frdm_k64f.c:43
gpioHandleKSDK_t D10
Definition: frdm_k64f.c:198
gpioHandleKSDK_t D12
Definition: frdm_k64f.c:89
gpioHandleKSDK_t GREEN_LED
Definition: frdm_k64f.c:214
gpioHandleKSDK_t INT2
Definition: frdm_k64f.c:237
gpioHandleKSDK_t D9
Definition: frdm_k64f.c:191
gpioHandleKSDK_t D1
Definition: frdm_k64f.c:105
gpioHandleKSDK_t D8
Definition: frdm_k64f.c:184
gpioHandleKSDK_t ACCEL_SCL
Definition: frdm_kl25z.c:223
gpioHandleKSDK_t A2
Definition: frdm_k64f.c:128