Skip to content

Commit ceb3beb

Browse files
committed
variant(WB): add P-Nucleo WB55 USB Dongle
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 5a3f412 commit ceb3beb

File tree

4 files changed

+331
-1
lines changed

4 files changed

+331
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
130130
| :green_heart: | STM32L452RE-P | [Nucleo L452RE-P](http://www.st.com/en/evaluation-tools/nucleo-l452re-p.html) | *1.8.0* | |
131131
| :green_heart: | STM32L476RG | [Nucleo L476RG](http://www.st.com/en/evaluation-tools/nucleo-l476rg.html) | *0.1.0* | |
132132
| :yellow_heart: | STM32WB15CCU | [Nucleo-WB15CC](https://www.st.com/en/evaluation-tools/nucleo-wb15cc.html) | **2.5.0** | |
133-
| :green_heart: | STM32WB55RG<br>STM32WB55CG | [P-Nucleo-WB55RG](https://www.st.com/en/evaluation-tools/p-nucleo-wb55.html) | *1.6.0* | BLE support with [STM32duinoBLE](https://github.com/stm32duino/STM32duinoBLE) |
133+
| :green_heart: | STM32WB55RG | [P-Nucleo-WB55RG](https://www.st.com/en/evaluation-tools/p-nucleo-wb55.html) | *1.6.0* | BLE support with [STM32duinoBLE](https://github.com/stm32duino/STM32duinoBLE) |
134+
| :yellow_heart: | STM32WB55CG | [P-Nucleo-WB55 USB Dongle](https://www.st.com/en/evaluation-tools/p-nucleo-wb55.html) | **2.5.0** | BLE support with [STM32duinoBLE](https://github.com/stm32duino/STM32duinoBLE) |
134135
| :green_heart: | STM32WL55JC | [Nucleo WL55JC1](https://www.st.com/en/evaluation-tools/nucleo-wl55jc.html) | *2.1.0* | LoRa support not available |
135136

136137

boards.txt

+14
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,20 @@ Nucleo_64.menu.pnum.P_NUCLEO_WB55RG.build.product_line=STM32WB55xx
627627
Nucleo_64.menu.pnum.P_NUCLEO_WB55RG.build.variant=STM32WBxx/WB55R(C-E-G)V
628628
Nucleo_64.menu.pnum.P_NUCLEO_WB55RG.build.cmsis_lib_gcc=arm_cortexM4lf_math
629629

630+
# P_NUCLEO_WB55 USB Dongle
631+
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE=P-Nucleo WB55 USB Dongle
632+
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.node="No_mass_storage_for_this_board_Use_STLink_upload_method"
633+
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.upload.maximum_size=524288
634+
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.upload.maximum_data_size=196608
635+
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.build.mcu=cortex-m4
636+
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.build.fpu=-mfpu=fpv4-sp-d16
637+
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.build.float-abi=-mfloat-abi=hard
638+
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.build.board=P_NUCLEO_WB55_USB_DONGLE
639+
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.build.series=STM32WBxx
640+
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.build.product_line=STM32WB55xx
641+
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.build.variant=STM32WBxx/WB35C(C-E)UxA_WB55C(C-E-G)U
642+
Nucleo_64.menu.pnum.P_NUCLEO_WB55_USB_DONGLE.build.cmsis_lib_gcc=arm_cortexM4lf_math
643+
630644
# NUCLEO_WL55JC1 board
631645
Nucleo_64.menu.pnum.NUCLEO_WL55JC1=Nucleo WL55JC1
632646
Nucleo_64.menu.pnum.NUCLEO_WL55JC1.node="NOD_WL55JC"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2023, 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_P_NUCLEO_WB55_USB_DONGLE)
14+
#include "pins_arduino.h"
15+
#include "lock_resource.h"
16+
17+
// Digital PinName array
18+
const PinName digitalPin[] = {
19+
// CN1
20+
PA_13,
21+
PA_14,
22+
PB_3,
23+
PB_2,
24+
PA_5,
25+
PA_6,
26+
PA_7,
27+
// CN2
28+
PB_8,
29+
PB_9,
30+
PA_0,
31+
PA_2,
32+
PA_3,
33+
PB_6,
34+
PA_9,
35+
PA_8,
36+
PA_1,
37+
PB_7,
38+
// Specific
39+
PC_14,
40+
PC_15,
41+
PH_3,
42+
PA_4,
43+
PB_0,
44+
PB_1,
45+
PA_10,
46+
PA_11,
47+
PA_12
48+
};
49+
50+
// Analog (Ax) pin number array
51+
const uint32_t analogInputPin[] = {
52+
4, // A0
53+
5, // A1
54+
6, // A2
55+
9, // A3
56+
10, // A4
57+
11, // A5
58+
13, // A6
59+
14, // A7
60+
15 // A8
61+
};
62+
63+
// ----------------------------------------------------------------------------
64+
#ifdef __cplusplus
65+
extern "C" {
66+
#endif
67+
68+
/**
69+
* @brief System Clock Configuration
70+
* @param None
71+
* @retval None
72+
*/
73+
WEAK void SystemClock_Config(void)
74+
{
75+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
76+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
77+
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {};
78+
79+
/* This prevents concurrent access to RCC registers by CPU2 (M0+) */
80+
hsem_lock(CFG_HW_RCC_SEMID, HSEM_LOCK_DEFAULT_RETRY);
81+
82+
/* Macro to configure the PLL multiplication factor */
83+
__HAL_RCC_PLL_PLLM_CONFIG(RCC_PLLM_DIV2);
84+
85+
/* Macro to configure the PLL clock source */
86+
__HAL_RCC_PLL_PLLSOURCE_CONFIG(RCC_PLLSOURCE_HSE);
87+
88+
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_MEDIUMHIGH);
89+
/* Configure the main internal regulator output voltage */
90+
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
91+
92+
/* This prevents the CPU2 (M0+) to disable the HSI48 oscillator */
93+
hsem_lock(CFG_HW_CLK48_CONFIG_SEMID, HSEM_LOCK_DEFAULT_RETRY);
94+
95+
/* Initializes the CPU, AHB and APB busses clocks */
96+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_HSI
97+
| RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_LSE;
98+
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
99+
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
100+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
101+
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
102+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
103+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
104+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
105+
Error_Handler();
106+
}
107+
108+
/* Configure the SYSCLKSource, HCLK, PCLK1 and PCLK2 clocks dividers */
109+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK4 | RCC_CLOCKTYPE_HCLK2
110+
| RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
111+
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
112+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSE;
113+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
114+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
115+
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
116+
RCC_ClkInitStruct.AHBCLK2Divider = RCC_SYSCLK_DIV1;
117+
RCC_ClkInitStruct.AHBCLK4Divider = RCC_SYSCLK_DIV1;
118+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
119+
Error_Handler();
120+
}
121+
122+
/* Initializes the peripherals clocks */
123+
/* RNG needs to be configured like in M0 core, i.e. with HSI48 */
124+
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SMPS | RCC_PERIPHCLK_RFWAKEUP
125+
| RCC_PERIPHCLK_RNG | RCC_PERIPHCLK_USB;
126+
PeriphClkInitStruct.RFWakeUpClockSelection = RCC_RFWKPCLKSOURCE_LSE;
127+
PeriphClkInitStruct.RngClockSelection = RCC_RNGCLKSOURCE_HSI48;
128+
PeriphClkInitStruct.SmpsClockSelection = RCC_SMPSCLKSOURCE_HSE;
129+
PeriphClkInitStruct.SmpsDivSelection = RCC_SMPSCLKDIV_RANGE0;
130+
PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
131+
132+
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
133+
Error_Handler();
134+
}
135+
136+
LL_PWR_SMPS_SetStartupCurrent(LL_PWR_SMPS_STARTUP_CURRENT_80MA);
137+
LL_PWR_SMPS_SetOutputVoltageLevel(LL_PWR_SMPS_OUTPUT_VOLTAGE_1V40);
138+
LL_PWR_SMPS_Enable();
139+
140+
/* Select HSI as system clock source after Wake Up from Stop mode */
141+
LL_RCC_SetClkAfterWakeFromStop(LL_RCC_STOP_WAKEUPCLOCK_HSI);
142+
143+
hsem_unlock(CFG_HW_RCC_SEMID);
144+
}
145+
146+
#ifdef __cplusplus
147+
}
148+
#endif
149+
#endif /* ARDUINO_P_NUCLEO_WB55_USB_DONGLE* */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2023, 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+
// CN1
19+
#define PA13 0 // SWDIO
20+
#define PA14 1 // SWCLK
21+
#define PB3 2 // SWO
22+
#define PB2 3 // SPI1 NSS
23+
#define PA5 PIN_A0 // SPI1 SCK
24+
#define PA6 PIN_A1 // SPI1 MISO
25+
#define PA7 PIN_A2 // SPI1 MOSI
26+
// CN2
27+
#define PB8 7 // I2C1 SCL
28+
#define PB9 8 // I2C1 SDA
29+
#define PA0 PIN_A3 // WKUP
30+
#define PA2 PIN_A4 // LPUART1 TX
31+
#define PA3 PIN_A5 // LPUART1 RX
32+
#define PB6 12
33+
#define PA9 PIN_A6 // SB2 close/SB6 open (default)
34+
#define PA8 PIN_A7
35+
#define PA1 PIN_A8
36+
// Same position than PA9 on CN2
37+
#define PB7 16 // SB2 open/SB6 close
38+
// Specific
39+
#define PC14 17 // OSC32-IN
40+
#define PC15 18 // OSC32-OUT
41+
#define PH3 19 // BOOT0
42+
#define PA4 20 // LED1 BLUE
43+
#define PB0 21 // LED2 GREEN
44+
#define PB1 22 // LED3 RED
45+
#define PA10 23 // USER_BTN
46+
#define PA11 24 // USB_DM
47+
#define PA12 25 // USB_DP
48+
49+
// Not connected
50+
// PA15
51+
// PB4
52+
// PB5
53+
// PE4
54+
55+
// Alternate pins number
56+
#define PA7_ALT1 (PA7 | ALT1)
57+
#define PB8_ALT1 (PB8 | ALT1)
58+
#define PB9_ALT1 (PB9 | ALT1)
59+
60+
#define NUM_DIGITAL_PINS 26
61+
#define NUM_ANALOG_INPUTS 9
62+
63+
// On-board LED pin number
64+
#define LED1 PA4
65+
#define LED2 PB0
66+
#define LED3 PB1
67+
#ifndef LED_BUILTIN
68+
#define LED_BUILTIN LED1
69+
#endif
70+
#define LED_BLUE LED1
71+
#define LED_GREEN LED2
72+
#define LED_RED LED3
73+
74+
// On-board user button
75+
// Note: use '_BTN' for SW1 as it is a register name of M24SR64-Y
76+
#define SW1_BTN PA10
77+
#ifndef USER_BTN
78+
#define USER_BTN SW1_BTN
79+
#endif
80+
81+
// SPI definitions
82+
#ifndef PIN_SPI_SS
83+
#define PIN_SPI_SS PB2
84+
#endif
85+
#ifndef PIN_SPI_SS1
86+
#define PIN_SPI_SS1 PB6
87+
#endif
88+
#ifndef PIN_SPI_SS2
89+
#define PIN_SPI_SS2 PA8
90+
#endif
91+
#ifndef PIN_SPI_SS3
92+
#define PIN_SPI_SS3 PNUM_NOT_DEFINED
93+
#endif
94+
#ifndef PIN_SPI_MOSI
95+
#define PIN_SPI_MOSI PA7
96+
#endif
97+
#ifndef PIN_SPI_MISO
98+
#define PIN_SPI_MISO PA6
99+
#endif
100+
#ifndef PIN_SPI_SCK
101+
#define PIN_SPI_SCK PA5
102+
#endif
103+
104+
// I2C definitions
105+
#ifndef PIN_WIRE_SDA
106+
#define PIN_WIRE_SDA PB9
107+
#endif
108+
#ifndef PIN_WIRE_SCL
109+
#define PIN_WIRE_SCL PB8
110+
#endif
111+
112+
// Timer Definitions
113+
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
114+
#ifndef TIMER_TONE
115+
#define TIMER_TONE TIM16
116+
#endif
117+
#ifndef TIMER_SERVO
118+
#define TIMER_SERVO TIM17
119+
#endif
120+
121+
// UART Definitions
122+
#ifndef SERIAL_UART_INSTANCE
123+
#define SERIAL_UART_INSTANCE 101
124+
#endif
125+
126+
// Default pin used for generic 'Serial' instance
127+
// Mandatory for Firmata
128+
#ifndef PIN_SERIAL_RX
129+
#define PIN_SERIAL_RX PA3
130+
#endif
131+
#ifndef PIN_SERIAL_TX
132+
#define PIN_SERIAL_TX PA2
133+
#endif
134+
135+
// Extra HAL modules
136+
#if !defined(HAL_QSPI_MODULE_DISABLED)
137+
#define HAL_QSPI_MODULE_ENABLED
138+
#endif
139+
140+
/*----------------------------------------------------------------------------
141+
* Arduino objects - C++ only
142+
*----------------------------------------------------------------------------*/
143+
144+
#ifdef __cplusplus
145+
// These serial port names are intended to allow libraries and architecture-neutral
146+
// sketches to automatically default to the correct port name for a particular type
147+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
148+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
149+
//
150+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
151+
//
152+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
153+
//
154+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
155+
//
156+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
157+
//
158+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
159+
// pins are NOT connected to anything by default.
160+
#ifndef SERIAL_PORT_MONITOR
161+
#define SERIAL_PORT_MONITOR Serial
162+
#endif
163+
#ifndef SERIAL_PORT_HARDWARE
164+
#define SERIAL_PORT_HARDWARE Serial
165+
#endif
166+
#endif

0 commit comments

Comments
 (0)