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

sd_app_evt_wait and unprivileged thread mode

Hello,

Our board is based on nRF52832 with S132 5.1.0, without RTOS. Now we have a requirement to protect sensitive memory areas with MPU, so I'm trying to run firmware in unprivileged mode (CONTROL=0x01), and I got Bus Fault in sd_app_evt_wait() handler. Should I use __WFE() instead, is it safe with SoftDevice enabled?

Dmitry

Parents
  • You are right, the sd_app_evt_wait always runs the sleep instructions in the privileged thread mode and hence it expects to return it to that state. I think this needs to be a feature request to change that behavior, as I do not see anything wrong in what you are doing. For now we are limited by this behavior.

    Could below be a possible workaround?

    Can we switch to privileged thread mode just before sleeping and change to unprivileged thread mode after wakeup? this way the SD thread mode switch behavior is consistent with the application.

Reply
  • You are right, the sd_app_evt_wait always runs the sleep instructions in the privileged thread mode and hence it expects to return it to that state. I think this needs to be a feature request to change that behavior, as I do not see anything wrong in what you are doing. For now we are limited by this behavior.

    Could below be a possible workaround?

    Can we switch to privileged thread mode just before sleeping and change to unprivileged thread mode after wakeup? this way the SD thread mode switch behavior is consistent with the application.

Children
Related