Skip to content

Commit 58264d2

Browse files
committed
variant: G0: add Nucleo-G070RB
Signed-off-by: TLIG Dhaou <[email protected]>
1 parent ab95f98 commit 58264d2

File tree

4 files changed

+342
-0
lines changed

4 files changed

+342
-0
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
111111
| :green_heart: | STM32F401RE | [Nucleo F401RE](http://www.st.com/en/evaluation-tools/nucleo-f401re.html) | *0.2.1* | |
112112
| :green_heart: | STM32F411RE | [Nucleo F411RE](http://www.st.com/en/evaluation-tools/nucleo-f411re.html) | *0.2.1* | |
113113
| :green_heart: | STM32F446RE | [Nucleo F446RE](http://www.st.com/en/evaluation-tools/nucleo-f446re.html) | *1.1.1* | |
114+
| :yellow_heart: | STM32G070RB | [Nucleo G070RB](https://www.st.com/en/evaluation-tools/nucleo-g070rb.html) | **2.3.0** | |
114115
| :green_heart: | STM32G071RB | [Nucleo G071RB](https://www.st.com/en/evaluation-tools/nucleo-g071rb.html) | *1.6.0* | |
115116
| :green_heart: | STM32G0B1RE | [Nucleo G0B1RE](https://www.st.com/en/evaluation-tools/nucleo-g0b1re.html) | *2.1.0* | |
116117
| :green_heart: | STM32G431RB | [Nucleo G431RB](https://www.st.com/en/evaluation-tools/nucleo-g431rb.html) | *1.7.0* | |

Diff for: boards.txt

+13
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,19 @@ Nucleo_64.menu.pnum.NUCLEO_F446RE.build.product_line=STM32F446xx
366366
Nucleo_64.menu.pnum.NUCLEO_F446RE.build.variant=STM32F4xx/F446R(C-E)T
367367
Nucleo_64.menu.pnum.NUCLEO_F446RE.build.cmsis_lib_gcc=arm_cortexM4lf_math
368368

369+
# NUCLEO_G070RB board
370+
Nucleo_64.menu.pnum.NUCLEO_G070RB=Nucleo G070RB
371+
Nucleo_64.menu.pnum.NUCLEO_G070RB.node=NODE_G070RB
372+
Nucleo_64.menu.pnum.NUCLEO_G070RB.upload.maximum_size=131072
373+
Nucleo_64.menu.pnum.NUCLEO_G070RB.upload.maximum_data_size=36864
374+
Nucleo_64.menu.pnum.NUCLEO_G070RB.build.mcu=cortex-m0plus
375+
Nucleo_64.menu.pnum.NUCLEO_G070RB.build.board=NUCLEO_G070RB
376+
Nucleo_64.menu.pnum.NUCLEO_G070RB.build.series=STM32G0xx
377+
Nucleo_64.menu.pnum.NUCLEO_G070RB.build.product_line=STM32G070xx
378+
Nucleo_64.menu.pnum.NUCLEO_G070RB.build.variant=STM32G0xx/G070RBT
379+
Nucleo_64.menu.pnum.NUCLEO_G070RB.build.cmsis_lib_gcc=arm_cortexM0l_math
380+
Nucleo_64.menu.pnum.NUCLEO_G070RB.build.st_extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} -D__CORTEX_SC=0
381+
369382
# NUCLEO_G071RB board
370383
Nucleo_64.menu.pnum.NUCLEO_G071RB=Nucleo G071RB
371384
Nucleo_64.menu.pnum.NUCLEO_G071RB.node=NODE_G071RB

Diff for: variants/STM32G0xx/G070RBT/variant_NUCLEO_G070RB.cpp

+160
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 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+
14+
#if defined(ARDUINO_NUCLEO_G070RB)
15+
#include "pins_arduino.h"
16+
17+
// Pin number
18+
const PinName digitalPin[] = {
19+
PC_5,
20+
PC_4,
21+
PA_10,
22+
PB_3,
23+
PB_5,
24+
PB_4,
25+
PB_14,
26+
PA_8,
27+
PA_9,
28+
PC_7,
29+
PB_0,
30+
PA_7,
31+
PA_6,
32+
PA_5,
33+
PB_9,
34+
PB_8,
35+
// ST Morpho
36+
// CN7 Left Side
37+
PC_10,
38+
PC_12,
39+
PA_14,
40+
PD_0,
41+
PD_3,
42+
PA_13,
43+
PD_4,
44+
PA_15,
45+
PB_7,
46+
PC_13,
47+
PC_14,
48+
PC_15,
49+
PF_0,
50+
PF_1,
51+
PC_2,
52+
PC_3,
53+
// CN7 Right Side
54+
PC_11,
55+
PD_2,
56+
PD_1,
57+
PD_5,
58+
// CN10 Left Side
59+
PC_9,
60+
// CN10 Right side
61+
PC_8,
62+
PC_6,
63+
PA_3,
64+
PD_6,
65+
PA_11,
66+
PA_12,
67+
PC_1,
68+
PC_0,
69+
PB_2,
70+
PB_6,
71+
PB_15,
72+
PB_10,
73+
PB_13,
74+
PA_2,
75+
PD_8,
76+
PD_9,
77+
PA_0,
78+
PA_1,
79+
PA_4,
80+
PB_1,
81+
PB_11,
82+
PB_12,
83+
PF_2,
84+
PA_9_R,
85+
PA_10_R
86+
};
87+
88+
// Analog (Ax) pin number array
89+
const uint32_t analogInputPin[] = {
90+
53, //A0
91+
54, //A1
92+
55, //A2
93+
56, //A3
94+
57, //A4
95+
58, //A5
96+
11, //A6
97+
12, //A7
98+
45, //A8
99+
48, //A9
100+
0, //A10
101+
1, //A11
102+
10, //A12
103+
13, //A13 - LED
104+
39, //A14 - STLINK RX
105+
50 //A15 - STLINK TX
106+
};
107+
108+
// ----------------------------------------------------------------------------
109+
110+
#ifdef __cplusplus
111+
extern "C" {
112+
#endif
113+
114+
/**
115+
* @brief System Clock Configuration
116+
* @param None
117+
* @retval None
118+
*/
119+
WEAK void SystemClock_Config(void)
120+
{
121+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
122+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
123+
124+
/** Configure the main internal regulator output voltage
125+
*/
126+
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1);
127+
/** Initializes the RCC Oscillators according to the specified parameters
128+
* in the RCC_OscInitTypeDef structure.
129+
*/
130+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
131+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
132+
RCC_OscInitStruct.HSIDiv = RCC_HSI_DIV1;
133+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
134+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
135+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
136+
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1;
137+
RCC_OscInitStruct.PLL.PLLN = 8;
138+
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
139+
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
140+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
141+
Error_Handler();
142+
}
143+
/** Initializes the CPU, AHB and APB buses clocks
144+
*/
145+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
146+
| RCC_CLOCKTYPE_PCLK1;
147+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
148+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
149+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
150+
151+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
152+
Error_Handler();
153+
}
154+
}
155+
156+
157+
#ifdef __cplusplus
158+
}
159+
#endif
160+
#endif /* ARDUINO_NUCLEO_G070RB */

Diff for: variants/STM32G0xx/G070RBT/variant_NUCLEO_G070RB.h

+168
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 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+
#define PC5 PIN_A10
19+
#define PC4 PIN_A11
20+
#define PA10 2
21+
#define PB3 3
22+
#define PB5 4
23+
#define PB4 5
24+
#define PB14 6
25+
#define PA8 7
26+
#define PA9 8
27+
#define PC7 9
28+
#define PB0 PIN_A12
29+
#define PA7 PIN_A6
30+
#define PA6 PIN_A7
31+
#define PA5 PIN_A13 // LED
32+
#define PB9 14
33+
#define PB8 15
34+
// ST Morpho
35+
// CN7 Left Side
36+
#define PC10 16
37+
#define PC12 17
38+
#define PA14 18 // SWD
39+
#define PD0 19
40+
#define PD3 20
41+
#define PA13 21 // SWD
42+
#define PD4 22
43+
#define PA15 23
44+
#define PB7 24
45+
#define PC13 25
46+
#define PC14 26
47+
#define PC15 27
48+
#define PF0 28
49+
#define PF1 29
50+
#define PC2 30
51+
#define PC3 31
52+
// CN7 Right Side
53+
#define PC11 32
54+
#define PD2 33
55+
#define PD1 34
56+
#define PD5 35
57+
// CN10 Left Side
58+
#define PC9 36
59+
// CN10 Right side
60+
#define PC8 37
61+
#define PC6 38
62+
#define PA3 PIN_A14
63+
#define PD6 40
64+
#define PA11 41
65+
#define PA12 42
66+
#define PC1 43
67+
#define PC0 44
68+
#define PB2 PIN_A8
69+
#define PB6 46
70+
#define PB15 47
71+
#define PB10 PIN_A9
72+
#define PB13 49
73+
#define PA2 PIN_A15
74+
#define PD8 51
75+
#define PD9 52
76+
#define PA0 PIN_A0
77+
#define PA1 PIN_A1
78+
#define PA4 PIN_A2
79+
#define PB1 PIN_A3
80+
#define PB11 PIN_A4
81+
#define PB12 PIN_A5
82+
#define PF2 59
83+
#define PA9_R 60
84+
#define PA10_R 61
85+
86+
// Alternate pins number
87+
#define PA6_ALT1 (PA6 | ALT1)
88+
#define PA7_ALT1 (PA7 | ALT1)
89+
#define PA7_ALT2 (PA7 | ALT2)
90+
#define PA7_ALT3 (PA7 | ALT3)
91+
#define PA15_ALT1 (PA15 | ALT1)
92+
#define PB0_ALT1 (PB0 | ALT1)
93+
#define PB1_ALT1 (PB1 | ALT1)
94+
#define PB1_ALT2 (PB1 | ALT2)
95+
#define PB6_ALT1 (PB6 | ALT1)
96+
#define PB13_ALT1 (PB13 | ALT1)
97+
#define PB14_ALT1 (PB14 | ALT1)
98+
#define PB15_ALT1 (PB15 | ALT1)
99+
#define PB15_ALT2 (PB15 | ALT2)
100+
#define PC4_ALT1 (PC4 | ALT1)
101+
#define PC5_ALT1 (PC5 | ALT1)
102+
#define PC8_ALT1 (PC8 | ALT1)
103+
#define PC9_ALT1 (PC9 | ALT1)
104+
#define PC10_ALT1 (PC10 | ALT1)
105+
#define PC11_ALT1 (PC11 | ALT1)
106+
107+
#define NUM_DIGITAL_PINS 62
108+
#define NUM_REMAP_PINS 2
109+
#define NUM_ANALOG_INPUTS 16
110+
111+
// On-board LED pin number
112+
#ifndef LED_BUILTIN
113+
#define LED_BUILTIN PA5
114+
#endif
115+
#define LED_GREEN LED_BUILTIN
116+
117+
// On-board user button
118+
#ifndef USER_BTN
119+
#define USER_BTN PC13
120+
#endif
121+
122+
// Timer Definitions
123+
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
124+
#ifndef TIMER_TONE
125+
#define TIMER_TONE TIM6
126+
#endif
127+
#ifndef TIMER_SERVO
128+
#define TIMER_SERVO TIM7
129+
#endif
130+
131+
// UART Definitions
132+
#ifndef SERIAL_UART_INSTANCE
133+
#define SERIAL_UART_INSTANCE 2 //Connected to ST-Link
134+
#endif
135+
136+
// Default pin used for 'Serial' instance (ex: ST-Link)
137+
// Mandatory for Firmata
138+
#ifndef PIN_SERIAL_RX
139+
#define PIN_SERIAL_RX PA3
140+
#endif
141+
#ifndef PIN_SERIAL_TX
142+
#define PIN_SERIAL_TX PA2
143+
#endif
144+
145+
146+
/*----------------------------------------------------------------------------
147+
* Arduino objects - C++ only
148+
*----------------------------------------------------------------------------*/
149+
150+
#ifdef __cplusplus
151+
// These serial port names are intended to allow libraries and architecture-neutral
152+
// sketches to automatically default to the correct port name for a particular type
153+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
154+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
155+
//
156+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
157+
//
158+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
159+
//
160+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
161+
//
162+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
163+
//
164+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
165+
// pins are NOT connected to anything by default.
166+
#define SERIAL_PORT_MONITOR Serial
167+
#define SERIAL_PORT_HARDWARE Serial2
168+
#endif

0 commit comments

Comments
 (0)