Skip to content

Commit 162dffe

Browse files
committedOct 28, 2022
Add Nucleo F413ZH board
Tested: - Serial - SPI - USB
1 parent 353487a commit 162dffe

File tree

3 files changed

+506
-0
lines changed

3 files changed

+506
-0
lines changed
 

‎boards.txt

+14
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ Nucleo_144.menu.pnum.NUCLEO_F207ZG.build.variant=STM32F2xx/F207Z(C-E-F-G)T_F217Z
3636
Nucleo_144.menu.pnum.NUCLEO_F207ZG.build.peripheral_pins=-DCUSTOM_PERIPHERAL_PINS
3737
Nucleo_144.menu.pnum.NUCLEO_F207ZG.build.cmsis_lib_gcc=arm_cortexM3l_math
3838

39+
# NUCLEO_F413ZH board
40+
Nucleo_144.menu.pnum.NUCLEO_F413ZH=Nucleo F413ZH
41+
Nucleo_144.menu.pnum.NUCLEO_F413ZH.node=NODE_F413ZH
42+
Nucleo_144.menu.pnum.NUCLEO_F413ZH.upload.maximum_size=1572864
43+
Nucleo_144.menu.pnum.NUCLEO_F413ZH.upload.maximum_data_size=327680
44+
Nucleo_144.menu.pnum.NUCLEO_F413ZH.build.mcu=cortex-m4
45+
Nucleo_144.menu.pnum.NUCLEO_F413ZH.build.fpu=-mfpu=fpv4-sp-d16
46+
Nucleo_144.menu.pnum.NUCLEO_F413ZH.build.float-abi=-mfloat-abi=hard
47+
Nucleo_144.menu.pnum.NUCLEO_F413ZH.build.board=NUCLEO_F413ZH
48+
Nucleo_144.menu.pnum.NUCLEO_F413ZH.build.series=STM32F4xx
49+
Nucleo_144.menu.pnum.NUCLEO_F413ZH.build.product_line=STM32F413xx
50+
Nucleo_144.menu.pnum.NUCLEO_F413ZH.build.variant=STM32F4xx/F413Z(G-H)(J-T)_F423ZH(J-T)
51+
Nucleo_144.menu.pnum.NUCLEO_F413ZH.build.cmsis_lib_gcc=arm_cortexM4lf_math
52+
3953
# NUCLEO_F429ZI board
4054
# Support: USB HID, Serial1 (USART1 on PG9, PG14) and Serial2 (USART2 on PD6, PD5)
4155
Nucleo_144.menu.pnum.NUCLEO_F429ZI=Nucleo F429ZI
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2019-2022, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* This software component is licensed by ST under BSD 3-Clause license,
7+
* the "License"; You may not use this file except in compliance with the
8+
* License. You may obtain a copy of the License at:
9+
* opensource.org/licenses/BSD-3-Clause
10+
*
11+
*******************************************************************************
12+
*/
13+
#if defined(ARDUINO_NUCLEO_F413ZH)
14+
#include "pins_arduino.h"
15+
16+
// Digital PinName array
17+
// This array allows to wrap Arduino pin number(Dx or x)
18+
// to STM32 PinName (PX_n)
19+
const PinName digitalPin[] = {
20+
PG_9, //D0
21+
PG_14, //D1
22+
PF_15, //D2
23+
PE_13, //D3
24+
PF_14, //D4
25+
PE_11, //D5
26+
PE_9, //D6
27+
PF_13, //D7
28+
PF_12, //D8
29+
PD_15, //D9
30+
PD_14, //D10
31+
PA_7, //D11/A10
32+
PA_6, //D12/A11
33+
PA_5, //D13/A12
34+
PB_9, //D14
35+
PB_8, //D15
36+
PC_6, //D16
37+
PB_15, //D17
38+
PB_13, //D18
39+
PB_12, //D19
40+
PA_15, //D20
41+
PC_7, //D21
42+
PB_5, //D22
43+
PB_3, //D23
44+
PA_4, //D24/A13
45+
PB_4, //D25
46+
PB_6, //D26
47+
PB_2, //D27
48+
PD_13, //D28
49+
PD_12, //D29
50+
PD_11, //D30
51+
PE_2, //D31
52+
PA_0, //D32/A14
53+
PB_0, //D33/A15 - LED_GREEN
54+
PE_0, //D34
55+
PB_11, //D35
56+
PB_10, //D36
57+
PE_15, //D37
58+
PE_14, //D38
59+
PE_12, //D39
60+
PE_10, //D40
61+
PE_7, //D41
62+
PE_8, //D42
63+
PC_8, //D43
64+
PC_9, //D44
65+
PC_10, //D45
66+
PC_11, //D46
67+
PC_12, //D47
68+
PD_2, //D48
69+
PG_2, //D49
70+
PG_3, //D50
71+
PD_7, //D51
72+
PD_6, //D52
73+
PD_5, //D53
74+
PD_4, //D54
75+
PD_3, //D55
76+
PE_2, //D56
77+
PE_4, //D57
78+
PE_5, //D58
79+
PE_6, //D59
80+
PE_3, //D60
81+
PF_8, //D61
82+
PF_7, //D62
83+
PF_9, //D63
84+
PG_1, //D64
85+
PG_0, //D65
86+
PD_1, //D66
87+
PD_0, //D67
88+
PF_0, //D68
89+
PF_1, //D69
90+
PF_2, //D70
91+
PB_7, //D71 - LED_BLUE
92+
PB_14, //D72 - LED_RED
93+
PC_13, //D73 - USER_BTN
94+
PD_9, //D74 - Serial Rx
95+
PD_8, //D75 - Serial Tx
96+
PA_3, //D76/A0
97+
PC_0, //D77/A1
98+
PC_3, //D78/A2
99+
PC_1, //D79/A3
100+
PC_4, //D80/A4
101+
PC_5, //D81/A5
102+
PB_1, //D82/A6
103+
PC_2, //D83/A7
104+
PA_2, //D84/A8
105+
PF_6, //D85
106+
PA_1, //D86/A9
107+
PF_4, //D87
108+
PA_8, //D88
109+
PA_9, //D89
110+
PA_10, //D90
111+
PA_11, //D91
112+
PA_12, //D92
113+
PA_13, //D93
114+
PA_14, //D94
115+
PF_3, //D95/A20
116+
PF_5, //D96/A21
117+
PF_10, //D97/A22
118+
PC_14, //D98
119+
PC_15, //D99
120+
PD_10, //D100
121+
PE_1, //D101
122+
PF_11, //D102
123+
PG_4, //D103
124+
PG_5, //D104
125+
PG_6, //D105
126+
PG_7, //D106
127+
PG_8, //D107
128+
PG_10, //D108
129+
PG_11, //D109
130+
PG_12, //D110
131+
PG_13, //D111
132+
PG_15, //D112
133+
PH_0, //D113
134+
PH_1 //D114
135+
};
136+
137+
// Analog (Ax) pin number array
138+
const uint32_t analogInputPin[] = {
139+
76, //A0
140+
77, //A1
141+
78, //A2
142+
79, //A3
143+
80, //A4
144+
81, //A5
145+
82, //A6
146+
83, //A7
147+
84, //A8
148+
86, //A9
149+
11, //A10
150+
12, //A11
151+
13, //A12
152+
24, //A13
153+
32, //A14
154+
33 //A15
155+
};
156+
157+
// ----------------------------------------------------------------------------
158+
159+
#ifdef __cplusplus
160+
extern "C" {
161+
#endif
162+
163+
/**
164+
* @brief System Clock Configuration
165+
* @param None
166+
* @retval None
167+
*/
168+
WEAK void SystemClock_Config(void)
169+
{
170+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
171+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
172+
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {};
173+
174+
/** Configure the main internal regulator output voltage
175+
*/
176+
__HAL_RCC_PWR_CLK_ENABLE();
177+
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
178+
179+
/** Initializes the RCC Oscillators according to the specified parameters
180+
* in the RCC_OscInitTypeDef structure.
181+
*/
182+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
183+
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
184+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
185+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
186+
RCC_OscInitStruct.PLL.PLLM = 4;
187+
RCC_OscInitStruct.PLL.PLLN = 100;
188+
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
189+
RCC_OscInitStruct.PLL.PLLQ = 8;
190+
RCC_OscInitStruct.PLL.PLLR = 2;
191+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
192+
Error_Handler();
193+
}
194+
195+
/** Initializes the CPU, AHB and APB buses clocks
196+
*/
197+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
198+
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
199+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
200+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
201+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
202+
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
203+
204+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3) != HAL_OK) {
205+
Error_Handler();
206+
}
207+
208+
/** Initializes the peripherals clock
209+
*/
210+
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_PLLI2S | RCC_PERIPHCLK_CLK48
211+
| RCC_PERIPHCLK_SDIO | RCC_PERIPHCLK_I2S_APB2;
212+
PeriphClkInitStruct.PLLI2S.PLLI2SN = 72;
213+
PeriphClkInitStruct.PLLI2S.PLLI2SM = 4;
214+
PeriphClkInitStruct.PLLI2S.PLLI2SR = 2;
215+
PeriphClkInitStruct.PLLI2S.PLLI2SQ = 3;
216+
PeriphClkInitStruct.Clk48ClockSelection = RCC_CLK48CLKSOURCE_PLLI2SQ;
217+
PeriphClkInitStruct.SdioClockSelection = RCC_SDIOCLKSOURCE_CLK48;
218+
PeriphClkInitStruct.I2sApb2ClockSelection = RCC_I2SAPB2CLKSOURCE_PLLI2S;
219+
PeriphClkInitStruct.PLLI2SSelection = RCC_PLLI2SCLKSOURCE_PLLSRC;
220+
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
221+
Error_Handler();
222+
}
223+
}
224+
225+
#ifdef __cplusplus
226+
}
227+
#endif
228+
229+
#endif /* ARDUINO_NUCLEO_F413ZH */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2019-2022, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* This software component is licensed by ST under BSD 3-Clause license,
7+
* the "License"; You may not use this file except in compliance with the
8+
* License. You may obtain a copy of the License at:
9+
* opensource.org/licenses/BSD-3-Clause
10+
*
11+
*******************************************************************************
12+
*/
13+
#pragma once
14+
15+
/*----------------------------------------------------------------------------
16+
* STM32 pins number
17+
*----------------------------------------------------------------------------*/
18+
19+
#define PG9 0
20+
#define PG14 1
21+
#define PF15 2
22+
#define PE13 3
23+
#define PF14 4
24+
#define PE11 5
25+
#define PE9 6
26+
#define PF13 7
27+
#define PF12 8
28+
#define PD15 9
29+
#define PD14 10
30+
#define PA7 PIN_A10
31+
#define PA6 PIN_A11
32+
#define PA5 PIN_A12
33+
#define PB9 14
34+
#define PB8 15
35+
#define PC6 16
36+
#define PB15 17
37+
#define PB13 18
38+
#define PB12 19
39+
#define PA15 20
40+
#define PC7 21
41+
#define PB5 22
42+
#define PB3 23
43+
#define PA4 PIN_A13
44+
#define PB4 25
45+
#define PB6 26
46+
#define PB2 27
47+
#define PD13 28
48+
#define PD12 29
49+
#define PD11 30
50+
#define PE2 31
51+
#define PA0 PIN_A14
52+
#define PB0 PIN_A15 // LED_GREEN
53+
#define PE0 34
54+
#define PB11 35
55+
#define PB10 36
56+
#define PE15 37
57+
#define PE14 38
58+
#define PE12 39
59+
#define PE10 40
60+
#define PE7 41
61+
#define PE8 42
62+
#define PC8 43
63+
#define PC9 44
64+
#define PC10 45
65+
#define PC11 46
66+
#define PC12 47
67+
#define PD2 48
68+
#define PG2 49
69+
#define PG3 50
70+
#define PD7 51
71+
#define PD6 52
72+
#define PD5 53
73+
#define PD4 54
74+
#define PD3 55
75+
#define PE2_2 56 //PE2 present twice (also in D31)
76+
#define PE4 57
77+
#define PE5 58
78+
#define PE6 59
79+
#define PE3 60
80+
#define PF8 61
81+
#define PF7 62
82+
#define PF9 63
83+
#define PG1 64
84+
#define PG0 65
85+
#define PD1 66
86+
#define PD0 67
87+
#define PF0 68
88+
#define PF1 69
89+
#define PF2 70
90+
#define PB7 71 // LED_BLUE
91+
#define PB14 72 // LED_RED
92+
#define PC13 73 // USER_BTN
93+
#define PD9 74 // Serial Rx
94+
#define PD8 75 // Serial Tx
95+
#define PA3 PIN_A0
96+
#define PC0 PIN_A1
97+
#define PC3 PIN_A2
98+
#define PC1 PIN_A3
99+
#define PC4 PIN_A4
100+
#define PC5 PIN_A5
101+
#define PB1 PIN_A6
102+
#define PC2 PIN_A7
103+
#define PA2 PIN_A8
104+
// ST Morpho
105+
#define PF6 85
106+
#define PA1 PIN_A9
107+
#define PF4 87
108+
#define PA8 88
109+
#define PA9 89
110+
#define PA10 90
111+
#define PA11 91
112+
#define PA12 92
113+
#define PA13 93 // SWD
114+
#define PA14 94 // SWD
115+
#define PF3 95
116+
#define PF5 96
117+
#define PF10 97
118+
#define PC14 98
119+
#define PC15 99
120+
#define PD10 100
121+
#define PE1 101
122+
#define PF11 102
123+
#define PG4 103
124+
#define PG5 104
125+
#define PG6 105
126+
#define PG7 106
127+
#define PG8 107
128+
#define PG10 108
129+
#define PG11 109
130+
#define PG12 110
131+
#define PG13 111
132+
#define PG15 112
133+
#define PH0 113 // MCO
134+
#define PH1 114
135+
136+
// Alternate pins number
137+
#define PA0_ALT1 (PA0 | ALT1)
138+
#define PA1_ALT1 (PA1 | ALT1)
139+
#define PA2_ALT1 (PA2 | ALT1)
140+
#define PA2_ALT2 (PA2 | ALT2)
141+
#define PA3_ALT1 (PA3 | ALT1)
142+
#define PA3_ALT2 (PA3 | ALT2)
143+
#define PA4_ALT1 (PA4 | ALT1)
144+
#define PA5_ALT1 (PA5 | ALT1)
145+
#define PA6_ALT1 (PA6 | ALT1)
146+
#define PA7_ALT1 (PA7 | ALT1)
147+
#define PA7_ALT2 (PA7 | ALT2)
148+
#define PA7_ALT3 (PA7 | ALT3)
149+
#define PA10_ALT1 (PA10 | ALT1)
150+
#define PA12_ALT1 (PA12 | ALT1)
151+
#define PA15_ALT1 (PA15 | ALT1)
152+
#define PB0_ALT1 (PB0 | ALT1)
153+
#define PB0_ALT2 (PB0 | ALT2)
154+
#define PB1_ALT1 (PB1 | ALT1)
155+
#define PB1_ALT2 (PB1 | ALT2)
156+
#define PB3_ALT1 (PB3 | ALT1)
157+
#define PB4_ALT1 (PB4 | ALT1)
158+
#define PB5_ALT1 (PB5 | ALT1)
159+
#define PB6_ALT1 (PB6 | ALT1)
160+
#define PB8_ALT1 (PB8 | ALT1)
161+
#define PB9_ALT1 (PB9 | ALT1)
162+
#define PB12_ALT1 (PB12 | ALT1)
163+
#define PB13_ALT1 (PB13 | ALT1)
164+
#define PB14_ALT1 (PB14 | ALT1)
165+
#define PB14_ALT2 (PB14 | ALT2)
166+
#define PB15_ALT1 (PB15 | ALT1)
167+
#define PB15_ALT2 (PB15 | ALT2)
168+
#define PC6_ALT1 (PC6 | ALT1)
169+
#define PC7_ALT1 (PC7 | ALT1)
170+
#define PC8_ALT1 (PC8 | ALT1)
171+
#define PC9_ALT1 (PC9 | ALT1)
172+
#define PC11_ALT1 (PC11 | ALT1)
173+
#define PE2_ALT1 (PE2 | ALT1)
174+
#define PE4_ALT1 (PE4 | ALT1)
175+
#define PE5_ALT1 (PE5 | ALT1)
176+
#define PE6_ALT1 (PE6 | ALT1)
177+
#define PE11_ALT1 (PE11 | ALT1)
178+
#define PE12_ALT1 (PE12 | ALT1)
179+
#define PE13_ALT1 (PE13 | ALT1)
180+
#define PE14_ALT1 (PE14 | ALT1)
181+
182+
#define NUM_DIGITAL_PINS 115
183+
#define NUM_ANALOG_INPUTS 16
184+
185+
// On-board LED pin number
186+
#define LED_GREEN PB0
187+
#define LED_BLUE PB7
188+
#define LED_RED PB14
189+
#ifndef LED_BUILTIN
190+
#define LED_BUILTIN LED_GREEN
191+
#endif
192+
193+
// On-board user button
194+
#ifndef USER_BTN
195+
#define USER_BTN PA0
196+
#endif
197+
198+
// Timer Definitions (optional)
199+
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
200+
#ifndef TIMER_TONE
201+
#define TIMER_TONE TIM6
202+
#endif
203+
#ifndef TIMER_SERVO
204+
#define TIMER_SERVO TIM7
205+
#endif
206+
207+
// UART Definitions
208+
#ifndef SERIAL_UART_INSTANCE
209+
#define SERIAL_UART_INSTANCE 3 //ex: 2 for Serial2 (USART2)
210+
#endif
211+
212+
// Default pin used for 'Serial' instance (ex: ST-Link)
213+
// Mandatory for Firmata
214+
#ifndef PIN_SERIAL_RX
215+
#define PIN_SERIAL_RX PD9
216+
#endif
217+
#ifndef PIN_SERIAL_TX
218+
#define PIN_SERIAL_TX PD8
219+
#endif
220+
221+
// SD detect signal
222+
#ifndef SD_DETECT_PIN
223+
#define SD_DETECT_PIN PF11
224+
#endif
225+
226+
/* Extra HAL modules */
227+
#if !defined(HAL_DAC_MODULE_DISABLED)
228+
#define HAL_DAC_MODULE_ENABLED
229+
#endif
230+
#if !defined(HAL_QSPI_MODULE_DISABLED)
231+
#define HAL_QSPI_MODULE_ENABLED
232+
#endif
233+
#if !defined(HAL_SD_MODULE_DISABLED)
234+
#define HAL_SD_MODULE_ENABLED
235+
#endif
236+
237+
/*----------------------------------------------------------------------------
238+
* Arduino objects - C++ only
239+
*----------------------------------------------------------------------------*/
240+
241+
#ifdef __cplusplus
242+
// These serial port names are intended to allow libraries and architecture-neutral
243+
// sketches to automatically default to the correct port name for a particular type
244+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
245+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
246+
//
247+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
248+
//
249+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
250+
//
251+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
252+
//
253+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
254+
//
255+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
256+
// pins are NOT connected to anything by default.
257+
#ifndef SERIAL_PORT_MONITOR
258+
#define SERIAL_PORT_MONITOR Serial
259+
#endif
260+
#ifndef SERIAL_PORT_HARDWARE
261+
#define SERIAL_PORT_HARDWARE Serial
262+
#endif
263+
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.