ISSDK  1.7
IoT Sensing Software Development Kit
frdm_k22f.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 /*! \file frdm_k22f.h
36  \brief The \b frdm_k22f.h file defines GPIO pins for FRDM-K22F board
37 */
38 
39 #ifndef FRDM_K22F_H_
40 #define FRDM_K22F_H_
41 
42 #include "pin_mux.h"
43 #include "fsl_smc.h"
44 #include "MK22F51212.h"
45 #include "RTE_Device.h"
46 #include "gpio_driver.h"
47 
48 // I2C0 Handle
49 extern gpioHandleKSDK_t A5;
50 extern gpioHandleKSDK_t A4;
51 
52 // SPI1 Handle
53 extern gpioHandleKSDK_t D13;
54 extern gpioHandleKSDK_t D11;
55 extern gpioHandleKSDK_t D12;
56 
57 // UART1 Handle
58 extern gpioHandleKSDK_t D14;
59 extern gpioHandleKSDK_t D15;
60 
61 // FRDM-K22F Arduino Connector Pin Defintion
62 extern gpioHandleKSDK_t A0;
63 extern gpioHandleKSDK_t A1;
64 extern gpioHandleKSDK_t A2;
65 extern gpioHandleKSDK_t A3;
66 extern gpioHandleKSDK_t D0;
67 extern gpioHandleKSDK_t D1;
68 extern gpioHandleKSDK_t D2;
69 extern gpioHandleKSDK_t D3;
70 extern gpioHandleKSDK_t D4;
71 extern gpioHandleKSDK_t D5;
72 extern gpioHandleKSDK_t D6;
73 extern gpioHandleKSDK_t D7;
74 extern gpioHandleKSDK_t D8;
75 extern gpioHandleKSDK_t D9;
76 extern gpioHandleKSDK_t D10;
77 
78 // FRDM-K22F RGB LED Pin Definitions
82 extern gpioHandleKSDK_t INT1;
83 extern gpioHandleKSDK_t INT2;
84 
85 // I2C_S1: Pin mapping and driver information for default I2C brought to shield
86 #define I2C_S1_SCL_PIN A5
87 #define I2C_S1_SDA_PIN A4
88 #define I2C_S1_DRIVER Driver_I2C0
89 #define I2C_S1_DEVICE_INDEX I2C0_INDEX
90 #define I2C_S1_SIGNAL_EVENT I2C0_SignalEvent_t
91 
92 // I2C_S2: Pin mapping and driver information for alternate I2C bus on shield
93 // Note : I2C1 cannot be used with UART1 (which is the TGT_MCU Debug UART).
94 #define I2C_S2_SCL_PIN D15
95 #define I2C_S2_SDA_PIN D14
96 #define I2C_S2_DRIVER Driver_I2C1
97 #define I2C_S2_DEVICE_INDEX I2C1_INDEX
98 #define I2C_S2_SIGNAL_EVENT I2C1_SignalEvent_t
99 
100 // I2C_BB: PPin mapping and driver information for I2C routed on K22F base board
101 #define I2C_BB_SCL_PIN A5
102 #define I2C_BB_SDA_PIN A4
103 #define I2C_BB_DRIVER Driver_I2C0
104 #define I2C_BB_DEVICE_INDEX I2C0_INDEX
105 #define I2C_BB_SIGNAL_EVENT I2C0_SignalEvent_t
106 
107 // SPIS: Pin mapping and driver information default SPI brought to shield
108 #define SPI_S_SCLK D13
109 #define SPI_S_MOSI D11
110 #define SPI_S_MISO D12
111 #define SPI_S_DRIVER Driver_SPI1
112 #define SPI_S_BAUDRATE 500000U ///< Transfer baudrate - 500k
113 #define SPI_S_DEVICE_INDEX SPI1_INDEX
114 #define SPI_S_SIGNAL_EVENT SPI1_SignalEvent_t
115 
116 // UART: Driver information for default UART to communicate with HOST PC.
117 #define HOST_S_DRIVER Driver_USART1
118 #define HOST_S_SIGNAL_EVENT HOST_SignalEvent_t
119 
120 // Bluetooth: Driver information for default UART to communicate with HOST PC.
121 #define HOST_B_DRIVER Driver_USART2
122 #define HOST_B_SIGNAL_EVENT HOST_SignalEvent_t
123 
124 // On-Board FXOS8700 Sensor Information
125 #define FXOS8700_BB_I2C_ADDR 0x1C
126 #define FXOS8700_BB_INT1 INT1
127 #define FXOS8700_BB_INT2 INT2
128 
129 /* @brief Ask use input to resume after specified samples have been processed. */
130 #define ASK_USER_TO_RESUME(x) \
131  static volatile bool askResume = true; \
132  static uint16_t samplesToProcess = x - 1; \
133  if (askResume && !samplesToProcess--) \
134  { \
135  PRINTF("\r\n Specified samples processed, press any key to continue... \r\n"); \
136  GETCHAR(); \
137  askResume = false; \
138  }
139 
140 /// @name Wired UART Parameters
141 /// Sensor Fusion aliases are defined in terms of specific hardware features
142 /// defined in MK22F51212.h.
143 ///@{
144 #define WIRED_UART UART1 ///< KSDK instance name for the debug UART
145 #define WIRED_UART_PORT_CLKEN kCLOCK_PortE ///< KDSK handle for the pin port clock enable
146 #define WIRED_UART_PORT PORTE ///< KDSK handle for the pin port associated with this UART
147 #define WIRED_UART_RX_PIN 1U ///< The port number associated with RX
148 #define WIRED_UART_TX_PIN 0U ///< The port number associated with TX
149 #define WIRED_UART_MUX kPORT_MuxAlt3 ///< KDSK pin mux selector
150 #ifndef USE_ORIENT_APP_CONTROL ///< If Using Orient App then use Host I/O
151 #define WIRED_UART_IRQHandler UART1_RX_TX_IRQHandler ///< KDSK-specified IRQ handler name
152 #endif
153 #define WIRED_UART_IRQn UART1_RX_TX_IRQn ///< The interrupt number associated with this IRQ
154 #define WIRED_UART_CLKSRC UART1_CLK_SRC ///< KSDK instance name for the clock feeding this module
155 #define WIRED_UART_IRQn UART1_RX_TX_IRQn ///< KSDK interrupt vector number
156 ///@}
157 
158 /// @name Wireless UART Parameters
159 /// Sensor Fusion aliases are defined in terms of specific hardware features
160 /// defined in MK22F51212.h.
161 ///@{
162 #define WIRELESS_UART UART2 ///< KSDK instance name for the debug UART
163 #define WIRELESS_UART_PORT_CLKEN kCLOCK_PortD ///< KDSK handle for the pin port clock enable
164 #define WIRELESS_UART_PORT PORTD ///< KDSK handle for the pin port associated with this UART
165 #define WIRELESS_UART_RX_PIN 2U ///< The port number associated with RX
166 #define WIRELESS_UART_TX_PIN 3U ///< The port number associated with TX
167 #define WIRELESS_UART_MUX kPORT_MuxAlt3 ///< KDSK pin mux selector
168 #define WIRELESS_UART_IRQHandler UART2_RX_TX_IRQHandler ///< KDSK-specified IRQ handler name
169 #define WIRELESS_UART_IRQn UART2_RX_TX_IRQn ///< The interrupt number associated with this IRQ
170 #define WIRELESS_UART_CLKSRC UART2_CLK_SRC ///< KSDK instance name for the clock feeding this module
171 #define WIRELESS_UART_IRQn UART2_RX_TX_IRQn ///< KSDK interrupt vector number
172 ///@}
173 
174 ///@name Miscellaneous Hardware Configuration Parameters
175 ///@{
176 #define THIS_BOARD 9 ///< FRDM_K22F
177 #define CORE_SYSTICK_HZ 80000000 ///< core and systick clock rate (Hz)
178 #define CALIBRATION_NVM_ADDR 0x0007F800 ///< start of final 2K (sector size) of 512K flash
179 #define ADS_NVM_ADDR 0x0007F000 ///< start of the next to last 2K (sector size) of the 512K flash
180 #define FLASH_SECTOR_SIZE_PROPERTY kFLASH_PropertyPflashSectorSize
181 #define FLASH_ERASE_KEY kFLASH_ApiEraseKey
182 
183 // offsets from start of NVM block for calibration coefficients
184 #define MAG_NVM_OFFSET 0 // 68 bytes used
185 #define GYRO_NVM_OFFSET 100 // 16 bytes used
186 #define ACCEL_NVM_OFFSET 140 // 88 bytes used
187 ///@}
188 
189 #endif /* FRDM_K22F_H_ */
gpioHandleKSDK_t INT1
Definition: frdm_k64f.c:230
gpioHandleKSDK_t A3
Definition: frdm_k64f.c:135
gpioHandleKSDK_t D12
Definition: frdm_k64f.c:89
gpioHandleKSDK_t D7
Definition: frdm_k64f.c:177
gpioHandleKSDK_t D4
Definition: frdm_k64f.c:156
gpioHandleKSDK_t D9
Definition: frdm_k64f.c:191
gpioHandleKSDK_t D14
Definition: frdm_k64f.c:50
gpioHandleKSDK_t A1
Definition: frdm_k64f.c:121
gpioHandleKSDK_t D15
Definition: frdm_k64f.c:43
The GPIO pin handle for KSDK.
Definition: gpio_driver.h:75
gpioHandleKSDK_t INT2
Definition: frdm_k64f.c:237
gpioHandleKSDK_t D13
Definition: frdm_k64f.c:75
gpioHandleKSDK_t BLUE_LED
Definition: frdm_k64f.c:221
gpioHandleKSDK_t D0
Definition: frdm_k64f.c:98
gpioHandleKSDK_t A0
Definition: frdm_k64f.c:114
gpioHandleKSDK_t A4
Definition: frdm_k64f.c:66
gpioHandleKSDK_t D5
Definition: frdm_k64f.c:163
gpioHandleKSDK_t A5
Definition: frdm_k64f.c:59
gpioHandleKSDK_t D2
Definition: frdm_k64f.c:142
gpioHandleKSDK_t D1
Definition: frdm_k64f.c:105
gpioHandleKSDK_t D8
Definition: frdm_k64f.c:184
gpioHandleKSDK_t D11
Definition: frdm_k64f.c:82
gpioHandleKSDK_t D3
Definition: frdm_k64f.c:149
gpioHandleKSDK_t D10
Definition: frdm_k64f.c:198
gpioHandleKSDK_t A2
Definition: frdm_k64f.c:128
gpioHandleKSDK_t RED_LED
Definition: frdm_k64f.c:207
gpioHandleKSDK_t D6
Definition: frdm_k64f.c:170
gpioHandleKSDK_t GREEN_LED
Definition: frdm_k64f.c:214