Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SDK15: Missing functions in nrfx_rng.c

I'm trying to migrate to SDK15.0 (from 14.2) for the nRF52_DK and nRF25840_DK.  Using the new nrfx_rng.c driver I'm getting a link error as a few functions can't be found:

[Warning] trng_api.c@93,0: #223-D: function "nrf_drv_rng_bytes_available" declared implicitly
[Warning] trng_api.c@97,0: #223-D: function "nrf_drv_rng_block_rand" declared implicitly
[Warning] trng_api.c@106,0: #223-D: function "nrf_drv_rng_rand" declared implicitly

Is there a reason these aren't defined in nrfx_rng.c?  In the 14.2 SDK these are in nrf_drv_rng.c and I'm surprised that I need to include the legacy source file.  Am I missing something?

Thank You,

Ralph

Parents
  • Hi,

    The nrf_drv_rng_* functions are from the "legacy" driver, and as you get this linker warning I assume these functions are called by some code/library used by your application.

    Why are you using the nrfx driver? The fact that the documentation refers to nrf_drv_* as "legacy" implies that it would be better to witch to nrfx, but that is not really the case. For instance, the RNG can only be used directly when not using a SoftDevice. If the SoftDevice is enabled, then the RNG has to be used via SoftDevice API's. This is not handled by the nrfx driver, so it can only be used directly for projects not using the SoftDevice. The nrf_drv_rng driver however, handles this seamlessly. If building the SoftDevice is enabled then it will use SoftDevice API's and if not, it will use nrfx for the low-level stuff.

    For peripherals that are not protected the SoftDevice the nrf_drv_* and nrfx_* drivers are in practice identical where the legacy API is just defined to the corresponding nrfx API types and functions, so everything is handled by the processor. Therefor I do not see any practical benefits of switching to the nrfx API.

Reply
  • Hi,

    The nrf_drv_rng_* functions are from the "legacy" driver, and as you get this linker warning I assume these functions are called by some code/library used by your application.

    Why are you using the nrfx driver? The fact that the documentation refers to nrf_drv_* as "legacy" implies that it would be better to witch to nrfx, but that is not really the case. For instance, the RNG can only be used directly when not using a SoftDevice. If the SoftDevice is enabled, then the RNG has to be used via SoftDevice API's. This is not handled by the nrfx driver, so it can only be used directly for projects not using the SoftDevice. The nrf_drv_rng driver however, handles this seamlessly. If building the SoftDevice is enabled then it will use SoftDevice API's and if not, it will use nrfx for the low-level stuff.

    For peripherals that are not protected the SoftDevice the nrf_drv_* and nrfx_* drivers are in practice identical where the legacy API is just defined to the corresponding nrfx API types and functions, so everything is handled by the processor. Therefor I do not see any practical benefits of switching to the nrfx API.

Children
No Data
Related