Skip to content

Commit

Permalink
Reliably avoid r_ble_hci_ram_hs_cmd_tx assert (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoernQ authored Nov 28, 2023
1 parent 97a2c4c commit b0958f1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions esp-wifi/src/ble/npl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ extern "C" {

pub(crate) fn r_ble_hci_trans_buf_free(buf: *const u8);

pub(crate) fn ets_delay_us(us: u32);
static mut ble_hci_trans_env_p: u32;
}

#[repr(C)]
Expand Down Expand Up @@ -1098,9 +1098,17 @@ pub(crate) fn ble_init() {
self::ble_os_adapter_chip_specific::ble_ll_random_override as *const u32 as u32;
}

// this is a workaround for an unclear problem
// (ASSERT r_ble_hci_ram_hs_cmd_tx:34 0 0)
ets_delay_us(10_000);
// this is to avoid (ASSERT r_ble_hci_ram_hs_cmd_tx:34 0 0)
// r_ble_hci_trans_cfg_ll initializes ble_hci_trans_env_p + 0x34
// it's called by r_ble_ll_task which is run in another task
// in r_ble_hci_ram_hs_cmd_tx this is checked for non-null
while (ble_hci_trans_env_p as *const u32)
.add(0x34 / 4)
.read_volatile()
== 0
{
// wait
}

debug!("The ble_controller_init was initialized");
}
Expand Down

0 comments on commit b0958f1

Please sign in to comment.