Skip to content

Add support for Cordio to NRF52 Devices #8876

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

Merged
merged 27 commits into from
Nov 28, 2018

Conversation

donatieng
Copy link
Contributor

Description

This PR adds optional support for the Cordio 5.0 stack to NRF52x targets.
This is achieved by running the Cordio Link Layer (released under the PBL) on these platforms.

Pull request type

[ ] Fix
[ ] Refactor
[X] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

@cmonr
Copy link
Contributor

cmonr commented Nov 27, 2018

sigh
So this was the special PR...

And here I was ready to blow a gasket.

@cmonr cmonr added the risk: R label Nov 27, 2018
Copy link
Member

@pan- pan- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see a single .a file; is it a universal library ?
Could you mention qualification status in the README ?
What's the status on inclusion of uECC ?

@@ -306,7 +306,7 @@ struct GapAdvertisingReportEvent : public GapEvent {
struct advertising_t {
received_advertising_type_t type;
connection_peer_address_type_t address_type;
const address_t& address;
address_t address;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for that change ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit adding the initial change says "Fix advertising_t in GapEvents.h having a reference to an inexisting address_t instance". I'm not sure which usage of it caused the issue though.

void NRFCordioHCIDriver::start_reset_sequence()
{
// Make sure extended adv is init
DmExtAdvInit();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to put that here ?
That function is called by Cordio BLE if the controller supports extended advertising.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be called before the reset sequence to activate the extended reset sequence required to fetch extended advertising related info (number of advertising sets supported, etc)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm disappointed with the inconsistency of the reset sequence with EA; I suppose we should enable it by default in CordioBLE then if not supported fallback to legacy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

* RADIO
* TIMER0
* PPI channels 14 and 15
* HF clock is enabled
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it always on ? That's gonna be an issue for power consumption.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 27, 2018

@pan- good catch, features/FEATURE_BLE/targets/TARGET_CORDIO_LL/cordio_stack/libcordio_stack.a needs license file and readme to decribe what it contains. please add it

if (wsf_ticks > 0) {
WsfTimerUpdate(wsf_ticks);

_last_update_us -= (last_update_ms * 1000);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_last_update_us -= (last_update_ms * 1000);
_last_update_us -= (wsf_ticks * WSF_MS_PER_TICK * 1000);

otherwise you're losing milliseconds that aren't passed in as ticks

Copy link
Member

@bulislaw bulislaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I skimmed the code and sanity checked the integration. Someone else needs to have a look at the code.

@ghost
Copy link

ghost commented Nov 27, 2018

I can see a single .a file; is it a universal library ?

There are currently two .a files. One contains the Cordio LL library libcordio_stack.a and the other contains the nordic cordio stack lib_cordio_stack_nordic.a

Could you mention qualification status in the README ?

I'll add a license and README for each library

What's the status on inclusion of uECC ?

The uECC is included as source in TARGET_CORDIO_LL/thirdparty/uECC

@donatieng
Copy link
Contributor Author

donatieng commented Nov 27, 2018

@scartmell-arm

I can see a single .a file; is it a universal library ?

There are currently two .a files. One contains the Cordio LL library libcordio_stack.a and the other contains the nordic cordio stack lib_cordio_stack_nordic.a

I think @pan- was wondering if it worked across all toolchains (both NRF52840 and NFR52832 are CM4s so we only need Armv7-m in terms of architecture)

Copy link
Contributor

@0xc0170 0xc0170 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The most of the files are for the library, looks good to me.

The only request is as my above comment - add licenses for binaries and readme describing them. As soon as they are in, will be approved by me

@ghost
Copy link

ghost commented Nov 27, 2018

I think @pan- was wondering if it worked across all toolchains (both NRF52840 and NFR52832 are CM4s so we only need Armv7-m in terms of architecture)

While developing the compiled libraries worked with all 3 toolchains.

@donatieng
Copy link
Contributor Author

Thanks for confirming @scartmell-arm

@donatieng
Copy link
Contributor Author

@ARMmbed/mbed-os-maintainers we should be ready for CI

@donatieng
Copy link
Contributor Author

(Added compiler info asked by @0xc0170)

@pan- pan- force-pushed the public_pr_cordio_nordic_ll branch from 7834219 to c998248 Compare November 28, 2018 11:32
@pan-
Copy link
Member

pan- commented Nov 28, 2018

@0xc0170 PR rebased:
*
93d8c71 fix a rebase error, somehow labels have been exchanged during the rebase.
*
c998248 reintroduce the implementation changes made for the Bluetooth 5 feature.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 28, 2018

CI started

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 28, 2018

We are investigating failures now

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 28, 2018

@OPpuolitaival Please review dynamic-memory-usage

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 28, 2018

test and dynamic usage were restarted (issues should be fixed now in CI)

@mbed-ci
Copy link

mbed-ci commented Nov 28, 2018

Test run: SUCCESS

Summary: 4 of 4 test jobs passed
Build number : 4
Build artifacts
Build logs

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 28, 2018

The last one for 5.11 rc1 is going in 💯

@0xc0170 0xc0170 merged commit e2ae84e into ARMmbed:master Nov 28, 2018
@cmonr cmonr removed the risk: R label Nov 28, 2018
@donatieng
Copy link
Contributor Author

YAY! Thanks @ARMmbed/mbed-os-maintainers @ARMmbed/mbed-os-pan !

LDong-Arm added a commit to LDong-Arm/mbed-os that referenced this pull request May 11, 2020
In PR ARMmbed#8876 when we added Cordio support for nRF52* targets,
we attempted to use an RTOS idle hook to workaround sleep
latency issues. However, the condition to bypass sleeps
never gets satisfied, and BLE nRF52* targets have generally
worked fine over the past year.

This commit removes the hook to avoid dependency on RTOS,
enabling BLE on bare metal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants