Feature update n rf5 sdk 15.0.0#9473
Conversation
|
This version now seems to compile for all nRF51 and nRF52 boards I found. It seems to work (at least to some extend) with nRF52DK. However, I don't have currently a possibility of testing the actual IPv6 support (since I'm developing on a Mac instead of Linux). Hence, at minimum, the IPv6 functionality must be tested before this can be merged. I will now continue to make a useful BLE GATT example. Todo:
|
|
@kaspar030 @haukepetersen Here is the first version of the PR updating nRF5 SDK support to the latest released SDK. There is still some way to go (e.g. static tests fail), but I'm placing this here as a start and with the hope that also other people would contribute. |
c09fac9 to
557f0e1
Compare
|
I restructured to commits to make it easier to review the various changes. I believe this starts now to be ready for better testing and reviews. I have tested the basic BLE functionality and seems to work just fine. I haven't tested 6lowpan since I don't have a possibility for that. I am planning next to refactor |
|
There still seems to be a problem that at least some of the BLE callbacks take place in the I don't know how we should handle this: should there be some trampoline that executes the BLE callbacks in the Any opinions? If a trampoline, where could I find a suitable example? |
|
Another issue seems to be that I get hardfaults when using It seems to crash when trying to lock a mutex: L296 in my source code is the return after setting PendSVSet: |
|
What is even more interesting that with exactly the same binary, and no flashing in between, sometimes I get a hardfault fairly soon, even before the system has booted up, sometimes the system seems stable for a long time and is able to serve multiple connections. So, I currently suspect that the hardfaults are somehow strongly related to the timing internal to the system. Perhaps to interrupt priorities. Perhaps RIOT uses interrupt priorities that the SoftDevice would like to be preserved to itself. |
|
I am currently suspecting NVIC conflicts. The SDS 6.0 states the following: "For robust system function, the application program must comply with the restriction and use the NVIC API for configuration when the SoftDevice is enabled." However, it will take me some time to figure out how RIOT uses NVIC. At this point (July 10 2018) it looks like that the crashing is somehow related to NVIC priorities. It looks like that the crash comes from xtimer_usleep trying to return, i.e. from the timer interrupt. |
|
It looks like that I tentatively managed to fix the problem. Apparently the problem was with the default RIOT interrupt level being too low for the SoftDevice, and interrupt priority initialisation missing in nRF52 |
|
This fix has now been pushed, but apparently I still need to rebase. The only remaining issue I see is running the SD callbacks in the idle stack. The PR contains a fix for this, simply increasing the IDLE stack size: 541ee73#diff-6ab4895ed5053af8e5f73d302112cf7dR79 However, I am not sure if that is the right way of fixing this. |
e61e9af to
c985532
Compare
|
Rebased on |
c985532 to
5b932fc
Compare
|
Please note that I do not know how to fix the following Travis CI problem: I don't even understand why the PR gets that complained. |
Because the commit message starts with |
|
BTW, all the commit messages need rewording. The RIOT convention is to prefix the commits with the path (complete or partial) of the files that are being touched. |
kYc0o
left a comment
There was a problem hiding this comment.
Small comment, I'll try to test soon.
|
|
||
| # special options when using SoftDevice | ||
| ifneq (,$(filter nordic_softdevice_ble,$(USEPKG))) | ||
| ifneq (,$(filter nordic_softdevice_ble nordic_softdevice_sixlowpan,$(USEPKG) $(USEMODULE))) |
There was a problem hiding this comment.
If nordic_softdevice_ble is deprecated, please remove.
There was a problem hiding this comment.
Nope, it is not deprecated. The package has now been split into to a package proper (nordic_softdevice_ble) and a module (nordic_softdevice_sixlowpan) inside the package. The package itself brings in the softdevice and BLE, including the possibility of using the BLE GATT APIs from the SD. The module adds 6lowpan glue on the top of that.
I needed to separate them so that I can compile binaries that want only GATT and not 6lowpan. Without the split there was an implicit dependency that brought in the whole TCP/IP stack into the binary, even though it was not needed.
|
I can rebase and edit the commits at some point. However, this should be tested first, and as I have written, I don't have the possibility of testing the IPv6 / 6lowpan functionality. I have tested the BLE / GATT functionality now. It works and looks stable. |
|
I have two nrf52dk boards. I'm testing ping6 between them and it doesn't work... I have no idea how 6loWPAN is adapted on top of BLE and if a "simple" ping6 is proof enough that the implementation doesn't work. |
|
I'm not 100% that it has ever worked between two boards, @kaspar030 ? The instructions are for between nRF52DK and Linux. I'm using Mac OS X, not Linux. The instructions can be found here: https://github.com/AaltoNEPPI/RIOT/blob/5b932fc707562f73b55eb59f38d8623812225263/pkg/nordic_softdevice_ble/README-BLE-6LoWPAN.md |
|
I've tried to compile |
I never tried that. Probably doesn't and never did. |
|
I think I've been testing with |
|
skald_ibeacon and skald_eddystone are completely from scratch implementations to support BLE, thus they don't require any external package. Any example associated to nimble uses the former mynewt BLE stack, now in it's own repo. |
When using the nRF5 SD, Nordic recommends that
instead of using the NVIC_* macros / inline functions
directly, one shoudl use the corresponding
sd_nvic_* inline functions. At least in SKD 15, they
are simple wrappers that check that the parameters
are among the allowed values, return an error if not
and perform the corresponding NVIC_* call if allowed.
Hence, in order to be effective, we have to check
for the error return value and act appropriately
if we get an error.
In cortexm_init.c we cannot use the safety macros,
since there we want to set things that are not supported
by the SD, prior to initialising the SD.
This commit changes the PendSV interrupt priority to
one lower than the default priority, using Cortex-M
sub-priorities.
b8c7858 to
fbf84cb
Compare
|
With the lastest commit a7cc4c4 Linux is now able to connect to the nRF and send packets. However, for some reason there seems to be something wrong in either packet handling or sending packets in the nRF52 end. That is, I can see the Furthermore, the current version defines enormous (20k) packet buffers, as we have to buffer two full 1280 byte input packets and apparently reallocate them larger when sending out, or something. I will continue with this, but I would appreciate help with understanding how the 6lowpan and IPv6 layers are working. |
815e08c to
a7cc4c4
Compare
This commit enables Cortex-M CPU interrupt sub-priorities
and allows the PendSV interrupt to have a priority different
from the default one. Together these two preprocessor
defines can be used to have PendSV always run as the last interrupt
before returning from the interrupt stack back to the user space.
Running PendSV as the last interrupt before returning to the
user space is recommended by ARM, as it increases efficiency.
Furthermore, that change enhances stability a lot with the
new nRF52 SoftDevice support, currently being worked in
PR RIOT-OS#9473.
This commit merely enables sub-priorities and a separate
PendSV priority to be used without changing the default
RIOT behaviour.
This commit enables Cortex-M CPU interrupt sub-priorities
and allows the PendSV interrupt to have a priority different
from the default one. Together these two preprocessor
defines can be used to have PendSV always run as the last interrupt
before returning from the interrupt stack back to the user space.
Running PendSV as the last interrupt before returning to the
user space is recommended by ARM, as it increases efficiency.
Furthermore, that change enhances stability a lot with the
new nRF52 SoftDevice support, currently being worked in
PR RIOT-OS#9473.
This commit merely enables sub-priorities and a separate
PendSV priority to be used without changing the default
RIOT behaviour.
This commit enables Cortex-M CPU interrupt sub-priorities
and allows the PendSV interrupt to have a priority different
from the default one. Together these two preprocessor
defines can be used to have PendSV always run as the last interrupt
before returning from the interrupt stack back to the user space.
Running PendSV as the last interrupt before returning to the
user space is recommended by ARM, as it increases efficiency.
Furthermore, that change enhances stability a lot with the
new nRF52 SoftDevice support, currently being worked in
PR RIOT-OS#9473.
This commit merely enables sub-priorities and a separate
PendSV priority to be used without changing the default
RIOT behaviour.
|
I'm afraid I will not be able to continue with this in the foreseeable future. Anyone to adopt? |
|
I don't even have hardware yet for those platoforms to test this, and
zero experience with BLE -- I only stumbled on #11951 looking into
whether IPSP would be usable for me at all. Sorry, but I can't.
|
This commit enables Cortex-M CPU interrupt sub-priorities and allows the PendSV interrupt to have a priority different from the default one. Together these two preprocessor defines can be used to have PendSV always run as the last interrupt before returning from the interrupt stack back to the user space. Running PendSV as the last interrupt before returning to the user space is recommended by ARM, as it increases efficiency. Furthermore, that change enhances stability a lot with the new nRF52 SoftDevice support, currently being worked in PR #9473. This commit merely enables sub-priorities and a separate PendSV priority to be used without changing the default RIOT behaviour.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
Contribution description
This PR updates the nRF5 and Nordic Softdevice support to nRF SDK5 version 15.0.0.