This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

RNG Functionalities are not working with SOFT DEVICE

Hi Team,

We are working on NRF52840 module with BLE functionalities.Tested the RNG functionalities alone with example project (examples\peripherals\rng ) it is working fine.When we integrated with our project RNG functionalities are not working.

While running we are getting error code "NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES" from the function "nrf_drv_rng_rand". we have enabled the macro "SOFTDEVICE_PRESENT".

Could any one have idea on this issue, or is there any other way we can integrate the RNG functionalities along with crypto MBDELTS Library. It is very urgent for us to deliver the things to customer.

Regards,

Srinivas.V

  • I just answered a similar question here, so my notes might help; maybe look at something like nrf_crypto_rng_init() in nrf_crypto_rng.c tosee if that makes clear the restrictions

    // Access type Definition
    // ======================
    // Restricted
    //   The hardware peripheral is used by the SoftDevice and is outside
    //   the application sandbox. When the SoftDevice is enabled, it shall
    //   only be accessed through the SoftDevice API. Through this API, the
    //   application has limited access.
    // Blocked
    //   The hardware peripheral is used by the SoftDevice and is outside the
    //   application sandbox.
    //   The application has no access. Interrupts from blocked peripherals
    //   are forwarded to the SoftDevice by the MBR and are not available to
    //   the application, even inside a Radio Timeslot API timeslot.
    // Open
    //   The hardware peripheral is not used by the SoftDevice.
    //   The application has full access.
    //
    // Table 3: Hardware access type definitions
    //
    // Instance SD Enabled  SD Disabled Restrictions
    // ======== ==========  =========== ======================================================
    // CLOCK    Restricted    Open
    // POWER    Restricted    Open
    // BPROT    Restricted    Open
    // RADIO    Blocked       Open      Available through the Radio Timeslot API
    // TIMER0   Blocked       Open      Available through the Radio Timeslot API
    // RTC0     Blocked       Open
    // TEMP     Restricted    Open
    // RNG      Restricted    Open
    // ECB      Restricted    Open
    // CCM      Blocked       Open      Available during a Radio Timeslot API
    // AAR      Blocked       Open      Available during a Radio Timeslot API
    // EGU/SWI1 Restricted    Open      Blocked only when Radio Notification signal is enabled
    // Radio    Restricted    Open      Blocked only when Radio Notification signal is enabled
    // EGU/SWI5 Blocked       Open
    // NVMC     Restricted    Open
    // MWU      Restricted    Open      Limitations on use of MWU when SoftDevice is enabled
    // FICR     Blocked       Blocked
    // UICR     Restricted    Open
    // NVIC     Restricted    Open      Use SoftDevice NVIC API for configuration when SoftDevice enable

  • Hi,

    The SoftDevice needs the RNG peripheral, so you cannot use it directly. There are several options, though:

    All of the above use the RNG peripheral (by adding more layers of abstractions). The nrf_crypto RNG module can also use the CC310 RNG on the nRF52840, depending on how you configure the module in sdk_config.h.

  • Hi Einar,

    Thanks for your reply.  But it comes to RNG,  RNG peripheral is different and CC310 RNG  both are different engines.

    If CC310 is available we can use that one only, if not available we can use RNG peripheral with nrf crypto.

    Thanks,

    Srinivas.V

  • Hi Srinivas, 

    Srinivas V said:
    But it comes to RNG,  RNG peripheral is different and CC310 RNG  both are different engines.

    Yes, that is correct.

    Srinivas V said:
    If CC310 is available we can use that one only, if not available we can use RNG peripheral with nrf crypto.

    You can use nrf_crypto as a front end for both the RNG peripheral (all nRF52xxx devices) and the CC310 RNG (only nRF52840).

    Einar

  • HI Einar, 

    Thanks for your reply, if we are going to use the RNG along with crypto(mbedTLS) as front end,

     1. In back ground how RNG will work like interrupt mode or Polling mode along with SD.

     2. SD also using the same RNG peripheral for it's internal use , at that time how it manages with Crypto functionalities.At this time Crypto functions are need to wait until SD releases the RNG peripheral, correct me if i am wrong.

    3. Is there any impact on SD if we are going to use the mbedTLS crypto libraries in my application with respect to timing and other aspects.

    4. If we want to use the mbed TLS crypto along with RNG,what are the macros we need to enable in sdk_config.h file additionally.

    Regards,

    Srinivas.V 

Related