Skip to content

Commit b3336e9

Browse files
committed
support for ARDUINO_WEACT_WB55CGU6
1 parent fb216f3 commit b3336e9

5 files changed

Lines changed: 312 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
819819
| :----: | :-------: | ---- | :-----: | :---- |
820820
| :green_heart: | STM32WB15CCU | Generic Board | *2.5.0* | |
821821
| :green_heart: | STM32WB55CC<br>STM32WB55CE<br>STM32WB55CG | Generic Board | *2.0.0* | |
822+
| :yellow_heart: | STM32WB55CGU | [WeAct STM32WB55CGU6](https://github.com/WeActStudio/WeActStudio.STM32WB55CoreBoard) | **3.0.0** | |
822823
| :green_heart: | STM32WB5MMG | Generic Board | *2.1.0* | |
823824
| :green_heart: | STM32WB55RC<br>STM32WB55RE<br>STM32WB55RG | Generic Board | *2.0.0* | |
824825
| :green_heart: | STM32WB55VC<br>STM32WB55VE<br>STM32WB55VG | Generic Board | *2.10.0* | |

‎boards.txt‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13674,6 +13674,16 @@ GenWB.menu.pnum.GENERIC_WB5MMGHX.build.product_line=STM32WB5Mxx
1367413674
GenWB.menu.pnum.GENERIC_WB5MMGHX.build.variant=STM32WBxx/WB5MMGH
1367513675
GenWB.menu.pnum.GENERIC_WB5MMGHX.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32WBxx/STM32WB55_CM4.svd
1367613676

13677+
# WeAct STM32WB55CGU6
13678+
GenWB.menu.pnum.WEACT_WB55CGU6=WeAct STM32WB55CGU6
13679+
GenWB.menu.pnum.WEACT_WB55CGU6.upload.maximum_size=524288
13680+
GenWB.menu.pnum.WEACT_WB55CGU6.upload.maximum_data_size=196608
13681+
GenWB.menu.pnum.WEACT_WB55CGU6.build.board=WEACT_WB55CGU6
13682+
GenWB.menu.pnum.WEACT_WB55CGU6.build.product_line=STM32WB55xx
13683+
GenWB.menu.pnum.WEACT_WB55CGU6.build.variant=STM32WBxx/WB35C(C-E)UxA_WB55C(C-E-G)U
13684+
GenWB.menu.pnum.WEACT_WB55CGU6.build.variant_h=variant_WEACT_WB55CGU6.h
13685+
GenWB.menu.pnum.WEACT_WB55CGU6.debug.svd_file={runtime.tools.STM32_SVD.path}/svd/STM32WBxx/STM32WB55_CM4.svd
13686+
1367713687

1367813688
# Upload menu
1367913689
GenWB.menu.upload_method.swdMethod=STM32CubeProgrammer (SWD)

‎variants/STM32WBxx/WB35C(C-E)UxA_WB55C(C-E-G)U/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ add_library(variant_bin STATIC EXCLUDE_FROM_ALL
2424
variant_generic.cpp
2525
variant_MKR_SHARKY.cpp
2626
variant_P_NUCLEO_WB55_USB_DONGLE.cpp
27+
variant_WEACT_WB55CGU6.cpp
2728
)
2829
target_link_libraries(variant_bin PUBLIC variant_usage)
2930

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2026, 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_WEACT_WB55CGU6)
14+
#include "pins_arduino.h"
15+
#include "lock_resource.h"
16+
17+
// Digital PinName array
18+
const PinName digitalPin[] = {
19+
PB_2, // D0
20+
PA_9, // D1
21+
PA_8, // D2
22+
PA_7, // D3
23+
PA_6, // D4
24+
PA_5, // D5
25+
PA_4, // D6
26+
PA_3, // D7
27+
PA_2, // D8
28+
PA_1, // D9
29+
PA_0, // D10
30+
PB_8, // D11
31+
PB_9, // D12
32+
PH_3, // D13 - BOOT0 / SW2 button
33+
PB_0, // D14
34+
PB_1, // D15
35+
PE_4, // D16 - onboard blue LED
36+
PA_10, // D17
37+
PA_15, // D18
38+
PB_3, // D19
39+
PB_4, // D20
40+
PB_5, // D21
41+
PB_6, // D22
42+
PB_7 // D23
43+
};
44+
45+
// Analog (Ax) pin number array
46+
const pin_size_t analogInputPin[] = {
47+
10, // A0, PA0
48+
9, // A1, PA1
49+
8, // A2, PA2
50+
7, // A3, PA3
51+
6, // A4, PA4
52+
5, // A5, PA5
53+
4, // A6, PA6
54+
3, // A7, PA7
55+
2, // A8, PA8
56+
1 // A9, PA9
57+
};
58+
59+
// ----------------------------------------------------------------------------
60+
#ifdef __cplusplus
61+
extern "C" {
62+
#endif
63+
64+
/**
65+
* @brief System Clock Configuration
66+
* @param None
67+
* @retval None
68+
*
69+
* Board is fitted with a 32MHz HSE crystal (X2) and a 32.768kHz LSE
70+
* crystal (X1). SYSCLK is driven directly by HSE (no PLL needed) and
71+
* USB/RNG are clocked from the dedicated HSI48 oscillator, otherwise
72+
* the USB peripheral is left unclocked and never enumerates.
73+
*/
74+
WEAK void SystemClock_Config(void)
75+
{
76+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
77+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
78+
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {};
79+
80+
/* This prevents concurrent access to RCC registers by CPU2 (M0+) */
81+
hsem_lock(CFG_HW_RCC_SEMID, HSEM_LOCK_DEFAULT_RETRY);
82+
83+
/* Macro to configure the PLL multiplication factor */
84+
__HAL_RCC_PLL_PLLM_CONFIG(RCC_PLLM_DIV2);
85+
86+
/* Macro to configure the PLL clock source */
87+
__HAL_RCC_PLL_PLLSOURCE_CONFIG(RCC_PLLSOURCE_HSE);
88+
89+
__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_MEDIUMHIGH);
90+
/* Configure the main internal regulator output voltage */
91+
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
92+
93+
/* This prevents the CPU2 (M0+) to disable the HSI48 oscillator */
94+
hsem_lock(CFG_HW_CLK48_CONFIG_SEMID, HSEM_LOCK_DEFAULT_RETRY);
95+
96+
/* Initializes the CPU, AHB and APB busses clocks */
97+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48 | RCC_OSCILLATORTYPE_HSI
98+
| RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_LSE;
99+
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
100+
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
101+
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
102+
RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
103+
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
104+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
105+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
106+
Error_Handler();
107+
}
108+
109+
/* Configure the SYSCLKSource, HCLK, PCLK1 and PCLK2 clocks dividers */
110+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK4 | RCC_CLOCKTYPE_HCLK2
111+
| RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
112+
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
113+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSE;
114+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
115+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
116+
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
117+
RCC_ClkInitStruct.AHBCLK2Divider = RCC_SYSCLK_DIV1;
118+
RCC_ClkInitStruct.AHBCLK4Divider = RCC_SYSCLK_DIV1;
119+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
120+
Error_Handler();
121+
}
122+
123+
/* Initializes the peripherals clocks */
124+
/* RNG needs to be configured like in M0 core, i.e. with HSI48 */
125+
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SMPS | RCC_PERIPHCLK_RFWAKEUP
126+
| RCC_PERIPHCLK_RNG | RCC_PERIPHCLK_USB;
127+
PeriphClkInitStruct.RFWakeUpClockSelection = RCC_RFWKPCLKSOURCE_LSE;
128+
PeriphClkInitStruct.RngClockSelection = RCC_RNGCLKSOURCE_HSI48;
129+
PeriphClkInitStruct.SmpsClockSelection = RCC_SMPSCLKSOURCE_HSE;
130+
PeriphClkInitStruct.SmpsDivSelection = RCC_SMPSCLKDIV_RANGE0;
131+
PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
132+
133+
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
134+
Error_Handler();
135+
}
136+
137+
LL_PWR_SMPS_SetStartupCurrent(LL_PWR_SMPS_STARTUP_CURRENT_80MA);
138+
LL_PWR_SMPS_SetOutputVoltageLevel(LL_PWR_SMPS_OUTPUT_VOLTAGE_1V40);
139+
LL_PWR_SMPS_Enable();
140+
141+
/* Select HSI as system clock source after Wake Up from Stop mode */
142+
LL_RCC_SetClkAfterWakeFromStop(LL_RCC_STOP_WAKEUPCLOCK_HSI);
143+
144+
hsem_unlock(CFG_HW_RCC_SEMID);
145+
}
146+
147+
#ifdef __cplusplus
148+
}
149+
#endif
150+
#endif /* ARDUINO_WEACT_WB55CGU6 */
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2026, 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 PB2 0
19+
#define PA9 PIN_A9
20+
#define PA8 PIN_A8
21+
#define PA7 PIN_A7
22+
#define PA6 PIN_A6
23+
#define PA5 PIN_A5
24+
#define PA4 PIN_A4
25+
#define PA3 PIN_A3
26+
#define PA2 PIN_A2
27+
#define PA1 PIN_A1
28+
#define PA0 PIN_A0
29+
#define PB8 11
30+
#define PB9 12
31+
#define PH3 13 // BOOT0 / SW2 button
32+
#define PB0 14
33+
#define PB1 15
34+
#define PE4 16 // Onboard blue LED
35+
#define PA10 17
36+
#define PA15 18
37+
#define PB3 19
38+
#define PB4 20
39+
#define PB5 21
40+
#define PB6 22
41+
#define PB7 23
42+
43+
// Alternate pins number
44+
#define PA7_ALT1 (PA7 | ALT1)
45+
#define PB8_ALT1 (PB8 | ALT1)
46+
#define PB9_ALT1 (PB9 | ALT1)
47+
48+
#define NUM_DIGITAL_PINS 24
49+
#define NUM_ANALOG_INPUTS 10
50+
51+
// On-board LED pin number
52+
#ifndef LED_BUILTIN
53+
#define LED_BUILTIN PE4
54+
#endif
55+
56+
// On-board user button (shared with BOOT0 hardware bootloader select)
57+
#ifndef USER_BTN
58+
#define USER_BTN PH3
59+
#endif
60+
61+
// SPI definitions
62+
#ifndef PIN_SPI_SS
63+
#define PIN_SPI_SS PA4
64+
#endif
65+
#ifndef PIN_SPI_SS1
66+
#define PIN_SPI_SS1 PA15
67+
#endif
68+
#ifndef PIN_SPI_SS2
69+
#define PIN_SPI_SS2 PB2
70+
#endif
71+
#ifndef PIN_SPI_SS3
72+
#define PIN_SPI_SS3 PNUM_NOT_DEFINED
73+
#endif
74+
#ifndef PIN_SPI_MOSI
75+
#define PIN_SPI_MOSI PA7
76+
#endif
77+
#ifndef PIN_SPI_MISO
78+
#define PIN_SPI_MISO PA6
79+
#endif
80+
#ifndef PIN_SPI_SCK
81+
#define PIN_SPI_SCK PA5
82+
#endif
83+
84+
// I2C definitions
85+
#ifndef PIN_WIRE_SDA
86+
#define PIN_WIRE_SDA PB9
87+
#endif
88+
#ifndef PIN_WIRE_SCL
89+
#define PIN_WIRE_SCL PB8
90+
#endif
91+
92+
// Timer Definitions
93+
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
94+
#ifndef TIMER_TONE
95+
#define TIMER_TONE TIM16
96+
#endif
97+
#ifndef TIMER_SERVO
98+
#define TIMER_SERVO TIM17
99+
#endif
100+
101+
// UART Definitions
102+
#ifndef SERIAL_UART_INSTANCE
103+
#define SERIAL_UART_INSTANCE 101
104+
#endif
105+
106+
// Default pin used for generic 'Serial' instance
107+
// Mandatory for Firmata
108+
#ifndef PIN_SERIAL_RX
109+
#define PIN_SERIAL_RX PA3
110+
#endif
111+
#ifndef PIN_SERIAL_TX
112+
#define PIN_SERIAL_TX PA2
113+
#endif
114+
115+
// Extra HAL modules
116+
#if !defined(HAL_QSPI_MODULE_DISABLED)
117+
#define HAL_QSPI_MODULE_ENABLED
118+
#endif
119+
120+
#ifndef HSE_VALUE
121+
#define HSE_VALUE 32000000U
122+
#endif
123+
124+
/*----------------------------------------------------------------------------
125+
* Arduino objects - C++ only
126+
*----------------------------------------------------------------------------*/
127+
128+
#ifdef __cplusplus
129+
// These serial port names are intended to allow libraries and architecture-neutral
130+
// sketches to automatically default to the correct port name for a particular type
131+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
132+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
133+
//
134+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
135+
//
136+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
137+
//
138+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
139+
//
140+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
141+
//
142+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
143+
// pins are NOT connected to anything by default.
144+
#ifndef SERIAL_PORT_MONITOR
145+
#define SERIAL_PORT_MONITOR Serial
146+
#endif
147+
#ifndef SERIAL_PORT_HARDWARE
148+
#define SERIAL_PORT_HARDWARE Serial
149+
#endif
150+
#endif

0 commit comments

Comments
 (0)