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

Cordio: BLE thread loop fixes #44

Merged
merged 2 commits into from
Dec 2, 2019

Conversation

sandeepmistry
Copy link
Contributor

This resolves #33.

This pull request has two changes:

  1. It calls timer.start() in the BLE thread loop. Without this, timer.read_high_resolution_us() always returns 0.

Note: the issue is also present in the mbed sample code the HCI transport was based on: https://github.com/ARMmbed/mbed-os-cordio-hci-passthrough/blob/fix-wsf-msg/main.cpp#L86 (@facchinm should we inform them?)

  1. It reverts part of pull request cordio: lower power polling with timeout #15. Unfortunately, the WSF_MS_PER_TICK needs to match the value mbed was compiled with for the supervision timeout to match: https://github.com/ARMmbed/mbed-os/blob/19e762298f9a020606f7358539bb653be0de8e4f/features/FEATURE_BLE/targets/TARGET_CORDIO_LL/stack/controller/sources/ble/lctr/lctr_main_conn.c#L1168-L1174

@facchinm I think we should measure the power consumption again. Then re-compile mbed if we need to adjust the value.

It's currently set to 1 ms:

however, the default appears to 10 ms: https://github.com/arduino/ArduinoCore-nRF528x-mbedos/blob/beac74ca3cd9d07363f66cf9cda6b143e4385cd2/cores/arduino/mbed/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/wsf/include/wsf_timer.h#L40

@manchoz
Copy link
Collaborator

manchoz commented Nov 30, 2019

LGTM.

Fixes issues with async/callback code too.

@facchinm
Copy link
Contributor

facchinm commented Dec 2, 2019

Looks perfect, I'm merging it and then performing all the necessary power usage tests to make sure we didn't regress.

@facchinm facchinm merged commit 8dc4290 into arduino-libraries:master Dec 2, 2019
facchinm added a commit to arduino/ArduinoCore-nRF528x-mbedos that referenced this pull request Dec 2, 2019
Restore BLE low power functionality after arduino-libraries/ArduinoBLE#44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BLE nano 33 does not report or disconnect from centra
3 participants