I am modifying the Qorvo UWB SDK to add BLE operations.
I have posted a couple other topics about different issues..
I have ported my code to the latest Qorvo SDK, They use an interesting trick to include the SD binary in the linked file (elf/hex)
they convert the binary to a string of bytes c file to complie and link and use a label in the ld file to position it.
before I was leaving space for the sd binary, and using the Ozone debugger script to load the SD hex over the loaded elf binary
anyhow.. it seems the SD state has changed using the included file.. (I am using s140 as I need both central and peripheral)
my old ble init code ( left out the checking of the err_code in this post to keep the code issue small )
err_code = nrf_sdh_enable_request(); // new returns 8 (already init) --------- oops (_sdh_disable_request(); make err_code=0, but the rest still fails..
uint32_t ram_start = 0;
ble_cfg_t ble_cfg;
// Step 1: Set default BLE configuration FIRST - this establishes base RAM requirements
err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start); // returns 0 and the value expected
#define TOTAL_BLE_CONNECTIONS 8 // 1 phone + 7 beacons (conservative limit)
memset(&ble_cfg, 0, sizeof(ble_cfg));
ble_cfg.conn_cfg.conn_cfg_tag = APP_BLE_CONN_CFG_TAG;
ble_cfg.conn_cfg.params.gap_conn_cfg.conn_count = TOTAL_BLE_CONNECTIONS;
ble_cfg.conn_cfg.params.gap_conn_cfg.event_length = NRF_SDH_BLE_GAP_EVENT_LENGTH; // Default event length
err_code = sd_ble_cfg_set(BLE_CONN_CFG_GAP, &ble_cfg, ram_start); // returns 8, invalid state------------------------------------------- what to do about this ------
memset(&ble_cfg, 0, sizeof(ble_cfg));
ble_cfg.gap_cfg.role_count_cfg.adv_set_count = 1; // Enable 1 advertising set
ble_cfg.gap_cfg.role_count_cfg.periph_role_count = 1; // Enable 1 peripheral connection
// Enable central role for controller to connect to beacons
// Match role count to connection count (conservative limit)
ble_cfg.gap_cfg.role_count_cfg.central_role_count = TOTAL_BLE_CONNECTIONS - 1; // Subtract 1 for phone connection
ble_cfg.gap_cfg.role_count_cfg.central_sec_count = 0; // Disable central security (not needed for beacons)
QLOGD("Enabling central role: 1 peripheral + %d central = %d total connections",
TOTAL_BLE_CONNECTIONS - 1, TOTAL_BLE_CONNECTIONS);
err_code = sd_ble_cfg_set(BLE_GAP_CFG_ROLE_COUNT, &ble_cfg, ram_start); // this USES ram_start, not gets it..
err_code = nrf_sdh_ble_enable(&ram_start);
but now that the SD is in the loaded elf, it appears to be inited, before my app code gets loaded, see the comments in the code above.
thanks for any help..