Power Optimization when using the Crypto Cell on nRF5340

Hey, I have been trying to get to the root of additional current draw when crypto drivers are enabled. 

Without the crypto drivers enabled the current draw between two advertisements is around 3-5uA, with crypto drivers enabled it shoots up to 80uA

I am using the Crypto APIs for HMAC signing. 

These are the config options enabled in prj.conf 

CONFIG_TFM_PROFILE_TYPE_NOT_SET=y        
CONFIG_PSA_CRYPTO_DRIVER_OBERON=n
CONFIG_PSA_CRYPTO_DRIVER_CC3XX=y
CONFIG_NRF_SECURITY=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y
CONFIG_MBEDTLS_ENABLE_HEAP=n
As for the HMAC signing, I'm importing a key using psa_import_key() and signing using the psa_mac_ series of APIs for signing. 
I thought MBEDTLS might not be needed when hardware acceleration is used, but looks like it's being used during key import. 
 
Parents Reply Children
  • Hey, 

    I am using the Nordic nRF5340 DK and the Nordic PPK II in Ammeter mode. I'm using the supplied CR2032 cell for the measurements. 

    The BLE application starts advertising after initializing the peripherals needed. 

    I've followed the optimization recommendations and disabled the logging on both the images. 

    That's how I was able to get to about 3-5uA between advertisements. But once the crypto drivers were added to the project it increases this current to about 80uA as shown in the above screenshot. 

    CONFIG_TFM_PROFILE_TYPE_NOT_SET=y        
    CONFIG_PSA_CRYPTO_DRIVER_OBERON=n
    CONFIG_PSA_CRYPTO_DRIVER_CC3XX=y

    If I get rid of the above configs, the current consumption is back to 3-5uA. 

    The current consumption after a connection is established is much more in line with expectation. Just when the device is just advertising, between two advertisements the current consumption is a lot higher with the crypto drivers enabled. 
  • Hi,

    Cryptographic operations with hardware accelerator are executed faster at the expense of consuming more power. 

    Best regards,
    Dejan

  • Hey, 

    Yes, But while advertising we are not doing any crypto operations. Shouldn't the crypto module go to sleep when not used. 

    Advertising current without crypto driver included in the project is 10-15x smaller. We initialize and use crypto APIs only after connection is established.  

  • Hi,

    neo_here said:
    Yes, But while advertising we are not doing any crypto operations. Shouldn't the crypto module go to sleep when not used. 

    I have asked internally about the expected crypto module behavior.

    Please make sure that relevant peripherals are not enabled at the same time. Examples are serial drivers SPIM, TWIM and UART. 

    If all mentioned peripherals are disabled and you still see increased current draw, you could make a minimal sample which we could use for reproducing your issue on nrf5340-dk. Since I will be out of the office for the next 2 weeks, in case your issue requires urgent attention, you could open a new ticket where you would provide all necessary information.

    Best regards,
    Dejan

  • Hello,

    Please add CONFIG_TFM_LOG_LEVEL_SILENCE=y to your prj.conf file. This ensures that TF-M does not enable the UARTE1 peripheral for logging. If UARTE1 is enabled, it could explain the increased floor current you're observing.

Related