Skip to content

Commit 36785f1

Browse files
committed
variant: add Nucleo L010RB
Fixes stm32duino#662 Signed-off-by: Frederic Pillon <[email protected]>
1 parent cf6ba78 commit 36785f1

File tree

4 files changed

+298
-0
lines changed

4 files changed

+298
-0
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
107107
| :green_heart: | STM32G071RB | [Nucleo G071RB](https://www.st.com/en/evaluation-tools/nucleo-g071rb.html) | *1.6.0* | |
108108
| :green_heart: | STM32G431RB | [Nucleo G431RB](https://www.st.com/en/evaluation-tools/nucleo-g431rb.html) | *1.7.0* | |
109109
| :green_heart: | STM32G474RE | [Nucleo G474RE](https://www.st.com/en/evaluation-tools/nucleo-g474re.html) | *1.7.0* | |
110+
| :yellow_heart: | STM32L010RB | [Nucleo L010RB](https://www.st.com/en/evaluation-tools/nucleo-l010rb.html) | **2.1.0** | |
110111
| :green_heart: | STM32L053R8 | [Nucleo L053R8](http://www.st.com/en/evaluation-tools/nucleo-l053r8.html) | *0.1.0* | |
111112
| :green_heart: | STM32L073RZ | [Nucleo L073RZ](http://www.st.com/en/evaluation-tools/nucleo-l073rz.html) | *1.4.0* | |
112113
| :green_heart: | STM32L152RE | [Nucleo L152RE](http://www.st.com/en/evaluation-tools/nucleo-l152re.html) | *1.0.0* | |

Diff for: boards.txt

+13
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,19 @@ Nucleo_64.menu.pnum.NUCLEO_G474RE.build.product_line=STM32G474xx
373373
Nucleo_64.menu.pnum.NUCLEO_G474RE.build.variant=STM32G4xx/G473R(B-C-E)T_G474R(B-C-E)T_G483RET_G484RET
374374
Nucleo_64.menu.pnum.NUCLEO_G474RE.build.cmsis_lib_gcc=arm_cortexM4lf_math
375375

376+
# NUCLEO_L010RB board
377+
Nucleo_64.menu.pnum.NUCLEO_L010RB=Nucleo L010RB
378+
Nucleo_64.menu.pnum.NUCLEO_L010RB.node=NODE_L010RB
379+
Nucleo_64.menu.pnum.NUCLEO_L010RB.upload.maximum_size=131072
380+
Nucleo_64.menu.pnum.NUCLEO_L010RB.upload.maximum_data_size=20480
381+
Nucleo_64.menu.pnum.NUCLEO_L010RB.build.mcu=cortex-m0plus
382+
Nucleo_64.menu.pnum.NUCLEO_L010RB.build.board=NUCLEO_L010RB
383+
Nucleo_64.menu.pnum.NUCLEO_L010RB.build.series=STM32L0xx
384+
Nucleo_64.menu.pnum.NUCLEO_L010RB.build.product_line=STM32L010xB
385+
Nucleo_64.menu.pnum.NUCLEO_L010RB.build.variant=STM32L0xx/L010RBT
386+
Nucleo_64.menu.pnum.NUCLEO_L010RB.build.cmsis_lib_gcc=arm_cortexM0l_math
387+
Nucleo_64.menu.pnum.NUCLEO_L010RB.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} -D__CORTEX_SC=0
388+
376389
# NUCLEO_L053R8 board
377390
Nucleo_64.menu.pnum.NUCLEO_L053R8=Nucleo L053R8
378391
Nucleo_64.menu.pnum.NUCLEO_L053R8.node=NODE_L053R8

Diff for: variants/STM32L0xx/L010RBT/variant_NUCLEO_L010RB.cpp

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
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+
#if defined(ARDUINO_NUCLEO_L010RB)
14+
15+
#include "pins_arduino.h"
16+
17+
// Pin number
18+
const PinName digitalPin[] = {
19+
PA_3,
20+
PA_2,
21+
PA_10,
22+
PB_3,
23+
PB_5,
24+
PB_4,
25+
PB_10,
26+
PA_8,
27+
PA_9,
28+
PC_7,
29+
PB_6,
30+
PA_7,
31+
PA_6,
32+
PA_5,
33+
PB_9,
34+
PB_8,
35+
PC_10,
36+
PC_12,
37+
PA_13,
38+
PA_14,
39+
PA_15,
40+
PB_7,
41+
PC_13,
42+
PC_14,
43+
PC_15,
44+
PH_0,
45+
PH_1,
46+
PC_2,
47+
PC_3,
48+
PC_11,
49+
PD_2,
50+
PC_9,
51+
PC_8,
52+
PC_6,
53+
PC_5,
54+
PA_12,
55+
PA_11,
56+
PB_12,
57+
PB_11,
58+
PB_2,
59+
PB_1,
60+
PB_15,
61+
PB_14,
62+
PB_13,
63+
PC_4,
64+
PA_0,
65+
PA_1,
66+
PA_4,
67+
PB_0,
68+
PC_1,
69+
PC_0
70+
};
71+
72+
// Analog (Ax) pin number array
73+
const uint32_t analogInputPin[] = {
74+
45, //A0
75+
46, //A1
76+
47, //A2
77+
48, //A3
78+
49, //A4
79+
50, //A5
80+
11, //A6
81+
12, //A7
82+
27, //A8
83+
28, //A9
84+
34, //A10
85+
44, //A11
86+
0, //A12
87+
1, //A13
88+
13, //A14
89+
40 //A15
90+
};
91+
92+
// ----------------------------------------------------------------------------
93+
94+
#ifdef __cplusplus
95+
extern "C" {
96+
#endif
97+
98+
/**
99+
* @brief System Clock Configuration
100+
* @param None
101+
* @retval None
102+
*/
103+
WEAK void SystemClock_Config(void)
104+
{
105+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
106+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
107+
108+
/** Configure the main internal regulator output voltage
109+
*/
110+
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
111+
/** Initializes the RCC Oscillators according to the specified parameters
112+
* in the RCC_OscInitTypeDef structure.
113+
*/
114+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
115+
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
116+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
117+
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
118+
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLLMUL_8;
119+
RCC_OscInitStruct.PLL.PLLDIV = RCC_PLLDIV_2;
120+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
121+
Error_Handler();
122+
}
123+
/** Initializes the CPU, AHB and APB buses clocks
124+
*/
125+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
126+
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
127+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
128+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
129+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
130+
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
131+
132+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
133+
Error_Handler();
134+
}
135+
}
136+
137+
#ifdef __cplusplus
138+
}
139+
#endif
140+
141+
#endif /* ARDUINO_NUCLEO_L010RB */

Diff for: variants/STM32L0xx/L010RBT/variant_NUCLEO_L010RB.h

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
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 PA3 PIN_A12
19+
#define PA2 PIN_A13
20+
#define PA10 2
21+
#define PB3 3
22+
#define PB5 4
23+
#define PB4 5
24+
#define PB10 6
25+
#define PA8 7
26+
#define PA9 8
27+
#define PC7 9
28+
#define PB6 10 // PWM is not supported by D10 as no timer on PB6
29+
#define PA7 PIN_A6
30+
#define PA6 PIN_A7
31+
#define PA5 PIN_A14
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 PA13 18 // SWD
39+
#define PA14 19 // SWD
40+
#define PA15 20
41+
#define PB7 21
42+
#define PC13 22
43+
#define PC14 23
44+
#define PC15 24
45+
#define PH0 25
46+
#define PH1 26
47+
#define PC2 PIN_A8
48+
#define PC3 PIN_A9
49+
// CN7 Right Side
50+
#define PC11 29
51+
#define PD2 30
52+
// CN10 Left Side
53+
#define PC9 31
54+
// CN10 Right side
55+
#define PC8 32
56+
#define PC6 33
57+
#define PC5 PIN_A10
58+
#define PA12 35
59+
#define PA11 36
60+
#define PB12 37
61+
#define PB11 38
62+
#define PB2 39
63+
#define PB1 PIN_A15
64+
#define PB15 41
65+
#define PB14 42
66+
#define PB13 43
67+
#define PC4 PIN_A11
68+
#define PA0 PIN_A0
69+
#define PA1 PIN_A1
70+
#define PA4 PIN_A2
71+
#define PB0 PIN_A3
72+
#define PC1 PIN_A4 // SB56 ON SB51 ON on the board!
73+
#define PC0 PIN_A5
74+
75+
// Alternate pins number
76+
#define PA2_ALT1 (PA2 | ALT1)
77+
#define PA3_ALT1 (PA3 | ALT1)
78+
#define PA14_ALT1 (PA14 | ALT1)
79+
80+
#define NUM_DIGITAL_PINS 51
81+
#define NUM_ANALOG_INPUTS 16
82+
83+
// On-board LED pin number
84+
#ifndef LED_BUILTIN
85+
#define LED_BUILTIN PA5
86+
#endif
87+
#define LED_GREEN LED_BUILTIN
88+
89+
// On-board user button
90+
#ifndef USER_BTN
91+
#define USER_BTN PC13
92+
#endif
93+
94+
// Timer Definitions
95+
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
96+
#ifndef TIMER_TONE
97+
#define TIMER_TONE TIM21
98+
#endif
99+
#ifndef TIMER_SERVO
100+
#define TIMER_SERVO TIM22
101+
#endif
102+
103+
// UART Definitions
104+
#ifndef SERIAL_UART_INSTANCE
105+
#define SERIAL_UART_INSTANCE 101
106+
#endif
107+
108+
// Default pin used for generic 'Serial' instance
109+
// Mandatory for Firmata
110+
#ifndef PIN_SERIAL_RX
111+
#define PIN_SERIAL_RX PA3
112+
#endif
113+
#ifndef PIN_SERIAL_TX
114+
#define PIN_SERIAL_TX PA2
115+
#endif
116+
117+
/*----------------------------------------------------------------------------
118+
* Arduino objects - C++ only
119+
*----------------------------------------------------------------------------*/
120+
121+
#ifdef __cplusplus
122+
// These serial port names are intended to allow libraries and architecture-neutral
123+
// sketches to automatically default to the correct port name for a particular type
124+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
125+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
126+
//
127+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
128+
//
129+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
130+
//
131+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
132+
//
133+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
134+
//
135+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
136+
// pins are NOT connected to anything by default.
137+
#ifndef SERIAL_PORT_MONITOR
138+
#define SERIAL_PORT_MONITOR Serial
139+
#endif
140+
#ifndef SERIAL_PORT_HARDWARE
141+
#define SERIAL_PORT_HARDWARE Serial
142+
#endif
143+
#endif

0 commit comments

Comments
 (0)