1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
|
/************************************************************************************
* configs/fire-stm32v2/src/fire-internal.h
* arch/arm/src/board/fire-internal.n
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
#ifndef __CONFIGS_FIRE_STM32V2_SRC_FIRE_INTERNAL_H
#define __CONFIGS_FIRE_STM32V2_SRC_FIRE_INTERNAL_H
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <stdint.h>
/************************************************************************************
* Definitions
************************************************************************************/
/* How many SPI modules does this chip support? Most support 2 SPI modules (others
* may support more -- in such case, the following must be expanded).
*/
#if STM32_NSPI < 1
# undef CONFIG_STM32_SPI1
# undef CONFIG_STM32_SPI2
#elif STM32_NSPI < 2
# undef CONFIG_STM32_SPI2
#endif
/* There is only CAN1 on the M3 Wildfire board */
#if defined(CONFIG_STM32_CAN2)
# warning "The M3 Wildfire only supports CAN1"
#endif
/* M3 Wildfire GPIOs ****************************************************************/
/* Camera
*
* --- ------ -------------- -------------------------------------------------------------------
* PIN NAME SIGNAL NOTES
* --- ------ -------------- -------------------------------------------------------------------
*
* 23 PA0 PA0-C-VSYNC Camera (P9)
* 67 PA8 PA8-C-XCLK Camera (P9)
* 91 PB5 PB5-C-WRST Camera (P9)
* 95 PB8 PB8-C-DO_0 Camera (P9)
* 96 PB9 PB9-C-DO_1 Camera (P9)
* 47 PB10 PB10-C-DO_2 Camera (P9)
* 48 PB11 PB11-C-DO_3 Camera (P9)
* 51 PB12 PB12-C-DO_4 Camera (P9)
* 52 PB13 PB13-C-DO_5 Camera (P9)
* 53 PB14 PB14-C-DO_6 Camera (P9)
* 54 PB15 PB15-C-DO_7 Camera (P9)
* 63 PC6 PC6-C-SIO_C Camera (P9)
* 64 PC7 PC7-C-SIO_D Camera (P9)
* 84 PD3 PD3-C-WEN Camera (P9)
* 87 PD6 PD6-C-OE Camera (P9)
* 59 PD12 C-LED_EN Camera (P9)
* 97 PE0 PE0-C-RRST Camera (P9)
* 1 PE2 PE2-C-RCLK Camera (P9)
*/
/* Bell
*
* --- ------ -------------- -------------------------------------------------------------------
* PIN NAME SIGNAL NOTES
* --- ------ -------------- -------------------------------------------------------------------
*
* 3 PE4 PE4-BEEP LS1 Bell
*/
/* 2.4" TFT + Touchscreen
*
* --- ------ -------------- -------------------------------------------------------------------
* PIN NAME SIGNAL NOTES
* --- ------ -------------- -------------------------------------------------------------------
*
* 30 PA5 PA5-SPI1-SCK 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
* 31 PA6 PA6-SPI1-MISO 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
* 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
* 92 PB6 PB6-I2C1-SCL 2.4" TFT + Touchscreen, AT24C02
* 93 PB7 PB7-I2C1-SDA 2.4" TFT + Touchscreen, AT24C02
* 81 PD0 PD0-FSMC_D2 2.4" TFT + Touchscreen
* 82 PD1 PD1-FSMC_D3 2.4" TFT + Touchscreen
* 85 PD4 PD4-FSMC_NOE 2.4" TFT + Touchscreen
* 86 PD5 PD5-FSMC_NWE 2.4" TFT + Touchscreen
* 88 PD7 PD7-FSMC_NE1 2.4" TFT + Touchscreen
* 55 PD8 PD8-FSMC_D13 2.4" TFT + Touchscreen
* 56 PD9 PD9-FSMC_D14 2.4" TFT + Touchscreen
* 57 PD10 PD10-FSMC_D15 2.4" TFT + Touchscreen
* 58 PD11 PD11-FSMC_A16 2.4" TFT + Touchscreen
* 60 PD13 PD13-LCD/LIGHT 2.4" TFT + Touchscreen
* 61 PD14 PD14-FSMC_D0 2.4" TFT + Touchscreen
* 62 PD15 PD15-FSMC_D1 2.4" TFT + Touchscreen
* 98 PE1 PE1-FSMC_NBL1 2.4" TFT + Touchscreen
* 38 PE7 PE7-FSMC_D4 2.4" TFT + Touchscreen
* 39 PE8 PE8-FSMC_D5 2.4" TFT + Touchscreen
* 40 PE9 PE9-FSMC_D6 2.4" TFT + Touchscreen
* 41 PE10 PE10-FSMC_D7 2.4" TFT + Touchscreen
* 42 PE11 PE11-FSMC_D8 2.4" TFT + Touchscreen
* 43 PE12 PE12-FSMC_D9 2.4" TFT + Touchscreen
* 44 PE13 PE13-FSMC_D10 2.4" TFT + Touchscreen
* 45 PE14 PE14-FSMC_D11 2.4" TFT + Touchscreen
* 46 PE15 PE15-FSMC_D12 2.4" TFT + Touchscreen
*/
#define GPIO_LCD_BACKLIGHT (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_CLEAR|GPIO_PORTD|GPIO_PIN13)
/* GPIO_LCD_CS - Is there some kind of chip select for SPI1? */
/* LEDs
*
* --- ------ -------------- -------------------------------------------------------------------
* PIN NAME SIGNAL NOTES
* --- ------ -------------- -------------------------------------------------------------------
*
* 18 PC3 PC3-LED1 LED1, Active low (pulled high)
* 33 PC4 PC4-LED2 LED2, Active low (pulled high)
* 34 PC5 PC5-LED3 LED3, Active low (pulled high)
*/
#define GPIO_LED1 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN3)
#define GPIO_LED2 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN4)
#define GPIO_LED3 (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN5)
/* Buttons
*
* --- ------ -------------- -------------------------------------------------------------------
* PIN NAME SIGNAL NOTES
* --- ------ -------------- -------------------------------------------------------------------
*
* 35 PB0 PB0-KEY1 KEY1, Low when closed (pulled high if open)
* 36 PB1 PB1-KEY2 KEY2, Low when closed (pulled high if open)
*/
#define MIN_IRQBUTTON BUTTON_KEY1
#define MAX_IRQBUTTON BUTTON_KEY2
#define NUM_IRQBUTTONS (MAX_IRQBUTTON - MIN_IRQBUTTON + 1)
#define GPIO_BTN_KEY1 (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
GPIO_EXTI|GPIO_PORTB|GPIO_PIN0)
#define GPIO_BTN_KEY2 (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
GPIO_EXTI|GPIO_PORTB|GPIO_PIN1)
/* 2MBit SPI FLASH
*
* --- ------ -------------- -------------------------------------------------------------------
* PIN NAME SIGNAL NOTES
* --- ------ -------------- -------------------------------------------------------------------
*
* 29 PA4 PA4-SPI1-NSS 10Mbit ENC28J60, SPI 2M FLASH
* 30 PA5 PA5-SPI1-SCK 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
* 31 PA6 PA6-SPI1-MISO 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
* 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
*/
#ifndef CONFIG_NET_ENC28J60
# define GPIO_ENC28J60_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
#endif
/* ENC28J60
*
* --- ------ -------------- -------------------------------------------------------------------
* PIN NAME SIGNAL NOTES
* --- ------ -------------- -------------------------------------------------------------------
*
* 29 PA4 PA4-SPI1-NSS 10Mbit ENC28J60, SPI 2M FLASH
* 30 PA5 PA5-SPI1-SCK 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
* 31 PA6 PA6-SPI1-MISO 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
* 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH
* 98 PE1 PE1-FSMC_NBL1 2.4" TFT + Touchscreen, 10Mbit EN28J60 Reset
* 4 PE5 (no name) 10Mbps ENC28J60 Interrupt
*/
#if defined(CONFIG_STM32_FSMC) && defined(CONFIG_NET_ENC28J60)
# warning "TFT LCD and ENCJ2860 shared PE1"
#endif
#ifdef CONFIG_NET_ENC28J60
# define GPIO_ENC28J60_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4)
# define GPIO_ENC28J60_RESET (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_CLEAR|GPIO_PORTE|GPIO_PIN1)
# define GPIO_ENC28J60_INTR (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\
GPIO_EXTI|GPIO_PORTE|GPIO_PIN5)
#endif
/* MP3
*
* --- ------ -------------- -------------------------------------------------------------------
* PIN NAME SIGNAL NOTES
* --- ------ -------------- -------------------------------------------------------------------
*
* 48 PB11 PB11-MP3-RST MP3
* 51 PB12 PB12-SPI2-NSS MP3
* 52 PB13 PB13-SPI2-SCK MP3
* 53 PB14 PB14-SPI2-MISO MP3
* 54 PB15 PB15-SPI2-MOSI MP3
* 63 PC6 PC6-MP3-XDCS MP3
* 64 PC7 PC7-MP3-DREQ MP3
*/
#define GPIO_MP3_CS (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\
GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN6)
/************************************************************************************
* Public Types
************************************************************************************/
/************************************************************************************
* Public data
************************************************************************************/
#ifndef __ASSEMBLY__
/************************************************************************************
* Public Functions
************************************************************************************/
/************************************************************************************
* Name: stm32_spiinitialize
*
* Description:
* Called to configure SPI chip select GPIO pins for the M3 Wildfire board.
*
************************************************************************************/
void weak_function stm32_spiinitialize(void);
/************************************************************************************
* Name: stm32_usbinitialize
*
* Description:
* Called to setup USB-related GPIO pins for the M3 Wildfire board.
*
************************************************************************************/
void weak_function stm32_usbinitialize(void);
/************************************************************************************
* Name: stm32_selectlcd
*
* Description:
* Initialize to the LCD
*
************************************************************************************/
#ifdef CONFIG_STM32_FSMC
void stm32_selectlcd(void);
#endif
/****************************************************************************
* Name: stm32_sdinitialize
*
* Description:
* Initialize the SPI-based SD card. Requires CONFIG_DISABLE_MOUNTPOINT=n
* and CONFIG_STM32_SPI1=y
*
****************************************************************************/
int stm32_sdinitialize(int minor);
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_FIRE_STM32V2_SRC_FIRE_INTERNAL_H */
|