Skip to content

Commit 47097af

Browse files
authored
Merge pull request #1441 from fpistm/STM32WB5MM-DK
variant: WB: add STM32WB5MM-DK
2 parents 1a6cb41 + 2eeb79e commit 47097af

File tree

15 files changed

+1267
-4
lines changed

15 files changed

+1267
-4
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
149149
| :green_heart: | STM32L475VG | [B-L475E-IOT01A](http://www.st.com/en/evaluation-tools/b-l475e-iot01a.html) | *1.0.1* | |
150150
| :green_heart: | STM32F413ZH | [32F413HDISCOVERY](https://www.st.com/en/evaluation-tools/32f413hdiscovery.html) | *1.9.0* | |
151151
| :green_heart: | STM32L4S5VI | [B-L4S5I-IOT01A](https://www.st.com/en/evaluation-tools/b-l4s5i-iot01a.html) | *2.0.0* | |
152+
| :yellow_heart: | STM32WB5MMG | [STM32WB5MM-DK](https://www.st.com/en/evaluation-tools/stm32wb5mm-dk.html) | **2.1.0** | |
152153

153154
### [Eval](https://www.st.com/en/evaluation-tools/stm32-eval-boards.html) boards
154155

@@ -407,6 +408,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
407408
| Status | Device(s) | Name | Release | Notes |
408409
| :----: | :-------: | ---- | :-----: | :---- |
409410
| :green_heart: | STM32WB55CC<br>STM32WB55CE<br>STM32WB55CG | Generic Board | *2.0.0* | |
411+
| :yellow_heart: | STM32WB5MMG | Generic Board | **2.1.0** | |
410412
| :green_heart: | STM32WB55RC<br>STM32WB55RE<br>STM32WB55RG | Generic Board | *2.0.0* | |
411413

412414
### Generic STM32WL boards

boards.txt

+22
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,20 @@ Disco.menu.pnum.B_L072Z_LRWAN1.build.peripheral_pins=-DCUSTOM_PERIPHERAL_PINS
823823
Disco.menu.pnum.B_L072Z_LRWAN1.build.cmsis_lib_gcc=arm_cortexM0l_math
824824
Disco.menu.pnum.B_L072Z_LRWAN1.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} -D__CORTEX_SC=0
825825

826+
# STM32WB5MM-DK board
827+
Disco.menu.pnum.STM32WB5MM_DK=STM32WB5MM-DK
828+
Disco.menu.pnum.STM32WB5MM_DK.node="DIS_WB5MMG"
829+
Disco.menu.pnum.STM32WB5MM_DK.upload.maximum_size=827392
830+
Disco.menu.pnum.STM32WB5MM_DK.upload.maximum_data_size=196608
831+
Disco.menu.pnum.STM32WB5MM_DK.build.mcu=cortex-m4
832+
Disco.menu.pnum.STM32WB5MM_DK.build.flags.fp=-mfpu=fpv4-sp-d16 -mfloat-abi=hard
833+
Disco.menu.pnum.STM32WB5MM_DK.build.board=STM32WB5MM_DK
834+
Disco.menu.pnum.STM32WB5MM_DK.build.series=STM32WBxx
835+
Disco.menu.pnum.STM32WB5MM_DK.build.product_line=STM32WB5Mxx
836+
Disco.menu.pnum.STM32WB5MM_DK.build.variant=STM32WBxx/WB5MMGH
837+
Disco.menu.pnum.STM32WB5MM_DK.build.peripheral_pins=-DCUSTOM_PERIPHERAL_PINS
838+
Disco.menu.pnum.STM32WB5MM_DK.build.cmsis_lib_gcc=arm_cortexM4lf_math
839+
826840
# Upload menu
827841
Disco.menu.upload_method.MassStorage=Mass Storage
828842
Disco.menu.upload_method.MassStorage.upload.protocol=
@@ -4948,6 +4962,14 @@ GenWB.menu.pnum.GENERIC_WB55CGUX.build.board=GENERIC_WB55CGUX
49484962
GenWB.menu.pnum.GENERIC_WB55CGUX.build.product_line=STM32WB55xx
49494963
GenWB.menu.pnum.GENERIC_WB55CGUX.build.variant=STM32WBxx/WB55C(C-E-G)U
49504964

4965+
# Generic WB5MMGHx
4966+
GenWB.menu.pnum.GENERIC_WB5MMGHX=Generic WB5MMGHx
4967+
GenWB.menu.pnum.GENERIC_WB5MMGHX.upload.maximum_size=827392
4968+
GenWB.menu.pnum.GENERIC_WB5MMGHX.upload.maximum_data_size=196608
4969+
GenWB.menu.pnum.GENERIC_WB5MMGHX.build.board=GENERIC_WB5MMGHX
4970+
GenWB.menu.pnum.GENERIC_WB5MMGHX.build.product_line=STM32WB5Mxx
4971+
GenWB.menu.pnum.GENERIC_WB5MMGHX.build.variant=STM32WBxx/WB5MMGH
4972+
49514973
# Generic WB55RCVx
49524974
GenWB.menu.pnum.GENERIC_WB55RCVX=Generic WB55RCVx
49534975
GenWB.menu.pnum.GENERIC_WB55RCVX.upload.maximum_size=131072

cores/arduino/stm32/lock_resource.h

+29
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,41 @@ typedef enum {
3535
* HW semaphore Complement ID list defined in hw_conf.h from STM32WB.
3636
* They could be used also for H7 dualcore targets.
3737
*/
38+
39+
/**
40+
* The CPU2 may be configured to store the Thread persistent data either in internal NVM storage on CPU2 or in
41+
* SRAM2 buffer provided by the user application. This can be configured with the system command SHCI_C2_Config()
42+
* When the CPU2 is requested to store persistent data in SRAM2, it can write data in this buffer at any time when needed.
43+
* In order to read consistent data with the CPU1 from the SRAM2 buffer, the flow should be:
44+
* + CPU1 takes CFG_HW_THREAD_NVM_SRAM_SEMID semaphore
45+
* + CPU1 reads all persistent data from SRAM2 (most of the time, the goal is to write these data into an NVM managed by CPU1)
46+
* + CPU1 releases CFG_HW_THREAD_NVM_SRAM_SEMID semaphore
47+
* CFG_HW_THREAD_NVM_SRAM_SEMID semaphore makes sure CPU2 does not update the persistent data in SRAM2 at the same time CPU1 is reading them.
48+
* There is no timing constraint on how long this semaphore can be kept.
49+
*/
50+
#define CFG_HW_THREAD_NVM_SRAM_SEMID 9
51+
52+
/**
53+
* The CPU2 may be configured to store the BLE persistent data either in internal NVM storage on CPU2 or in
54+
* SRAM2 buffer provided by the user application. This can be configured with the system command SHCI_C2_Config()
55+
* When the CPU2 is requested to store persistent data in SRAM2, it can write data in this buffer at any time when needed.
56+
* In order to read consistent data with the CPU1 from the SRAM2 buffer, the flow should be:
57+
* + CPU1 takes CFG_HW_BLE_NVM_SRAM_SEMID semaphore
58+
* + CPU1 reads all persistent data from SRAM2 (most of the time, the goal is to write these data into an NVM managed by CPU1)
59+
* + CPU1 releases CFG_HW_BLE_NVM_SRAM_SEMID semaphore
60+
* CFG_HW_BLE_NVM_SRAM_SEMID semaphore makes sure CPU2 does not update the persistent data in SRAM2 at the same time CPU1 is reading them.
61+
* There is no timing constraint on how long this semaphore can be kept.
62+
*/
63+
#define CFG_HW_BLE_NVM_SRAM_SEMID 8
64+
3865
/*
3966
* Index of the semaphore used by CPU2 to prevent the CPU1 to either write or
4067
* erase data in flash. The CPU1 shall not either write or erase in flash when
4168
* this semaphore is taken by the CPU2. When the CPU1 needs to either write or
4269
* erase in flash, it shall first get the semaphore and release it just
4370
* after writing a raw (64bits data) or erasing one sector.
71+
* Once the Semaphore has been released, there shall be at least 1us before it can be taken again. This is required
72+
* to give the opportunity to CPU2 to take it.
4473
* On v1.4.0 and older CPU2 wireless firmware, this semaphore is unused and
4574
* CPU2 is using PES bit. By default, CPU2 is using the PES bit to protect its
4675
* timing. The CPU1 may request the CPU2 to use the semaphore instead of the

libraries/IWatchdog/src/IWatchdog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void IWatchdogClass::begin(uint32_t timeout, uint32_t window)
3838
}
3939

4040
// Enable the peripheral clock IWDG
41-
#ifdef STM32WBxx
41+
#ifdef RCC_CSR_LSI1ON
4242
LL_RCC_LSI1_Enable();
4343
while (LL_RCC_LSI1_IsReady() != 1) {
4444
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
RGB_LED_TLC59731
3+
4+
This example code is in the public domain.
5+
6+
Blink one RGB LED with different default colors:
7+
RGB_LED_TLC59731::OFF
8+
RGB_LED_TLC59731::RED
9+
RGB_LED_TLC59731::GREEN
10+
RGB_LED_TLC59731::BLUE
11+
RGB_LED_TLC59731::MAGENTA
12+
RGB_LED_TLC59731::CYAN
13+
RGB_LED_TLC59731::YELLOW
14+
RGB_LED_TLC59731::WHITE
15+
*/
16+
17+
#include <RGB_LED_TLC59731.h>
18+
19+
static uint8_t step = 0;
20+
static uint8_t* sequence[] = { RGB_LED_TLC59731::RED,
21+
RGB_LED_TLC59731::GREEN,
22+
RGB_LED_TLC59731::BLUE,
23+
RGB_LED_TLC59731::MAGENTA,
24+
RGB_LED_TLC59731::CYAN,
25+
RGB_LED_TLC59731::YELLOW,
26+
RGB_LED_TLC59731::WHITE
27+
};
28+
/**
29+
STM32WB5MM-DK have an RGB LED connected to TLC59731
30+
It requires to enable it thanks LED_SELECT pin
31+
and to have JP5 on and JP4 off
32+
*/
33+
#if defined(RGB_LED) && defined(LED_SELECT)
34+
RGB_LED_TLC59731 LED(RGB_LED, LED_SELECT);
35+
#else
36+
RGB_LED_TLC59731 LED;
37+
#endif
38+
39+
void setup() {
40+
/* Change Brightness */
41+
LED.setBrightness(0x10);
42+
}
43+
44+
void loop() {
45+
/* Blink */
46+
LED.on(sequence[step]);
47+
delay(500);
48+
LED.off();
49+
delay(500);
50+
step = (step == 6) ? 0 : step + 1;
51+
}
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#######################################
2+
# Syntax Coloring Map For RGB_LED_TLC59731
3+
#######################################
4+
5+
#######################################
6+
# Datatypes (KEYWORD1)
7+
#######################################
8+
9+
RGB_LED_TLC59731 KEYWORD1
10+
11+
#######################################
12+
# Methods and Functions (KEYWORD2)
13+
#######################################
14+
15+
on KEYWORD2
16+
off KEYWORD2
17+
getBrightness KEYWORD2
18+
setBrightness KEYWORD2
19+
20+
#######################################
21+
# Constants (LITERAL1)
22+
#######################################
23+
24+
OFF LITERAL1
25+
RED LITERAL1
26+
GREEN LITERAL1
27+
BLUE LITERAL1
28+
MAGENTA LITERAL1
29+
CYAN LITERAL1
30+
YELLOW LITERAL1
31+
WHITE LITERAL
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=RGB LED TLC59731
2+
version=1.0.0
3+
author=Frederic Pillon
4+
maintainer=stm32duino
5+
sentence=Allows to control one RGB LED driven by TLC59731 PWM LED Driver
6+
paragraph=Control one RGB LED driven by TLC59731 PWM LED Driver
7+
category=Signal Input/Output
8+
url=https://github.com/stm32duino/Arduino_Core_STM32/tree/master/libraries/RGB_LED_TLC59731
9+
architectures=stm32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
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+
#include "RGB_LED_TLC59731.h"
14+
15+
#define WRITE_COMMAND 0x3A
16+
#ifndef DEFAULT_BRIGHTNESS
17+
#define DEFAULT_BRIGHTNESS 0x41
18+
#endif
19+
uint8_t RGB_LED_TLC59731::brightness = DEFAULT_BRIGHTNESS;
20+
uint8_t RGB_LED_TLC59731::OFF[3] = {0, 0, 0 };
21+
uint8_t RGB_LED_TLC59731::RED[3] = {DEFAULT_BRIGHTNESS, 0, 0 };
22+
uint8_t RGB_LED_TLC59731::GREEN[3] = {0, DEFAULT_BRIGHTNESS, 0 };
23+
uint8_t RGB_LED_TLC59731::BLUE[3] = {0, 0, DEFAULT_BRIGHTNESS};
24+
uint8_t RGB_LED_TLC59731::MAGENTA[3] = {DEFAULT_BRIGHTNESS, 0, DEFAULT_BRIGHTNESS};
25+
uint8_t RGB_LED_TLC59731::CYAN[3] = {0, DEFAULT_BRIGHTNESS, DEFAULT_BRIGHTNESS};
26+
uint8_t RGB_LED_TLC59731::YELLOW[3] = {DEFAULT_BRIGHTNESS, DEFAULT_BRIGHTNESS, 0 };
27+
uint8_t RGB_LED_TLC59731::WHITE[3] = {DEFAULT_BRIGHTNESS, DEFAULT_BRIGHTNESS, DEFAULT_BRIGHTNESS};
28+
29+
/**
30+
* @brief Set RGB LED color
31+
* @param rgb[3]: red,green, blue value in range [0-255]
32+
* @retval None
33+
*/
34+
void RGB_LED_TLC59731::on(uint8_t rgb[3])
35+
{
36+
on(rgb[0], rgb[1], rgb[2]);
37+
}
38+
39+
/**
40+
* @brief Set RGB LED color
41+
* @param red: red value in range [0-255]
42+
* @param green: green value in range [0-255]
43+
* @param blue: blue value in range [0-255]
44+
* @retval None
45+
*/
46+
void RGB_LED_TLC59731::on(uint8_t red, uint8_t green, uint8_t blue)
47+
{
48+
if (!_enabled) {
49+
if (_enable_pin != NC) {
50+
pinMode(pinNametoDigitalPin(_enable_pin), OUTPUT);
51+
digitalWriteFast(_enable_pin, HIGH);
52+
}
53+
54+
pinMode(pinNametoDigitalPin(_rgb_pin), OUTPUT);
55+
_enabled = true;
56+
}
57+
/* Data Transfer Rate (T_CYCLE) Measurement Sequence */
58+
digitalWriteFast(_rgb_pin, HIGH);
59+
delayMicroseconds(_T_Rise);
60+
digitalWriteFast(_rgb_pin, LOW);
61+
delayMicroseconds(_T_Cycle0);
62+
/* Write command */
63+
senByte(WRITE_COMMAND);
64+
/* Write the GS data */
65+
senByte(red);
66+
senByte(green);
67+
senByte(blue);
68+
/* GS Latch */
69+
delayMicroseconds(_T_GS_Lat);
70+
}
71+
72+
/**
73+
* @brief Set RGB LED Off
74+
* @param None
75+
* @retval None
76+
*/
77+
void RGB_LED_TLC59731::off(void)
78+
{
79+
/* Set RGB LED off value */
80+
on(RGB_LED_TLC59731::OFF);
81+
pinMode(pinNametoDigitalPin(_rgb_pin), INPUT_ANALOG);
82+
83+
if (_enable_pin != NC) {
84+
digitalWriteFast(_enable_pin, LOW);
85+
pinMode(pinNametoDigitalPin(_enable_pin), INPUT_ANALOG);
86+
_enabled = false;
87+
}
88+
}
89+
90+
/**
91+
* @brief Set brightness value
92+
* @param value: new brightness value
93+
* @retval None
94+
*/
95+
void RGB_LED_TLC59731::setBrightness(uint8_t value)
96+
{
97+
RGB_LED_TLC59731::brightness = value;
98+
RGB_LED_TLC59731::RED[0] = value;
99+
RGB_LED_TLC59731::GREEN[1] = value;
100+
RGB_LED_TLC59731::BLUE[2] = value;
101+
RGB_LED_TLC59731::MAGENTA[0] = value;
102+
RGB_LED_TLC59731::MAGENTA[2] = value;
103+
RGB_LED_TLC59731::CYAN[1] = value;
104+
RGB_LED_TLC59731::CYAN[2] = value;
105+
RGB_LED_TLC59731::YELLOW[0] = value;
106+
RGB_LED_TLC59731::YELLOW[1] = value;
107+
RGB_LED_TLC59731::WHITE[0] = value;
108+
RGB_LED_TLC59731::WHITE[1] = value;
109+
RGB_LED_TLC59731::WHITE[2] = value;
110+
}
111+
112+
/* Private */
113+
void RGB_LED_TLC59731::sendBit(uint8_t bit)
114+
{
115+
/* Start next cycle */
116+
digitalWriteFast(_rgb_pin, HIGH);
117+
delayMicroseconds(_T_Rise);
118+
digitalWriteFast(_rgb_pin, LOW);
119+
delayMicroseconds(_T_Rise);
120+
121+
if (bit) {
122+
digitalWriteFast(_rgb_pin, HIGH);
123+
delayMicroseconds(_T_Rise);
124+
digitalWriteFast(_rgb_pin, LOW);
125+
delayMicroseconds(_T_Cycle1);
126+
} else {
127+
delayMicroseconds(_T_Cycle0);
128+
}
129+
}
130+
131+
132+
void RGB_LED_TLC59731::senByte(uint8_t byte)
133+
{
134+
sendBit(byte & (1 << 7));
135+
sendBit(byte & (1 << 6));
136+
sendBit(byte & (1 << 5));
137+
sendBit(byte & (1 << 4));
138+
sendBit(byte & (1 << 3));
139+
sendBit(byte & (1 << 2));
140+
sendBit(byte & (1 << 1));
141+
sendBit(byte & (1 << 0));
142+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
#ifndef __RGB_LED_TLC59731_H__
14+
#define __RGB_LED_TLC59731_H__
15+
16+
#include "Arduino.h"
17+
18+
class RGB_LED_TLC59731 {
19+
20+
public:
21+
RGB_LED_TLC59731(uint32_t rgb_pin = LED_BUILTIN, uint32_t enable_pin = NC):
22+
_rgb_pin(digitalPinToPinName(rgb_pin)), _enable_pin(digitalPinToPinName(enable_pin)) {};
23+
void on(uint8_t rgb[3]);
24+
void on(uint8_t red, uint8_t green, uint8_t blue);
25+
void off(void);
26+
inline uint8_t getBrightness(void)
27+
{
28+
return brightness;
29+
}
30+
void setBrightness(uint8_t value);
31+
32+
static uint8_t brightness;
33+
static uint8_t OFF[3];
34+
static uint8_t RED[3];
35+
static uint8_t GREEN[3];
36+
static uint8_t BLUE[3];
37+
static uint8_t MAGENTA[3];
38+
static uint8_t CYAN[3];
39+
static uint8_t YELLOW[3];
40+
static uint8_t WHITE[3];
41+
42+
private:
43+
PinName _rgb_pin;
44+
PinName _enable_pin;
45+
46+
bool _enabled{false};
47+
const uint32_t _T_Rise{1};
48+
const uint32_t _T_Cycle0{4};
49+
const uint32_t _T_Cycle1{1};
50+
// GS Data Latch (GSLAT) Sequence delay
51+
const uint32_t _T_GS_Lat{_T_Cycle0 * 8};
52+
53+
void sendBit(uint8_t bit);
54+
void senByte(uint8_t byte);
55+
};
56+
57+
#endif /* __RGB_LED_TLC59731_H__ */

0 commit comments

Comments
 (0)