1
1
/*
2
+ *******************************************************************************
3
+ * Copyright (c) 2017, STMicroelectronics
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * 1. Redistributions of source code must retain the above copyright notice,
10
+ * this list of conditions and the following disclaimer.
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ * this list of conditions and the following disclaimer in the documentation
13
+ * and/or other materials provided with the distribution.
14
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
15
+ * may be used to endorse or promote products derived from this software
16
+ * without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *******************************************************************************
29
+ */
30
+
31
+ #include " pins_arduino.h"
32
+
33
+ #ifdef __cplusplus
34
+ extern " C" {
35
+ #endif
36
+
37
+ // Pin number
38
+ // Match Table Table 16. NUCLEO-F207ZG pin assignments
39
+ // from UM1974 STM32 Nucleo-144 board
40
+ const PinName digitalPin[] = {
41
+ PG_9, // D0
42
+ PG_14, // D1
43
+ PF_15, // D2
44
+ PE_13, // D3
45
+ PF_14, // D4
46
+ PE_11, // D5
47
+ PE_9, // D6
48
+ PF_13, // D7
49
+ PF_12, // D8
50
+ PD_15, // D9
51
+ PD_14, // D10
52
+ PA_7, // D11 - If SB121, SB122 (ON,OFF) connected to PA7 (default, see D71)
53
+ // else SB121, SB122 (OFF,ON) connected to PB5 (D22)
54
+ PA_6, // D12
55
+ PA_5, // D13
56
+ PB_9, // D14
57
+ PB_8, // D15
58
+ PC_6, // D16
59
+ PB_15, // D17
60
+ PB_13, // D18 - used as I2S_A_CK and connected to CN7 pin 5 by default, if JP7 is ON,
61
+ // it is also connected to Ethernet PHY as RMII_TXD1. In this case only
62
+ // one function of Ethernet or I2S_A must be used.
63
+ PB_12, // D19
64
+ PA_15, // D20
65
+ PC_7, // D21
66
+ PB_5, // D22 - D11 if SB121 off, SB122 on
67
+ PB_3, // D23
68
+ PA_4, // D24
69
+ PB_4, // D25
70
+ PB_6, // D26
71
+ PB_2, // D27
72
+ PD_13, // D28
73
+ PD_12, // D29
74
+ PD_11, // D30
75
+ PE_2, // D31 - PE2 is connected to both CN9 pin 14 (I/O) and CN10 pin 25 (I/O).
76
+ // Only one connector pin must be used at one time.
77
+ PA_0, // D32
78
+ PB_0, // D33 - LED1
79
+ PE_0, // D34
80
+ PB_11, // D35
81
+ PB_10, // D36
82
+ PE_15, // D37
83
+ PE_14, // D38
84
+ PE_12, // D39
85
+ PE_10, // D40
86
+ PE_7, // D41
87
+ PE_8, // D42
88
+ PC_8, // D43
89
+ PC_9, // D44
90
+ PC_10, // D45
91
+ PC_11, // D46
92
+ PC_12, // D47
93
+ PD_2, // D48
94
+ PG_2, // D49
95
+ PG_3, // D50
96
+ PD_7, // D51
97
+ PD_6, // D52
98
+ PD_5, // D53
99
+ PD_4, // D54
100
+ PD_3, // D55
101
+ PE_2, // D56 - connected to both CN9 pin 14 (I/O) and CN10 pin 25 (I/O).
102
+ // Only one connector pin must be used at one time
103
+ PE_4, // D57
104
+ PE_5, // D58
105
+ PE_6, // D59
106
+ PE_3, // D60
107
+ PF_8, // D61
108
+ PF_7, // D62
109
+ PF_9, // D63
110
+ PG_1, // D64
111
+ PG_0, // D65
112
+ PD_1, // D66
113
+ PD_0, // D67
114
+ PF_0, // D68
115
+ PF_1, // D69
116
+ PF_2, // D70
117
+ PA_7, // D71 - used as D11 and connected to CN7 pin 14 by default, if JP6 is ON,
118
+ // it is also connected to both Ethernet PHY as RMII_DV and CN9 pin 15.
119
+ // In this case only one function of the Ethernet or D11 must be used.
120
+ NC, // D72
121
+ PB_7, // D73 - LED_BLUE
122
+ PB_14, // D74 - LED_RED
123
+ PC_13, // D75 - USER_BTN
124
+ PD_9, // D76 - Serial Rx
125
+ PD_8, // D77 - Serial Tx
126
+ PA_3, // D78/A0
127
+ PC_0, // D79/A1
128
+ PC_3, // D80/A2
129
+ PF_3, // D81/A3
130
+ PF_5, // D82/A4
131
+ PF_10, // D83/A5
132
+ PB_1, // D84/A6
133
+ PC_2, // D85/A7
134
+ PF_4, // D86/A8
135
+ PF_6 // D87/A9
136
+ };
137
+
138
+ // Analog (Ax) pin number array
139
+ const uint32_t analogInputPin[] = {
140
+ 78 , // A0
141
+ 79 , // A1
142
+ 80 , // A2
143
+ 81 , // A3
144
+ 82 , // A4
145
+ 83 , // A5
146
+ 84 , // A6
147
+ 85 , // A7
148
+ 86 , // A8
149
+ 87 , // A9
150
+ 11 , // A10
151
+ 12 , // A11
152
+ 13 , // A12
153
+ 24 , // A13
154
+ 32 , // A14
155
+ 61 , // A15
156
+ 62 , // A16
157
+ 63 // A17
158
+ };
159
+
160
+ #ifdef __cplusplus
161
+ }
162
+ #endif
163
+
164
+ // ----------------------------------------------------------------------------
165
+
166
+ #ifdef __cplusplus
167
+ extern " C" {
168
+ #endif
169
+
170
+ /* *
171
+ * @brief System Clock Configuration
172
+ * @param None
173
+ * @retval None
174
+ */
175
+ WEAK void SystemClock_Config (void )
176
+ {
177
+ // from CubeMX for f746
178
+ RCC_OscInitTypeDef RCC_OscInitStruct = {0 };
179
+ RCC_ClkInitTypeDef RCC_ClkInitStruct = {0 };
180
+ RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0 };
181
+
182
+ /* * Configure LSE Drive Capability
183
+ */
184
+ HAL_PWR_EnableBkUpAccess ();
185
+ /* * Configure the main internal regulator output voltage
186
+ */
187
+ __HAL_RCC_PWR_CLK_ENABLE ();
188
+ __HAL_PWR_VOLTAGESCALING_CONFIG (PWR_REGULATOR_VOLTAGE_SCALE1);
189
+ /* * Initializes the CPU, AHB and APB busses clocks
190
+ */
191
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
192
+ RCC_OscInitStruct.HSEState = RCC_HSE_ON; // RCC_HSE_BYPASS;
193
+ RCC_OscInitStruct.PLL .PLLState = RCC_PLL_ON;
194
+ RCC_OscInitStruct.PLL .PLLSource = RCC_PLLSOURCE_HSE;
195
+ RCC_OscInitStruct.PLL .PLLM = 4 ;
196
+ RCC_OscInitStruct.PLL .PLLN = 216 ;
197
+ RCC_OscInitStruct.PLL .PLLP = RCC_PLLP_DIV2;
198
+ RCC_OscInitStruct.PLL .PLLQ = 9 ;
199
+ if (HAL_RCC_OscConfig (&RCC_OscInitStruct) != HAL_OK) {
200
+ Error_Handler ();
201
+ }
202
+ /* * Activate the Over-Drive mode
203
+ */
204
+ if (HAL_PWREx_EnableOverDrive () != HAL_OK) {
205
+ Error_Handler ();
206
+ }
207
+ /* * Initializes the CPU, AHB and APB busses clocks
208
+ */
209
+ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | /*
2
210
Copyright (c) 2011 Arduino. All right reserved.
3
211
4
212
This library is free software; you can redistribute it and/or
@@ -151,14 +359,14 @@ extern "C" {
151
359
/* *
152
360
* @brief System Clock Configuration
153
361
* The system Clock is configured as follow :
154
- * System Clock source = PLL (HSI )
362
+ * System Clock source = PLL (HSE )
155
363
* SYSCLK(Hz) = 216000000
156
364
* HCLK(Hz) = 216000000
157
365
* AHB Prescaler = 1
158
366
* APB1 Prescaler = 4
159
367
* APB2 Prescaler = 2
160
368
* HSE Frequency(Hz) = 16000000
161
- * PLL_M = 8
369
+ * PLL_M = 4
162
370
* PLL_N = 216
163
371
* PLL_P = 2
164
372
* PLL_Q = 9
@@ -182,12 +390,11 @@ WEAK void SystemClock_Config(void)
182
390
__HAL_PWR_VOLTAGESCALING_CONFIG (PWR_REGULATOR_VOLTAGE_SCALE1);
183
391
/* * Initializes the CPU, AHB and APB busses clocks
184
392
*/
185
- RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
186
- RCC_OscInitStruct.HSIState = RCC_HSI_ON;
187
- RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
393
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
394
+ RCC_OscInitStruct.HSEState = RCC_HSE_ON; // RCC_HSE_BYPASS;
188
395
RCC_OscInitStruct.PLL .PLLState = RCC_PLL_ON;
189
- RCC_OscInitStruct.PLL .PLLSource = RCC_PLLSOURCE_HSI ;
190
- RCC_OscInitStruct.PLL .PLLM = 8 ;
396
+ RCC_OscInitStruct.PLL .PLLSource = RCC_PLLSOURCE_HSE ;
397
+ RCC_OscInitStruct.PLL .PLLM = 4 ;
191
398
RCC_OscInitStruct.PLL .PLLN = 216 ;
192
399
RCC_OscInitStruct.PLL .PLLP = RCC_PLLP_DIV2;
193
400
RCC_OscInitStruct.PLL .PLLQ = 9 ;
@@ -222,3 +429,23 @@ WEAK void SystemClock_Config(void)
222
429
#ifdef __cplusplus
223
430
}
224
431
#endif
432
+ 1 | RCC_CLOCKTYPE_PCLK2;
433
+ RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
434
+ RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
435
+ RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
436
+ RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
437
+
438
+ if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_7) != HAL_OK) {
439
+ Error_Handler ();
440
+ }
441
+ PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART3 | RCC_PERIPHCLK_CLK48;
442
+ PeriphClkInitStruct.Usart3ClockSelection = RCC_USART3CLKSOURCE_PCLK1;
443
+ PeriphClkInitStruct.Clk48ClockSelection = RCC_CLK48SOURCE_PLL;
444
+ if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
445
+ Error_Handler ();
446
+ }
447
+ }
448
+
449
+ #ifdef __cplusplus
450
+ }
451
+ #endif
0 commit comments