-
Notifications
You must be signed in to change notification settings - Fork 2.1k
cpu/nrf5x_common: map hwrng to SoC library if SoftDevice is present #11559
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
cpu/nrf5x_common: map hwrng to SoC library if SoftDevice is present #11559
Conversation
@Citrullin please test |
Does not compile for Also the example does not open a shell on nrf52dk (the same for master, so unrelated but not testable), when using the softdevice. Does open a shell with nrfmin though.
|
I just found that it doesn't even compile on master when
I can't reproduce that. Everything works smooth on my machine. Did you check out my branch or merge/pick the commit somehow? Otherwise this seems like a toolchain issue. I'm on:
|
Just checked, the fix seems to do the job for AFAIK the softdevice was never verified to work with the |
139780b
to
84ca8b5
Compare
Thanks @haukepetersen! I've reviewed, tested and merged your changes into my branch and rebased + squashed this PR afterwards to run CI |
} while (avail < (uint8_t)num); | ||
|
||
ret = sd_rand_application_vector_get((uint8_t *)buf, (uint8_t)num); | ||
assert(ret == NRF_SUCCESS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also be (void)ret;
'ed, in case assert resolves to NOP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I have missed that.
@PeterKietzmann I think its the easiest if you fix that in your branch directly?!
Ok. Ready to squash? |
yes, please go ahead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, works as expected and code is valid
d7c2871
to
7ee9905
Compare
Squashed |
Merged :-) |
Contribution description
According to this comment which bases on Nordic documentation, the hardware RNG can't be accessed when the SoftDevice is used. The fix maps our
hwrng_read()
function the the respective library function call (see here for reference)Testing procedure
(i)
Build/flash/term examples/gnrc_networking for an nrf5X based board.
(ii)
Build/flash/term tests/periph_hwrng for an nrf5x based board and include the SoftDevice package. E.g.:
USEPKG=nordic_softdevice_ble BOARD=nrf52dk make -C tests/periph_hwrng flash term
W/o this fix, there is no output as the initialization hangs before main() is called. W/ this fix, everything should work as expected.
Issues/PRs references
Fixes #11091