Skip to content

Commit 4e02294

Browse files
authored
Merge pull request #67 from fpistm/STM32WPAN_1.18.0
chore: update to STM32_WPAN v1.18.0
2 parents 8a6ead5 + c8dfa1c commit 4e02294

File tree

10 files changed

+100
-63
lines changed

10 files changed

+100
-63
lines changed

src/utility/HCISharedMemTransport.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,8 @@ int HCISharedMemTransportClass::stm32wb_start_ble(void)
642642
CFG_BLE_PREPARE_WRITE_LIST_SIZE,
643643
CFG_BLE_MBLOCK_COUNT,
644644
CFG_BLE_MAX_ATT_MTU,
645-
CFG_BLE_SLAVE_SCA,
646-
CFG_BLE_MASTER_SCA,
645+
CFG_BLE_PERIPHERAL_SCA,
646+
CFG_BLE_CENTRAL_SCA,
647647
CFG_BLE_LS_SOURCE,
648648
CFG_BLE_MAX_CONN_EVENT_LENGTH,
649649
CFG_BLE_HSE_STARTUP_TIME,

src/utility/STM32_WPAN/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
## Source
33

4-
[STMicroelectronics/STM32CubeWB Release v1.17.0](https://github.com/STMicroelectronics/STM32CubeWB/releases/tag/v1.17.0)
5-
- Application: [BLE_TransparentMode](https://github.com/STMicroelectronics/STM32CubeWB/tree/v1.17.0/Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE/BLE_TransparentMode)
4+
[STMicroelectronics/STM32CubeWB Release v1.18.0](https://github.com/STMicroelectronics/STM32CubeWB/releases/tag/v1.18.0)
5+
- Application: [BLE_TransparentMode](https://github.com/STMicroelectronics/STM32CubeWB/tree/v1.18.0/Projects/P-NUCLEO-WB55.Nucleo/Applications/BLE/BLE_TransparentMode)
66

src/utility/STM32_WPAN/app_conf_default.h

+28-36
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
/* Define to prevent recursive inclusion -------------------------------------*/
2222
#ifndef APP_CONF_DEFAULT_H
2323
#define APP_CONF_DEFAULT_H
24+
2425
#if 0
2526
#include "hw.h"
2627
#include "hw_conf.h"
2728
#include "hw_if.h"
2829
#include "ble_bufsize.h"
2930
#endif
31+
3032
/******************************************************************************
3133
* Application Config
3234
******************************************************************************/
@@ -49,7 +51,7 @@
4951
* Define Tx Power
5052
*/
5153
#ifndef CFG_TX_POWER
52-
#define CFG_TX_POWER (0x18) /* -0.15dBm */
54+
#define CFG_TX_POWER (0x18) /* -0.15dBm */
5355
#endif
5456

5557
#if 0
@@ -83,14 +85,14 @@
8385
#define CFG_GAP_DEVICE_NAME_LENGTH (8)
8486

8587
/**
86-
* Identity root key used to derive LTK and CSRK
88+
* Identity root key used to derive IRK and DHK(Legacy)
8789
*/
88-
#define CFG_BLE_IRK {0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0}
90+
#define CFG_BLE_IR {0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0}
8991

9092
/**
91-
* Encryption root key used to derive LTK and CSRK
93+
* Encryption root key used to derive LTK(Legacy) and CSRK
9294
*/
93-
#define CFG_BLE_ERK {0xFE, 0xDC, 0xBA, 0x09, 0x87, 0x65, 0x43, 0x21, 0xFE, 0xDC, 0xBA, 0x09, 0x87, 0x65, 0x43, 0x21}
95+
#define CFG_BLE_ER {0xFE, 0xDC, 0xBA, 0x09, 0x87, 0x65, 0x43, 0x21, 0xFE, 0xDC, 0xBA, 0x09, 0x87, 0x65, 0x43, 0x21}
9496

9597
/**
9698
* SMPS supply
@@ -127,6 +129,7 @@
127129
#define CFG_FW_BRANCH (0)
128130
#define CFG_FW_BUILD (0)
129131
#endif
132+
130133
/******************************************************************************
131134
* BLE Stack
132135
******************************************************************************/
@@ -163,19 +166,17 @@
163166
*/
164167
#ifndef CFG_BLE_NUM_GATT_ATTRIBUTES
165168
#ifdef STM32WB15xx
166-
#define CFG_BLE_NUM_GATT_ATTRIBUTES 30
169+
#define CFG_BLE_NUM_GATT_ATTRIBUTES 30
167170
#else
168-
#define CFG_BLE_NUM_GATT_ATTRIBUTES 68
171+
#define CFG_BLE_NUM_GATT_ATTRIBUTES 68
169172
#endif
170173
#endif
171174

172175
/**
173176
* Maximum supported ATT_MTU size
174177
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set
175178
*/
176-
#ifndef CFG_BLE_MAX_ATT_MTU
177-
#define CFG_BLE_MAX_ATT_MTU (156)
178-
#endif
179+
#define CFG_BLE_MAX_ATT_MTU (156)
179180

180181
/**
181182
* Size of the storage area for Attribute values
@@ -188,29 +189,19 @@
188189
* The total amount of memory needed is the sum of the above quantities for each attribute.
189190
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set
190191
*/
191-
#ifndef CFG_BLE_ATT_VALUE_ARRAY_SIZE
192-
#ifdef STM32WB15xx
193-
#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1290)
194-
#else
195-
#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344)
196-
#endif
197-
#endif
192+
#define CFG_BLE_ATT_VALUE_ARRAY_SIZE (1344)
198193

199194
/**
200195
* Prepare Write List size in terms of number of packet
201196
* This parameter is ignored by the CPU2 when CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set
202197
*/
203-
// #define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU)
204-
#ifndef CFG_BLE_PREPARE_WRITE_LIST_SIZE
205-
#define CFG_BLE_PREPARE_WRITE_LIST_SIZE (0x3A)
206-
#endif
198+
#define CFG_BLE_PREPARE_WRITE_LIST_SIZE BLE_PREP_WRITE_X_ATT(CFG_BLE_MAX_ATT_MTU)
207199

208200
/**
209201
* Number of allocated memory blocks
210202
* This parameter is overwritten by the CPU2 with an hardcoded optimal value when the parameter CFG_BLE_OPTIONS has SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY flag set
211203
*/
212-
//#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK))
213-
#define CFG_BLE_MBLOCK_COUNT (0x79)
204+
#define CFG_BLE_MBLOCK_COUNT (BLE_MBLOCKS_CALC(CFG_BLE_PREPARE_WRITE_LIST_SIZE, CFG_BLE_MAX_ATT_MTU, CFG_BLE_NUM_LINK))
214205

215206
/**
216207
* Enable or disable the Extended Packet length feature. Valid values are 0 or 1.
@@ -220,14 +211,14 @@
220211
#endif
221212

222213
/**
223-
* Sleep clock accuracy in Slave mode (ppm value)
214+
* Sleep clock accuracy in Peripheral mode (ppm value)
224215
*/
225-
#ifndef CFG_BLE_SLAVE_SCA
226-
#define CFG_BLE_SLAVE_SCA 500
216+
#ifndef CFG_BLE_PERIPHERAL_SCA
217+
#define CFG_BLE_PERIPHERAL_SCA 500
227218
#endif
228219

229220
/**
230-
* Sleep clock accuracy in Master mode
221+
* Sleep clock accuracy in Central mode
231222
* 0 : 251 ppm to 500 ppm
232223
* 1 : 151 ppm to 250 ppm
233224
* 2 : 101 ppm to 150 ppm
@@ -237,8 +228,8 @@
237228
* 6 : 21 ppm to 30 ppm
238229
* 7 : 0 ppm to 20 ppm
239230
*/
240-
#ifndef CFG_BLE_MASTER_SCA
241-
#define CFG_BLE_MASTER_SCA 0
231+
#ifndef CFG_BLE_CENTRAL_SCA
232+
#define CFG_BLE_CENTRAL_SCA 0
242233
#endif
243234

244235
/**
@@ -264,7 +255,7 @@
264255
#endif
265256

266257
/**
267-
* Maximum duration of the connection event when the device is in Slave mode in units of 625/256 us (~2.44 us)
258+
* Maximum duration of the connection event when the device is in Peripheral mode in units of 625/256 us (~2.44 us)
268259
*/
269260
#ifndef CFG_BLE_MAX_CONN_EVENT_LENGTH
270261
#define CFG_BLE_MAX_CONN_EVENT_LENGTH (0xFFFFFFFF)
@@ -314,7 +305,7 @@
314305
* 0: LE Power Class 2-3
315306
* other bits: complete with Options_extension flag
316307
*/
317-
#define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY)
308+
#define CFG_BLE_OPTIONS (SHCI_C2_BLE_INIT_OPTIONS_LL_ONLY | SHCI_C2_BLE_INIT_OPTIONS_WITH_SVC_CHANGE_DESC | SHCI_C2_BLE_INIT_OPTIONS_DEVICE_NAME_RW | SHCI_C2_BLE_INIT_OPTIONS_EXT_ADV | SHCI_C2_BLE_INIT_OPTIONS_CS_ALGO2 | SHCI_C2_BLE_INIT_OPTIONS_FULL_GATTDB_NVM | SHCI_C2_BLE_INIT_OPTIONS_GATT_CACHING_NOTUSED | SHCI_C2_BLE_INIT_OPTIONS_POWER_CLASS_2_3)
318309

319310
/**
320311
* BLE stack Options_extension flags to be configured with:
@@ -390,10 +381,11 @@
390381
/* BLE core version (16-bit signed integer).
391382
* - SHCI_C2_BLE_INIT_BLE_CORE_5_2
392383
* - SHCI_C2_BLE_INIT_BLE_CORE_5_3
393-
* which are used to set: 11(5.2), 12(5.3).
384+
* - SHCI_C2_BLE_INIT_BLE_CORE_5_4
385+
* which are used to set: 11(5.2), 12(5.3), 13(5.4).
394386
*/
395387

396-
#define CFG_BLE_CORE_VERSION (SHCI_C2_BLE_INIT_BLE_CORE_5_3)
388+
#define CFG_BLE_CORE_VERSION (SHCI_C2_BLE_INIT_BLE_CORE_5_4)
397389

398390
#if 0
399391
/******************************************************************************
@@ -559,13 +551,13 @@ typedef enum
559551
* Debug
560552
******************************************************************************/
561553
/**
562-
* When set, this resets some hw resources to set the device in the same state than the power up
563-
* The FW resets only register that may prevent the FW to run properly
554+
* When set, this resets some hw resources to put the device in the same state as at power up.
555+
* It resets only register that may prevent the FW to run properly.
564556
*
565557
* This shall be set to 0 in a final product
566558
*
567559
*/
568-
#define CFG_HW_RESET_BY_FW 1
560+
#define CFG_HW_RESET_BY_FW 0
569561

570562
/**
571563
* keep debugger enabled while in any low power mode when set to 1

src/utility/STM32_WPAN/ble_bufsize.h

-7
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,6 @@
7575
((pw) + MAX(BLE_MEM_BLOCK_X_MTU(mtu, n_link), \
7676
BLE_MBLOCKS_SECURE_CONNECTIONS))
7777

78-
/*
79-
* BLE_DEFAULT_MBLOCKS_COUNT: default memory blocks count
80-
*/
81-
#define BLE_DEFAULT_MBLOCKS_COUNT(n_link) \
82-
BLE_MBLOCKS_CALC(BLE_DEFAULT_PREP_WRITE_LIST_SIZE, \
83-
BLE_DEFAULT_MAX_ATT_MTU, n_link)
84-
8578
/*
8679
* BLE_FIXED_BUFFER_SIZE_BYTES:
8780
* A part of the RAM, is dynamically allocated by initializing all the pointers

src/utility/STM32_WPAN/hw_ipcc.c

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
******************************************************************************
1818
*/
1919
/* USER CODE END Header */
20+
2021
#if defined(STM32WBxx)
2122
/* Includes ------------------------------------------------------------------*/
2223
#include "hw.h"

src/utility/STM32_WPAN/shci.c

+21
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
******************************************************************************
1717
*/
1818

19+
1920
#if defined(STM32WBxx)
2021
/* Includes ------------------------------------------------------------------*/
2122
#include "stm32_wpan_common.h"
@@ -644,6 +645,26 @@ SHCI_CmdStatus_t SHCI_C2_802_15_4_DeInit( void )
644645
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
645646
}
646647

648+
SHCI_CmdStatus_t SHCI_C2_SetSystemClock( SHCI_C2_SET_SYSTEM_CLOCK_Cmd_Param_t clockSel )
649+
{
650+
/**
651+
* Buffer is large enough to hold command complete without payload
652+
*/
653+
uint8_t local_buffer[TL_BLEEVT_CC_BUFFER_SIZE];
654+
TL_EvtPacket_t * p_rsp;
655+
656+
p_rsp = (TL_EvtPacket_t *)local_buffer;
657+
658+
local_buffer[0] = (uint8_t)clockSel;
659+
660+
shci_send( SHCI_OPCODE_C2_SET_SYSTEM_CLOCK,
661+
1,
662+
local_buffer,
663+
p_rsp );
664+
665+
return (SHCI_CmdStatus_t)(((TL_CcEvt_t*)(p_rsp->evtserial.evt.payload))->payload[0]);
666+
}
667+
647668
/**
648669
* Local System COMMAND
649670
* These commands are NOT sent to the CPU2

0 commit comments

Comments
 (0)