8000 stm32/rfcore: Allow BLE settings to be changed by a board. · larsks/micropython@680ce45 · GitHub
[go: up one dir, main page]

Skip to content

Commit 680ce45

Browse files
committed
stm32/rfcore: Allow BLE settings to be changed by a board.
Two of the defaults have also changed in this commit: - MICROPY_HW_RFCORE_BLE_LSE_SOURCE changed from 1 to 0, which configures the LsSource to be LSE (needed due to errata 2.2.1). - MICROPY_HW_RFCORE_BLE_VITERBI_MODE changed from 0 to 1, which enables Viterbi mode, following all the ST examples. Signed-off-by: Damien George <damien@micropython.org>
1 parent cdaec0d commit 680ce45

File tree

2 files changed

+39
-19
lines changed

2 files changed

+39
-19
lines changed

ports/stm32/mpconfigboard_common.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,26 @@
262262
#define MICROPY_HW_STM32WB_FLASH_SYNCRONISATION (1)
263263
#endif
264264

265+
// RF core BLE configuration (a board should define
266+
// MICROPY_HW_RFCORE_BLE_NUM_GATT_ATTRIBUTES to override all values)
267+
#ifndef MICROPY_HW_RFCORE_BLE_NUM_GATT_ATTRIBUTES
268+
#define MICROPY_HW_RFCORE_BLE_NUM_GATT_ATTRIBUTES (0)
269+
#define MICROPY_HW_RFCORE_BLE_NUM_GATT_SERVICES (0)
270+
#define MICROPY_HW_RFCORE_BLE_ATT_VALUE_ARRAY_SIZE (0)
271+
#define MICROPY_HW_RFCORE_BLE_NUM_LINK (1)
272+
#define MICROPY_HW_RFCORE_BLE_DATA_LENGTH_EXTENSION (1)
273+
#define MICROPY_HW_RFCORE_BLE_PREPARE_WRITE_LIST_SIZE (0)
274+
#define MICROPY_HW_RFCORE_BLE_MBLOCK_COUNT (0x79)
275+
#define MICROPY_HW_RFCORE_BLE_MAX_ATT_MTU (0)
276+
#define MICROPY_HW_RFCORE_BLE_SLAVE_SCA (0)
277+
#define MICROPY_HW_RFCORE_BLE_MASTER_SCA (0)
278+
#define MICROPY_HW_RFCORE_BLE_LSE_SOURCE (0) // use LSE to clock the rfcore (see errata 2.2.1)
279+
#define MICROPY_HW_RFCORE_BLE_MAX_CONN_EVENT_LENGTH (0xffffffff)
280+
#define MICROPY_HW_RFCORE_BLE_HSE_STARTUP_TIME (0x148)
281+
#define MICROPY_HW_RFCORE_BLE_VITERBI_MODE (1)
282+
#define MICROPY_HW_RFCORE_BLE_LL_ONLY (1) // use LL only, we provide the rest of the BLE stack
283+
#endif
284+
265285
#else
266286
#error Unsupported MCU series
267287
#endif

ports/stm32/rfcore.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -548,30 +548,30 @@ static const struct {
548548
uint16_t AttMtu;
549549
uint16_t SlaveSca;
550550
uint8_t MasterSca;
551-
uint8_t LsSource; // 0=LSE 1=internal RO
551+
uint8_t LsSource;
552552
uint32_t MaxConnEventLength;
553553
uint16_t HsStartupTime;
554554
uint8_t ViterbiEnable;
555-
uint8_t LlOnly; // 0=LL+Host, 1=LL only
555+
uint8_t LlOnly;
556556
uint8_t HwVersion;
557557
} ble_init_params = {
558-
0,
559-
0,
560-
0, // NumAttrRecord
561-
0, // NumAttrServ
562-
0, // AttrValueArrSize
563-
1, // NumOfLinks
564-
1, // ExtendedPacketLengthEnable
565-
0, // PrWriteListSize
566-
0x79, // MblockCount
567-
0, // AttMtu
568-
0, // SlaveSca
569-
0, // MasterSca
570-
1, // LsSource
571-
0xffffffff, // MaxConnEventLength
572-
0x148, // HsStartupTime
573-
0, // ViterbiEnable
574-
1, // LlOnly
558+
0, // pBleBufferAddress
559+
0, // BleBufferSize
560+
MICROPY_HW_RFCORE_BLE_NUM_GATT_ATTRIBUTES,
561+
MICROPY_HW_RFCORE_BLE_NUM_GATT_SERVICES,
562+
MICROPY_HW_RFCORE_BLE_ATT_VALUE_ARRAY_SIZE,
563+
MICROPY_HW_RFCORE_BLE_NUM_LINK,
564+
MICROPY_HW_RFCORE_BLE_DATA_LENGTH_EXTENSION,
565+
MICROPY_HW_RFCORE_BLE_PREPARE_WRITE_LIST_SIZE,
566+
MICROPY_HW_RFCORE_BLE_MBLOCK_COUNT,
567+
MICROPY_HW_RFCORE_BLE_MAX_ATT_MTU,
568+
MICROPY_HW_RFCORE_BLE_SLAVE_SCA,
569+
MICROPY_HW_RFCORE_BLE_MASTER_SCA,
570+
MICROPY_HW_RFCORE_BLE_LSE_SOURCE,
571+
MICROPY_HW_RFCORE_BLE_MAX_CONN_EVENT_LENGTH,
572+
MICROPY_HW_RFCORE_BLE_HSE_STARTUP_TIME,
573+
MICROPY_HW_RFCORE_BLE_VITERBI_MODE,
574+
MICROPY_HW_RFCORE_BLE_LL_ONLY,
575575
0, // HwVersion
576576
};
577577

0 commit comments

Comments
 (0)
0