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

Cryptocell setting the CRYPTOCELL_IRQn flag?

Hello we are using SDK 15.3 and SD s140 v6.1.1, we use the cryptocell to do some AES encryption as well as MAC and ECDH. 

We noticed that our application was running quite high current (5+ma) and I am tasked with finding out why.  I found that our chip was not going to sleep when we called sd_app_evt_wait.  This was due to the interrupt flag (CRYPTOCELL_IRQn) for the cryptocell being set to the pending state.  If I manually clear the flag each time we call sd_app_evt_wait, the processor sleeps as expected.  We are using the version of the CC310 library where no interrupts should be used (libnrf_cc310_0.9.12.a), and I see no examples in the SDK where the cryptocell flag needs to be manually cleared. 

Is this normal behavior?  Could something not be configured properly?  We do no enable the cryptocell IRQ.  It looks like the flag gets set on every cryptocell operation.  

Thanks!

Parents Reply
  • Hi,

    This is not caused by the CC310 library itself but is a consequence of how sd_app_evt_wait() is implemented in the SoftDevice. The sd_app_evt_wait() checks if there are any pending interrupts, and will return immediately instead of going to sleep. An important detail is that it only checks if interrupts are pending, not if they are enabled. This is intentional, and useful in some situations. (For instance, if you need to wake up regularly on RTC, you can wake up on the RTC event, but not have to spend CPU cycles executing an ISR when sleeping with WFE).

    The result is that you should always clear the CC310 event before calling sd_app_evt_wait() (directly or indirectly) when NRF_CRYPTO_BACKEND_CC310_INTERRUPTS_ENABLED set to 0.

Children
Related