Skip to content

Commit b5a0cd0

Browse files
committed
variant: G0: add Nucleo-G0B1RE
Signed-off-by: Frederic Pillon <[email protected]>
1 parent 1c6c51a commit b5a0cd0

File tree

4 files changed

+377
-0
lines changed

4 files changed

+377
-0
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
105105
| :green_heart: | STM32F411RE | [Nucleo F411RE](http://www.st.com/en/evaluation-tools/nucleo-f411re.html) | *0.2.1* | |
106106
| :green_heart: | STM32F446RE | [Nucleo F446RE](http://www.st.com/en/evaluation-tools/nucleo-f446re.html) | *1.1.1* | |
107107
| :green_heart: | STM32G071RB | [Nucleo G071RB](https://www.st.com/en/evaluation-tools/nucleo-g071rb.html) | *1.6.0* | |
108+
| :yellow_heart: | STM32G0B1RE | [Nucleo G0B1RE](https://www.st.com/en/evaluation-tools/nucleo-g0b1re.html) | **2.1.0** | |
108109
| :green_heart: | STM32G431RB | [Nucleo G431RB](https://www.st.com/en/evaluation-tools/nucleo-g431rb.html) | *1.7.0* | |
109110
| :green_heart: | STM32G474RE | [Nucleo G474RE](https://www.st.com/en/evaluation-tools/nucleo-g474re.html) | *1.7.0* | |
110111
| :yellow_heart: | STM32L010RB | [Nucleo L010RB](https://www.st.com/en/evaluation-tools/nucleo-l010rb.html) | **2.1.0** | |

Diff for: boards.txt

+13
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,19 @@ Nucleo_64.menu.pnum.NUCLEO_G071RB.build.variant=STM32G0xx/G071R(6-8)T_G071RB(I-T
347347
Nucleo_64.menu.pnum.NUCLEO_G071RB.build.cmsis_lib_gcc=arm_cortexM0l_math
348348
Nucleo_64.menu.pnum.NUCLEO_G071RB.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} -D__CORTEX_SC=0
349349

350+
# NUCLEO_G0B1RE board
351+
Nucleo_64.menu.pnum.NUCLEO_G0B1RE=Nucleo G0B1RE
352+
Nucleo_64.menu.pnum.NUCLEO_G0B1RE.node=NOD_G0B1RE
353+
Nucleo_64.menu.pnum.NUCLEO_G0B1RE.upload.maximum_size=262144
354+
Nucleo_64.menu.pnum.NUCLEO_G0B1RE.upload.maximum_data_size=147456
355+
Nucleo_64.menu.pnum.NUCLEO_G0B1RE.build.mcu=cortex-m0plus
356+
Nucleo_64.menu.pnum.NUCLEO_G0B1RE.build.board=NUCLEO_G0B1RE
357+
Nucleo_64.menu.pnum.NUCLEO_G0B1RE.build.series=STM32G0xx
358+
Nucleo_64.menu.pnum.NUCLEO_G0B1RE.build.product_line=STM32G0B1xx
359+
Nucleo_64.menu.pnum.NUCLEO_G0B1RE.build.variant=STM32G0xx/G0B1R(B-C-E)T_G0C1R(C-E)T
360+
Nucleo_64.menu.pnum.NUCLEO_G0B1RE.build.cmsis_lib_gcc=arm_cortexM0l_math
361+
Nucleo_64.menu.pnum.NUCLEO_G0B1RE.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} -D__CORTEX_SC=0
362+
350363
# NUCLEO_G431RB board
351364
Nucleo_64.menu.pnum.NUCLEO_G431RB=Nucleo G431RB
352365
Nucleo_64.menu.pnum.NUCLEO_G431RB.node="NODE_G431RB,NOD_G431RB"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2021, 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_G0B1RE)
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_12,
66+
PA_11,
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+
RCC_PeriphCLKInitTypeDef PeriphClkInit = {};
124+
125+
/** Configure the main internal regulator output voltage
126+
*/
127+
HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1);
128+
/** Initializes the RCC Oscillators according to the specified parameters
129+
* in the RCC_OscInitTypeDef structure.
130+
*/
131+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSI48;
132+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
133+
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
134+
RCC_OscInitStruct.HSIDiv = RCC_HSI_DIV1;
135+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
136+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
137+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
138+
RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV1;
139+
RCC_OscInitStruct.PLL.PLLN = 8;
140+
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
141+
RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
142+
RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
143+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
144+
Error_Handler();
145+
}
146+
/** Initializes the CPU, AHB and APB buses clocks
147+
*/
148+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
149+
| RCC_CLOCKTYPE_PCLK1;
150+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
151+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
152+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
153+
154+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
155+
Error_Handler();
156+
}
157+
/** Initializes the peripherals clocks
158+
*/
159+
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USB;
160+
PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
161+
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
162+
Error_Handler();
163+
}
164+
}
165+
166+
#ifdef __cplusplus
167+
}
168+
#endif
169+
#endif /* ARDUINO_NUCLEO_G0B1RE */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2021, 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 PA12 41
65+
#define PA11 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 PA1_ALT1 (PA1 | ALT1)
88+
#define PA2_ALT1 (PA2 | ALT1)
89+
#define PA3_ALT1 (PA3 | ALT1)
90+
#define PA4_ALT1 (PA4 | ALT1)
91+
#define PA6_ALT1 (PA6 | ALT1)
92+
#define PA6_ALT2 (PA6 | ALT2)
93+
#define PA7_ALT1 (PA7 | ALT1)
94+
#define PA7_ALT2 (PA7 | ALT2)
95+
#define PA7_ALT3 (PA7 | ALT3)
96+
#define PA9_ALT1 (PA9 | ALT1)
97+
#define PA9_R_ALT1 (PA9_R | ALT1)
98+
#define PA10_ALT1 (PA10 | ALT1)
99+
#define PA10_R_ALT1 (PA10_R | ALT1)
100+
#define PA14_ALT1 (PA14 | ALT1)
101+
#define PA15_ALT1 (PA15 | ALT1)
102+
#define PB0_ALT1 (PB0 | ALT1)
103+
#define PB1_ALT1 (PB1 | ALT1)
104+
#define PB1_ALT2 (PB1 | ALT2)
105+
#define PB3_ALT1 (PB3 | ALT1)
106+
#define PB4_ALT1 (PB4 | ALT1)
107+
#define PB5_ALT1 (PB5 | ALT1)
108+
#define PB6_ALT1 (PB6 | ALT1)
109+
#define PB6_ALT2 (PB6 | ALT2)
110+
#define PB7_ALT1 (PB7 | ALT1)
111+
#define PB8_ALT1 (PB8 | ALT1)
112+
#define PB9_ALT1 (PB9 | ALT1)
113+
#define PB13_ALT1 (PB13 | ALT1)
114+
#define PB14_ALT1 (PB14 | ALT1)
115+
#define PB15_ALT1 (PB15 | ALT1)
116+
#define PB15_ALT2 (PB15 | ALT2)
117+
#define PC0_ALT1 (PC0 | ALT1)
118+
#define PC1_ALT1 (PC1 | ALT1)
119+
#define PC4_ALT1 (PC4 | ALT1)
120+
#define PC5_ALT1 (PC5 | ALT1)
121+
#define PC6_ALT1 (PC6 | ALT1)
122+
#define PC7_ALT1 (PC7 | ALT1)
123+
#define PC8_ALT1 (PC8 | ALT1)
124+
#define PC9_ALT1 (PC9 | ALT1)
125+
#define PC10_ALT1 (PC10 | ALT1)
126+
#define PC11_ALT1 (PC11 | ALT1)
127+
#define PD4_ALT1 (PD4 | ALT1)
128+
129+
#define NUM_DIGITAL_PINS 62
130+
#define NUM_REMAP_PINS 2
131+
#define NUM_ANALOG_INPUTS 16
132+
133+
// On-board LED pin number
134+
#ifndef LED_BUILTIN
135+
#define LED_BUILTIN PA5
136+
#endif
137+
#define LED_GREEN LED_BUILTIN
138+
139+
// On-board user button
140+
#ifndef USER_BTN
141+
#define USER_BTN PC13
142+
#endif
143+
144+
// Timer Definitions
145+
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
146+
#ifndef TIMER_TONE
147+
#define TIMER_TONE TIM6
148+
#endif
149+
#ifndef TIMER_SERVO
150+
#define TIMER_SERVO TIM7
151+
#endif
152+
153+
// UART Definitions
154+
#ifndef SERIAL_UART_INSTANCE
155+
#define SERIAL_UART_INSTANCE 101 //Connected to ST-Link
156+
#endif
157+
158+
// Default pin used for 'Serial' instance (ex: ST-Link)
159+
// Mandatory for Firmata
160+
#ifndef PIN_SERIAL_RX
161+
#define PIN_SERIAL_RX PA3
162+
#endif
163+
#ifndef PIN_SERIAL_TX
164+
#define PIN_SERIAL_TX PA2
165+
#endif
166+
167+
// Extra HAL modules
168+
#if !defined(HAL_DAC_MODULE_DISABLED)
169+
#define HAL_DAC_MODULE_ENABLED
170+
#endif
171+
172+
/*----------------------------------------------------------------------------
173+
* Arduino objects - C++ only
174+
*----------------------------------------------------------------------------*/
175+
176+
#ifdef __cplusplus
177+
// These serial port names are intended to allow libraries and architecture-neutral
178+
// sketches to automatically default to the correct port name for a particular type
179+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
180+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
181+
//
182+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
183+
//
184+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
185+
//
186+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
187+
//
188+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
189+
//
190+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
191+
// pins are NOT connected to anything by default.
192+
#define SERIAL_PORT_MONITOR Serial
193+
#define SERIAL_PORT_HARDWARE Serial2
194+
#endif

0 commit comments

Comments
 (0)