Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM32WBA 1.3.1 Cube FW Updates Integration #214

Merged
merged 6 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/stm32wba/hci/README
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Origin:
https://github.com/STMicroelectronics/STM32CubeWBA

Status:
version v1.2.0
version v1.3.1

Purpose:
This library is used on STM32WBA series to port BLE controller library in
Expand All @@ -32,6 +32,7 @@ Description:
Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/mem_intf.h
Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/os_wrapper.h
Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/power_table.h
Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/inc/pta.h
Middlewares/ST/STM32_WPAN/link_layer/ll_cmd_lib/config/ble_full/ll_fw_config.h
Middlewares/ST/STM32_WPAN/link_layer/ll_sys/inc/linklayer_plat.h
Middlewares/ST/STM32_WPAN/link_layer/ll_sys/inc/ll_sys.h
Expand Down Expand Up @@ -86,7 +87,7 @@ URL:
https://github.com/STMicroelectronics/STM32CubeWBA

Commit:
d2bde9968677fdfd302e2b595239721e3c178e88
8d1d0ffef7a3a25d8ee8f589a614bc5da65c9300

Maintained-by:
External
Expand All @@ -104,6 +105,9 @@ Patch List:
* Disable Temperature based radio calibration:
Impacted file: app_conf.h

* Increased 2.4GHz RADIO low ISR priority:
Impacted file: app_conf.h

* Minimize dependency list
Impacted files: stm_list.h
main.h
Expand Down
28 changes: 13 additions & 15 deletions lib/stm32wba/hci/app_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@
#define CFG_TX_POWER (0x19) /* 0x19 <=> -0.3 dBm */

/**
* Define Advertising parameters
* Definition of public BD Address,
* when CFG_BD_ADDRESS = 0x000000000000 the BD address is generated based on Unique Device Number.
*/
#define CFG_BD_ADDRESS (0x0008E12A1234)
#define CFG_BD_ADDRESS (0x0000000000000)

/**
* Define BD_ADDR type: define proper address. Can only be GAP_PUBLIC_ADDR (0x00) or GAP_STATIC_RANDOM_ADDR (0x01)
Expand Down Expand Up @@ -134,6 +135,7 @@
0 | \
0 | \
0 | \
0 | \
0)

/**
Expand Down Expand Up @@ -251,9 +253,6 @@ typedef enum

/* USER CODE END Low_Power 1 */

/* Core voltage supply selection, it can be PWR_LDO_SUPPLY or PWR_SMPS_SUPPLY */
#define CFG_CORE_SUPPLY (PWR_LDO_SUPPLY)

/******************************************************************************
* RTC
******************************************************************************/
Expand Down Expand Up @@ -450,7 +449,7 @@ typedef enum

#if (USE_RADIO_LOW_ISR == 1)
#define RADIO_SW_LOW_INTR_NUM HASH_IRQn /* Selected interrupt vector for 2.4GHz RADIO low ISR */
#define RADIO_SW_LOW_INTR_PRIO (15) /* 2.4GHz RADIO low ISR priority */
#define RADIO_SW_LOW_INTR_PRIO (14) /* 2.4GHz RADIO low ISR priority */
erwango marked this conversation as resolved.
Show resolved Hide resolved
#endif /* USE_RADIO_LOW_ISR */

/* Link Layer supported number of antennas */
Expand Down Expand Up @@ -483,15 +482,14 @@ typedef enum
* MEMORY MANAGER
******************************************************************************/

#define CFG_MM_POOL_SIZE (4000)
#define CFG_PWR_VOS2_SUPPORTED (0) /* VOS2 power configuration not currently supported with radio activity */
#define CFG_AMM_VIRTUAL_MEMORY_NUMBER (2u)
#define CFG_AMM_VIRTUAL_STACK_BLE (1U)
#define CFG_AMM_VIRTUAL_STACK_BLE_BUFFER_SIZE (400U)
#define CFG_AMM_VIRTUAL_APP_BLE (2U)
#define CFG_AMM_VIRTUAL_APP_BLE_BUFFER_SIZE (200U)
#define CFG_AMM_POOL_SIZE DIVC(CFG_MM_POOL_SIZE, sizeof (uint32_t)) \
+ (AMM_VIRTUAL_INFO_ELEMENT_SIZE * CFG_AMM_VIRTUAL_MEMORY_NUMBER)
#define CFG_MM_POOL_SIZE (4000U) /* bytes */
#define CFG_AMM_VIRTUAL_MEMORY_NUMBER (2U)
#define CFG_AMM_VIRTUAL_STACK_BLE (1U)
#define CFG_AMM_VIRTUAL_STACK_BLE_BUFFER_SIZE (400U) /* words (32 bits) */
#define CFG_AMM_VIRTUAL_APP_BLE (2U)
#define CFG_AMM_VIRTUAL_APP_BLE_BUFFER_SIZE (200U) /* words (32 bits) */
#define CFG_AMM_POOL_SIZE DIVC(CFG_MM_POOL_SIZE, sizeof (uint32_t)) \
+ (AMM_VIRTUAL_INFO_ELEMENT_SIZE * CFG_AMM_VIRTUAL_MEMORY_NUMBER)

/* USER CODE BEGIN MEMORY_MANAGER_Configuration */

Expand Down
73 changes: 69 additions & 4 deletions lib/stm32wba/hci/auto/ble_types.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/*****************************************************************************
* @file ble_types.h
* @author MDG
* @brief STM32WBA BLE command/event types
* Auto-generated file: do not edit!
*****************************************************************************
* @attention
*
* Copyright (c) 2018-2023 STMicroelectronics.
* Copyright (c) 2018-2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
Expand Down Expand Up @@ -702,6 +701,22 @@ typedef __PACKED_STRUCT
uint8_t Status;
} hci_host_number_of_completed_packets_rp0;

typedef __PACKED_STRUCT
{
uint8_t Status;
uint8_t AFH_Channel_Assessment_Mode;
} hci_read_afh_channel_assessment_mode_rp0;

typedef __PACKED_STRUCT
{
uint8_t AFH_Channel_Assessment_Mode;
} hci_write_afh_channel_assessment_mode_cp0;

typedef __PACKED_STRUCT
{
uint8_t Status;
} hci_write_afh_channel_assessment_mode_rp0;

typedef __PACKED_STRUCT
{
uint8_t Event_Mask_Page_2[8];
Expand Down Expand Up @@ -2284,6 +2299,46 @@ typedef __PACKED_STRUCT
uint8_t Status;
} hci_le_transmitter_test_v4_rp0;

typedef __PACKED_STRUCT
{
uint8_t Advertising_Handle;
uint8_t Change_Reasons;
} hci_le_set_data_related_address_changes_cp0;

typedef __PACKED_STRUCT
{
uint8_t Status;
} hci_le_set_data_related_address_changes_rp0;

typedef __PACKED_STRUCT
{
uint16_t Subrate_Min;
uint16_t Subrate_Max;
uint16_t Max_Latency;
uint16_t Continuation_Number;
uint16_t Supervision_Timeout;
} hci_le_set_default_subrate_cp0;

typedef __PACKED_STRUCT
{
uint8_t Status;
} hci_le_set_default_subrate_rp0;

typedef __PACKED_STRUCT
{
uint16_t Connection_Handle;
uint16_t Subrate_Min;
uint16_t Subrate_Max;
uint16_t Max_Latency;
uint16_t Continuation_Number;
uint16_t Supervision_Timeout;
} hci_le_subrate_request_cp0;

typedef __PACKED_STRUCT
{
uint8_t Status;
} hci_le_subrate_request_rp0;

typedef __PACKED_STRUCT
{
uint8_t Advertising_Handle;
Expand Down Expand Up @@ -2389,8 +2444,8 @@ typedef __PACKED_STRUCT
typedef __PACKED_STRUCT
{
uint8_t Status;
uint8_t Link_Status[10];
uint16_t Link_Connection_Handle[10];
uint8_t Link_Status[22];
uint16_t Link_Connection_Handle[22];
} aci_hal_get_link_status_v2_rp0;

typedef __PACKED_STRUCT
Expand Down Expand Up @@ -4289,6 +4344,16 @@ typedef __PACKED_STRUCT
uint8_t Encryption;
} hci_le_biginfo_advertising_report_event_rp0;

typedef __PACKED_STRUCT
{
uint8_t Status;
uint16_t Connection_Handle;
uint16_t Subrate_Factor;
uint16_t Peripheral_Latency;
uint16_t Continuation_Number;
uint16_t Supervision_Timeout;
} hci_le_subrate_change_event_rp0;

typedef __PACKED_STRUCT
{
uint8_t Last_State;
Expand Down
35 changes: 21 additions & 14 deletions lib/stm32wba/hci/ble_bufsize.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*****************************************************************************
* @attention
*
* Copyright (c) 2018-2023 STMicroelectronics.
* Copyright (c) 2018-2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
Expand Down Expand Up @@ -35,28 +35,35 @@
* equal to BLE_DEFAULT_ATT_MTU (23).
*/
#define BLE_PREP_WRITE_X_ATT(max_att) \
(DIVC(max_att, BLE_DEFAULT_ATT_MTU - 5) * 2)
(DIVC(max_att, BLE_DEFAULT_ATT_MTU - 5) * 2)

/*
* BLE_DEFAULT_PREP_WRITE_LIST_SIZE: default minimum Prepare Write List size.
*/
#define BLE_DEFAULT_PREP_WRITE_LIST_SIZE \
BLE_PREP_WRITE_X_ATT(BLE_DEFAULT_MAX_ATT_SIZE)
BLE_PREP_WRITE_X_ATT(BLE_DEFAULT_MAX_ATT_SIZE)

/*
* BLE_MEM_BLOCK_X_MTU: compute how many memory blocks are needed to compose
* an ATT packet with ATT_MTU=mtu.
*/
#define BLE_MEM_BLOCK_SIZE 32

#if (BASIC_FEATURES != 0)
#define BLE_MEM_BLOCK_X_PTX(n_link) 0
#else
#define BLE_MEM_BLOCK_X_PTX(n_link) (n_link)
#endif

#define BLE_MEM_BLOCK_X_TX(mtu) \
(DIVC((mtu) + 4U, BLE_MEM_BLOCK_SIZE) + 1U)
(DIVC((mtu) + 4U, BLE_MEM_BLOCK_SIZE) + 1)

#define BLE_MEM_BLOCK_X_RX(mtu, n_link) \
((DIVC((mtu) + 4U, BLE_MEM_BLOCK_SIZE) + 2U) * (n_link) + 1)
((DIVC((mtu) + 4U, BLE_MEM_BLOCK_SIZE) + 2U) * (n_link) + 1)

#define BLE_MEM_BLOCK_X_MTU(mtu, n_link) \
(BLE_MEM_BLOCK_X_TX(mtu) + BLE_MEM_BLOCK_X_RX(mtu, n_link))
(BLE_MEM_BLOCK_X_TX(mtu) + BLE_MEM_BLOCK_X_PTX(n_link) + \
BLE_MEM_BLOCK_X_RX(mtu, n_link))

/*
* BLE_MBLOCKS_SECURE_CONNECTIONS: minimum number of blocks required for
Expand All @@ -72,8 +79,8 @@
* - n_link: maximum number of simultaneous connections
*/
#define BLE_MBLOCKS_CALC(pw, mtu, n_link) \
((pw) + MAX(BLE_MEM_BLOCK_X_MTU(mtu, n_link), \
BLE_MBLOCKS_SECURE_CONNECTIONS))
((pw) + MAX(BLE_MEM_BLOCK_X_MTU(mtu, n_link), \
BLE_MBLOCKS_SECURE_CONNECTIONS))

/*
* BLE_FIXED_BUFFER_SIZE_BYTES:
Expand All @@ -92,7 +99,7 @@
#if (BASIC_FEATURES != 0)
#define BLE_FIXED_BUFFER_SIZE_BYTES 244 /* Basic Features */
#else
#define BLE_FIXED_BUFFER_SIZE_BYTES 500 /* Full stack */
#define BLE_FIXED_BUFFER_SIZE_BYTES 660 /* Full stack */
#endif

/*
Expand All @@ -115,9 +122,9 @@
* @param mblocks_count: Number of memory blocks allocated for packets.
*/
#define BLE_TOTAL_BUFFER_SIZE(n_link, mblocks_count) \
(16 + BLE_FIXED_BUFFER_SIZE_BYTES + \
(BLE_PER_LINK_SIZE_BYTES * (n_link)) + \
((BLE_MEM_BLOCK_SIZE + 12) * (mblocks_count)))
(16 + BLE_FIXED_BUFFER_SIZE_BYTES + \
(BLE_PER_LINK_SIZE_BYTES * (n_link)) + \
((BLE_MEM_BLOCK_SIZE + 8) * (mblocks_count)))

/*
* BLE_TOTAL_BUFFER_SIZE_GATT: this macro returns the amount of memory,
Expand All @@ -137,8 +144,8 @@
* @param att_value_array_size: Size of the storage area for Attribute values.
*/
#define BLE_TOTAL_BUFFER_SIZE_GATT(num_gatt_attributes, num_gatt_services, att_value_array_size) \
(((((att_value_array_size) - 1) | 3) + 1) + \
(40 * (num_gatt_attributes)) + (48 * (num_gatt_services)))
(((((att_value_array_size) - 1) | 3) + 1) + \
(40 * (num_gatt_attributes)) + (48 * (num_gatt_services)))


#endif /* BLE_BUFSIZE_H__ */
5 changes: 4 additions & 1 deletion lib/stm32wba/hci/ble_const.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*****************************************************************************
* @attention
*
* Copyright (c) 2018-2023 STMicroelectronics.
* Copyright (c) 2018-2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
Expand All @@ -29,6 +29,9 @@
#ifndef BASIC_FEATURES
#define BASIC_FEATURES 0
#endif
#ifndef BASIC_PLUS
#define BASIC_PLUS 0
#endif
#ifndef LL_ONLY
#define LL_ONLY 0
#endif
Expand Down
Loading
Loading