Skip to content

Commit 2487a19

Browse files
committed
variant(f3): add Nucleo-F334R8 support
Signed-off-by: Aymane Bahssain <[email protected]>
1 parent e881e8c commit 2487a19

File tree

4 files changed

+340
-0
lines changed

4 files changed

+340
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
139139
| :green_heart: | STM32F103RB | [Nucleo F103RB](http://www.st.com/en/evaluation-tools/nucleo-f103rb.html) | *0.2.0* | |
140140
| :green_heart: | STM32F302R8 | [Nucleo F302R8](http://www.st.com/en/evaluation-tools/nucleo-f302r8.html) | *1.1.0* | |
141141
| :green_heart: | STM32F303RE | [Nucleo F303RE](http://www.st.com/en/evaluation-tools/nucleo-f303re.html) | *0.1.0* | |
142+
| :yellow_heart: | STM32F334R8 | [Nucleo-F334R8](https://www.st.com/en/evaluation-tools/nucleo-f334r8.html) | **2.12.0** | |
142143
| :green_heart: | STM32F401RE | [Nucleo F401RE](http://www.st.com/en/evaluation-tools/nucleo-f401re.html) | *0.2.1* | |
143144
| :green_heart: | STM32F410RB | [Nucleo F410RB](http://www.st.com/en/evaluation-tools/nucleo-f410rb.html) | *2.11.0* | |
144145
| :green_heart: | STM32F411RE | [Nucleo F411RE](http://www.st.com/en/evaluation-tools/nucleo-f411re.html) | *0.2.1* | |

boards.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,21 @@ Nucleo_64.menu.pnum.NUCLEO_F303RE.build.variant=STM32F3xx/F303R(D-E)T
601601
Nucleo_64.menu.pnum.NUCLEO_F303RE.openocd.target=stm32f3x
602602
Nucleo_64.menu.pnum.NUCLEO_F303RE.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32F3xx/STM32F303.svd
603603

604+
# NUCLEO_F334R8 board
605+
Nucleo_64.menu.pnum.NUCLEO_F334R8=Nucleo F334R8
606+
Nucleo_64.menu.pnum.NUCLEO_F334R8.node=NODE_F334R8
607+
Nucleo_64.menu.pnum.NUCLEO_F334R8.upload.maximum_size=65536
608+
Nucleo_64.menu.pnum.NUCLEO_F334R8.upload.maximum_data_size=12288
609+
Nucleo_64.menu.pnum.NUCLEO_F334R8.build.mcu=cortex-m4
610+
Nucleo_64.menu.pnum.NUCLEO_F334R8.build.fpu=-mfpu=fpv4-sp-d16
611+
Nucleo_64.menu.pnum.NUCLEO_F334R8.build.float-abi=-mfloat-abi=hard
612+
Nucleo_64.menu.pnum.NUCLEO_F334R8.build.board=NUCLEO_F334R8
613+
Nucleo_64.menu.pnum.NUCLEO_F334R8.build.series=STM32F3xx
614+
Nucleo_64.menu.pnum.NUCLEO_F334R8.build.product_line=STM32F334x8
615+
Nucleo_64.menu.pnum.NUCLEO_F334R8.build.variant=STM32F3xx/F303R(6-8)T_F334R(6-8)T
616+
Nucleo_64.menu.pnum.NUCLEO_F334R8.openocd.target=stm32f3x
617+
Nucleo_64.menu.pnum.NUCLEO_F334R8.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32F3xx/STM32F334.svd
618+
604619
# NUCLEO_F401RE board
605620
Nucleo_64.menu.pnum.NUCLEO_F401RE=Nucleo F401RE
606621
Nucleo_64.menu.pnum.NUCLEO_F401RE.node="NODE_F401RE,NUCLEO"
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2025, 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_F334R8)
14+
#include "pins_arduino.h"
15+
16+
// Pin number
17+
const PinName digitalPin[] = {
18+
PA_3, //D0/A19
19+
PA_2, //D1/A20
20+
PA_10, //D2
21+
PB_3, //D3
22+
PB_5, //D4
23+
PB_4, //D5
24+
PB_10, //D6
25+
PA_8, //D7
26+
PA_9, //D8
27+
PC_7, //D9
28+
PB_6, //D10
29+
PA_7, //D11/A16
30+
PA_6, //D12/A17
31+
PA_5, //D13/A18
32+
PB_9, //D14
33+
PB_8, //D15
34+
// ST Morpho
35+
// CN7 Left Side
36+
PC_10, //D16
37+
PC_12, //D17
38+
NC, //D18 - BOOT0
39+
PA_13, //D19
40+
PA_14, //D20
41+
PA_15, //D21
42+
PB_7, //D22
43+
PC_13, //D23
44+
PC_14, //D24
45+
PC_15, //D25
46+
PF_0, //D26
47+
PF_1, //D27
48+
PC_2, //D28/A6
49+
PC_3, //D29/A7
50+
// CN7 Right Side
51+
PC_11, //D30
52+
PD_2, //D31
53+
// CN10 Left Side
54+
PC_9, //D32
55+
// CN10 Right side
56+
PC_8, //D33
57+
PC_6, //D34
58+
PC_5, //D35/A8
59+
PA_12, //D36
60+
PA_11, //D37
61+
PB_12, //D38/A9
62+
PB_11, //D39
63+
PB_2, //D40/A10
64+
PB_1, //D41/A11
65+
PB_15, //D42/A12
66+
PB_14, //D43/A13
67+
PB_13, //D44/A14
68+
PC_4, //D45/A15
69+
PA_0, //D46/A0
70+
PA_1, //D47/A1
71+
PA_4, //D48/A2
72+
PB_0, //D49/A3
73+
PC_1, //D50/A4
74+
PC_0 //D51/A5
75+
};
76+
77+
// Analog (Ax) pin number array
78+
const uint32_t analogInputPin[] = {
79+
46, //A0
80+
47, //A1
81+
48, //A2
82+
49, //A3
83+
50, //A4
84+
51, //A5
85+
28, //A6
86+
29, //A7
87+
35, //A8
88+
38, //A9
89+
40, //A10
90+
41, //A11
91+
42, //A12
92+
43, //A13
93+
44, //A13
94+
45, //A15
95+
11, //A16
96+
12, //A17
97+
13, //A18
98+
0, //A19
99+
1, //A20
100+
};
101+
102+
// ----------------------------------------------------------------------------
103+
104+
#ifdef __cplusplus
105+
extern "C" {
106+
#endif
107+
108+
/**
109+
* @brief System Clock Configuration
110+
* @param None
111+
* @retval None
112+
*/
113+
WEAK void SystemClock_Config(void)
114+
{
115+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
116+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
117+
118+
/** Initializes the RCC Oscillators according to the specified parameters
119+
* in the RCC_OscInitTypeDef structure.
120+
*/
121+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
122+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
123+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
124+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
125+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
126+
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL16;
127+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
128+
Error_Handler();
129+
}
130+
131+
/** Initializes the CPU, AHB and APB buses clocks
132+
*/
133+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
134+
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
135+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
136+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
137+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
138+
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
139+
140+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
141+
Error_Handler();
142+
}
143+
}
144+
145+
#ifdef __cplusplus
146+
}
147+
#endif
148+
149+
#endif /* ARDUINO_NUCLEO_F303RE */
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2025, 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+
// Right Side
20+
// CN9
21+
#define PA3 PIN_A19
22+
#define PA2 PIN_A20
23+
#define PA10 2
24+
#define PB3 3
25+
#define PB5 4
26+
#define PB4 5
27+
#define PB10 6
28+
#define PA8 7
29+
// CN5
30+
#define PA9 8
31+
#define PC7 9
32+
#define PB6 10
33+
#define PA7 PIN_A16
34+
#define PA6 PIN_A17
35+
#define PA5 PIN_A18
36+
#define PB9 14
37+
#define PB8 15
38+
// Left Side
39+
// ST Morpho
40+
// CN7 Left Side
41+
#define PC10 16
42+
#define PC12 17
43+
//18 // BOOT0 NC NC
44+
#define PA13 19
45+
#define PA14 20
46+
#define PA15 21
47+
#define PB7 22
48+
#define PC13 23
49+
#define PC14 24
50+
#define PC15 25
51+
#define PF0 26
52+
#define PF1 27
53+
#define PC2 PIN_A6
54+
#define PC3 PIN_A7
55+
// CN7 Right Side
56+
#define PC11 30
57+
#define PD2 31
58+
// CN10 Left Side
59+
#define PC9 32
60+
// CN10 Right side
61+
#define PC8 33
62+
#define PC6 34
63+
#define PC5 PIN_A8
64+
#define PA12 36
65+
#define PA11 37
66+
#define PB12 PIN_A9
67+
#define PB11 39
68+
#define PB2 PIN_A10
69+
#define PB1 PIN_A11
70+
#define PB15 PIN_A12
71+
#define PB14 PIN_A13
72+
#define PB13 PIN_A14
73+
#define PC4 PIN_A15
74+
75+
#define PA0 PIN_A0
76+
#define PA1 PIN_A1
77+
#define PA4 PIN_A2
78+
#define PB0 PIN_A3
79+
#define PC1 PIN_A4
80+
#define PC0 PIN_A5
81+
82+
83+
// Alternate pins number
84+
#define PA1_ALT1 (PA1 | ALT1)
85+
#define PA2_ALT1 (PA2 | ALT1)
86+
#define PA3_ALT1 (PA3 | ALT1)
87+
#define PA6_ALT1 (PA6 | ALT1)
88+
#define PA7_ALT1 (PA7 | ALT1)
89+
#define PA7_ALT2 (PA7 | ALT2)
90+
#define PA9_ALT1 (PA9 | ALT1)
91+
#define PA10_ALT1 (PA10 | ALT1)
92+
#define PA11_ALT1 (PA11 | ALT1)
93+
#define PA12_ALT1 (PA12 | ALT1)
94+
#define PB0_ALT1 (PB0 | ALT1)
95+
#define PB1_ALT1 (PB1 | ALT1)
96+
#define PB4_ALT1 (PB4 | ALT1)
97+
#define PB5_ALT1 (PB5 | ALT1)
98+
#define PB7_ALT1 (PB7 | ALT1)
99+
#define PB14_ALT1 (PB14 | ALT1)
100+
#define PB15_ALT1 (PB15 | ALT1)
101+
#define PB15_ALT2 (PB15 | ALT2)
102+
#define PC0_ALT1 (PC0 | ALT1)
103+
#define PC1_ALT1 (PC1 | ALT1)
104+
#define PC2_ALT1 (PC2 | ALT1)
105+
#define PC3_ALT1 (PC3 | ALT1)
106+
107+
#define NUM_DIGITAL_PINS 52
108+
#define NUM_ANALOG_INPUTS 21
109+
110+
// On-board LED pin number
111+
#ifndef LED_BUILTIN
112+
#define LED_BUILTIN LED_GREEN
113+
#endif
114+
#define LED_GREEN PA5
115+
116+
// On-board user button
117+
#ifndef USER_BTN
118+
#define USER_BTN PC13
119+
#endif
120+
121+
// Timer Definitions
122+
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
123+
#ifndef TIMER_TONE
124+
#define TIMER_TONE TIM6
125+
#endif
126+
#ifndef TIMER_SERVO
127+
#define TIMER_SERVO TIM7
128+
#endif
129+
130+
// UART Definitions
131+
#ifndef SERIAL_UART_INSTANCE
132+
#define SERIAL_UART_INSTANCE 2 //Connected to ST-Link
133+
#endif
134+
135+
// Default pin used for 'Serial' instance (ex: ST-Link)
136+
// Mandatory for Firmata
137+
#ifndef PIN_SERIAL_RX
138+
#define PIN_SERIAL_RX PA3
139+
#endif
140+
#ifndef PIN_SERIAL_TX
141+
#define PIN_SERIAL_TX PA2
142+
#endif
143+
144+
/* Extra HAL modules */
145+
#if !defined(HAL_DAC_MODULE_DISABLED)
146+
#define HAL_DAC_MODULE_ENABLED
147+
#endif
148+
149+
/*----------------------------------------------------------------------------
150+
* Arduino objects - C++ only
151+
*----------------------------------------------------------------------------*/
152+
153+
#ifdef __cplusplus
154+
// These serial port names are intended to allow libraries and architecture-neutral
155+
// sketches to automatically default to the correct port name for a particular type
156+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
157+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
158+
//
159+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
160+
//
161+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
162+
//
163+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
164+
//
165+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
166+
//
167+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
168+
// pins are NOT connected to anything by default.
169+
#ifndef SERIAL_PORT_MONITOR
170+
#define SERIAL_PORT_MONITOR Serial
171+
#endif
172+
#ifndef SERIAL_PORT_HARDWARE
173+
#define SERIAL_PORT_HARDWARE Serial
174+
#endif
175+
#endif

0 commit comments

Comments
 (0)