Skip to content

Commit 1f3c876

Browse files
authored
Merge pull request stm32duino#39 from ABOSTM/BLE_PATCHES
Update BLE library with STM32WB Cube version v1.13.0
2 parents 331c39a + abeaf9a commit 1f3c876

21 files changed

+3165
-485
lines changed

Diff for: extras/STM32Cube_FW/0001-chore-clean-up-and-adapt-STM32Cube_FW-sources-for-ST.patch

+1,582
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
From ac18897f0f9b87bb3196efb93ef47ccaaa0eff64 Mon Sep 17 00:00:00 2001
2+
From: Alexandre Bourdiol <[email protected]>
3+
Date: Mon, 6 Dec 2021 11:18:02 +0100
4+
Subject: [PATCH 2/4] fix: include a timeout when waiting for the cmd_resp
5+
6+
Signed-off-by: Francois Ramu <[email protected]>
7+
Signed-off-by: Alexandre Bourdiol <[email protected]>
8+
---
9+
src/utility/STM32Cube_FW/shci_tl.c | 11 +++++++----
10+
1 file changed, 7 insertions(+), 4 deletions(-)
11+
12+
diff --git a/src/utility/STM32Cube_FW/shci_tl.c b/src/utility/STM32Cube_FW/shci_tl.c
13+
index ef403aa..6cccc5d 100644
14+
--- a/src/utility/STM32Cube_FW/shci_tl.c
15+
+++ b/src/utility/STM32Cube_FW/shci_tl.c
16+
@@ -20,6 +20,8 @@
17+
/* Includes ------------------------------------------------------------------*/
18+
#include "stm32_wpan_common.h"
19+
20+
+#include <Arduino.h>
21+
+
22+
#include "stm_list.h"
23+
#include "shci_tl.h"
24+
#include "stm32_def.h"
25+
@@ -250,11 +252,12 @@ static void TlUserEvtReceived(TL_EvtPacket_t *shcievt)
26+
/* Weak implementation ----------------------------------------------------------------*/
27+
__WEAK void shci_cmd_resp_wait(uint32_t timeout)
28+
{
29+
- (void)timeout;
30+
-
31+
CmdRspStatusFlag = SHCI_TL_CMD_RESP_WAIT;
32+
- while(CmdRspStatusFlag != SHCI_TL_CMD_RESP_RELEASE);
33+
-
34+
+ for (unsigned long start = millis(); (millis() - start) < timeout;) {
35+
+ if (CmdRspStatusFlag == SHCI_TL_CMD_RESP_RELEASE) {
36+
+ break;
37+
+ }
38+
+ }
39+
return;
40+
}
41+
42+
--
43+
2.31.1.windows.1
44+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
From a771c9e9a12d085fc240a45f68ca5aafb8b42006 Mon Sep 17 00:00:00 2001
2+
From: Alexandre Bourdiol <[email protected]>
3+
Date: Mon, 6 Dec 2021 18:59:38 +0100
4+
Subject: [PATCH 3/4] Added support for custom app_conf.h (#35)
5+
6+
---
7+
src/utility/STM32Cube_FW/app_conf_default.h | 75 ++++++++++++++-------
8+
1 file changed, 49 insertions(+), 26 deletions(-)
9+
10+
diff --git a/src/utility/STM32Cube_FW/app_conf_default.h b/src/utility/STM32Cube_FW/app_conf_default.h
11+
index 4f300e0..9f8e085 100644
12+
--- a/src/utility/STM32Cube_FW/app_conf_default.h
13+
+++ b/src/utility/STM32Cube_FW/app_conf_default.h
14+
@@ -1,8 +1,8 @@
15+
/**
16+
******************************************************************************
17+
- * @file app_conf.h
18+
+ * @file app_conf_default.h
19+
* @author MCD Application Team
20+
- * @brief Application configuration file for STM32WPAN Middleware.
21+
+ * @brief Default application configuration file for STM32WPAN Middleware.
22+
******************************************************************************
23+
* @attention
24+
*
25+
@@ -17,11 +17,8 @@
26+
*/
27+
28+
/* Define to prevent recursive inclusion -------------------------------------*/
29+
-#ifndef APP_CONF_H
30+
-#define APP_CONF_H
31+
-
32+
-#include "hw.h"
33+
-#include "ble_bufsize.h"
34+
+#ifndef APP_CONF_DEFAULT_H
35+
+#define APP_CONF_DEFAULT_H
36+
37+
/******************************************************************************
38+
* Application Config
39+
@@ -44,7 +41,9 @@
40+
/**
41+
* Define Tx Power
42+
*/
43+
-#define CFG_TX_POWER (0x18) /* -0.15dBm */
44+
+#ifndef CFG_TX_POWER
45+
+ #define CFG_TX_POWER (0x18) /* -0.15dBm */
46+
+#endif
47+
48+
/******************************************************************************
49+
* BLE Stack
50+
@@ -53,32 +52,41 @@
51+
* Maximum number of simultaneous connections that the device will support.
52+
* Valid values are from 1 to 8
53+
*/
54+
-#define CFG_BLE_NUM_LINK 2
55+
+#ifndef CFG_BLE_NUM_LINK
56+
+ #define CFG_BLE_NUM_LINK 2
57+
+#endif
58+
59+
/**
60+
* Maximum number of Services that can be stored in the GATT database.
61+
- * Note that the GAP and GATT services are automatically added so this parameter should be 2 plus the number of user services
62+
+ * Note that the GAP and GATT services are automatically added so this parameter should be 2 plus the number of user
63+
+ * services
64+
*/
65+
+#ifndef CFG_BLE_NUM_GATT_SERVICES
66+
#define CFG_BLE_NUM_GATT_SERVICES 8
67+
+#endif
68+
69+
/**
70+
* Maximum number of Attributes
71+
- * (i.e. the number of characteristic + the number of characteristic values + the number of descriptors, excluding the services)
72+
- * that can be stored in the GATT database.
73+
- * Note that certain characteristics and relative descriptors are added automatically during device initialization
74+
- * so this parameters should be 9 plus the number of user Attributes
75+
+ * (i.e. the number of characteristic + the number of characteristic values + the number of descriptors, excluding the
76+
+ * services) that can be stored in the GATT database. Note that certain characteristics and relative descriptors are
77+
+ * added automatically during device initialization so this parameters should be 9 plus the number of user Attributes
78+
*/
79+
-#define CFG_BLE_NUM_GATT_ATTRIBUTES 68
80+
+#ifndef CFG_BLE_NUM_GATT_ATTRIBUTES
81+
+ #define CFG_BLE_NUM_GATT_ATTRIBUTES 68
82+
+#endif
83+
84+
/**
85+
* Maximum supported ATT_MTU size
86+
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS is set to 1"
87+
*/
88+
-#define CFG_BLE_MAX_ATT_MTU (156)
89+
+#ifndef CFG_BLE_MAX_ATT_MTU
90+
+ #define CFG_BLE_MAX_ATT_MTU (156)
91+
+#endif
92+
93+
/**
94+
* Size of the storage area for Attribute values
95+
- * This value depends on the number of attributes used by application. In particular the sum of the following quantities (in octets) should be made for each attribute:
96+
+ * This value depends on the number of attributes used by application. In particular the sum of the following
97+
+ * quantities (in octets) should be made for each attribute:
98+
* - attribute value length
99+
* - 5, if UUID is 16 bit; 19, if UUID is 128 bit
100+
* - 2, if server configuration descriptor is used
101+
@@ -87,14 +95,18 @@
102+
* The total amount of memory needed is the sum of the above quantities for each attribute.
103+
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS is set to 1"
104+
*/
105+
+#ifndef CFG_BLE_ATT_VALUE_ARRAY_SIZE
106+
#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344)
107+
+#endif
108+
109+
/**
110+
* Prepare Write List size in terms of number of packet
111+
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS is set to 1"
112+
*/
113+
// #define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU)
114+
-#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A)
115+
+#ifndef CFG_BLE_PREPARE_WRITE_LIST_SIZE
116+
+ #define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A)
117+
+#endif
118+
119+
/**
120+
* Number of allocated memory blocks
121+
@@ -106,12 +118,16 @@
122+
/**
123+
* Enable or disable the Extended Packet length feature. Valid values are 0 or 1.
124+
*/
125+
-#define CFG_BLE_DATA_LENGTH_EXTENSION 1
126+
+#ifndef CFG_BLE_DATA_LENGTH_EXTENSION
127+
+ #define CFG_BLE_DATA_LENGTH_EXTENSION 1
128+
+#endif
129+
130+
/**
131+
* Sleep clock accuracy in Slave mode (ppm value)
132+
*/
133+
-#define CFG_BLE_SLAVE_SCA 500
134+
+#ifndef CFG_BLE_SLAVE_SCA
135+
+ #define CFG_BLE_SLAVE_SCA 500
136+
+#endif
137+
138+
/**
139+
* Sleep clock accuracy in Master mode
140+
@@ -124,24 +140,32 @@
141+
* 6 : 21 ppm to 30 ppm
142+
* 7 : 0 ppm to 20 ppm
143+
*/
144+
-#define CFG_BLE_MASTER_SCA 0
145+
+#ifndef CFG_BLE_MASTER_SCA
146+
+ #define CFG_BLE_MASTER_SCA 0
147+
+#endif
148+
149+
/**
150+
* Source for the low speed clock for RF wake-up
151+
* 1 : external high speed crystal HSE/32/32
152+
* 0 : external low speed crystal ( no calibration )
153+
*/
154+
-#define CFG_BLE_LSE_SOURCE 0
155+
+#ifndef CFG_BLE_LSE_SOURCE
156+
+ #define CFG_BLE_LSE_SOURCE 0
157+
+#endif
158+
159+
/**
160+
* Start up time of the high speed (16 or 32 MHz) crystal oscillator in units of 625/256 us (~2.44 us)
161+
*/
162+
-#define CFG_BLE_HSE_STARTUP_TIME 0x148
163+
+#ifndef CFG_BLE_HSE_STARTUP_TIME
164+
+ #define CFG_BLE_HSE_STARTUP_TIME 0x148
165+
+#endif
166+
167+
/**
168+
* Maximum duration of the connection event when the device is in Slave mode in units of 625/256 us (~2.44 us)
169+
*/
170+
-#define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF)
171+
+#ifndef CFG_BLE_MAX_CONN_EVENT_LENGTH
172+
+ #define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF)
173+
+#endif
174+
175+
/**
176+
* Viterbi Mode
177+
@@ -199,5 +223,4 @@
178+
179+
#define CFG_BLE_RX_MODEL_CONFIG SHCI_C2_BLE_INIT_RX_MODEL_AGC_RSSI_LEGACY
180+
181+
-
182+
-#endif /*APP_CONF_H */
183+
+#endif /* APP_CONF_DEFAULT_H */
184+
--
185+
2.31.1.windows.1
186+

0 commit comments

Comments
 (0)