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

NRF52 and MWU

Hi,

I've been debugging my code and would like to use the Memory Watch Unit (MWU). I use SDK version 11, s132, and NRF52.

Could you point to an example of using MWU with SoftDevice enabled? Or any kind of example as I've not been able to find any... with or without the SD.

I've tried to use the NRF_MWU->REGION members 0 and 1, but I get an application fault 0x1001. Is there somewhere in the documentation that the SD is using these? Or is this something else?

If I use the regions 2 and 3, I get an application fault 1. I added the following to my main function, but it did not help.

uint32_t result = sd_softdevice_vector_table_base_set( ApplicationAddress );
APP_ERROR_CHECK( result );

sd_nvic_SetPriority( MWU_IRQn, APP_IRQ_PRIORITY_THREAD );
sd_nvic_ClearPendingIRQ( MWU_IRQn );
sd_nvic_EnableIRQ( MWU_IRQn );

To start the memory watching:

NRF_MWU->REGION[2].START = (uint32_t) <start address>
NRF_MWU->REGION[2].END   = (uint32_t) <end address>
NRF_MWU->INTENSET    = MWU_INTENSET_REGION2WA_Enabled << MWU_INTENSET_REGION2WA_Pos;
NRF_MWU->REGIONENSET = MWU_REGIONENSET_RGN2WA_Enabled << MWU_REGIONENSET_RGN2WA_Pos;

And I have an IRQ handler function:

void MWU_IRQHandler( void )
{
	.. code ...
}

Ideas would be appreciated,

Kai

Parents Reply
  • @Sigurd - The table says the MWU is restricted, not blocked, and from the description of the restrictions those could be achieved by using one region protection. That would leave three unused and from what I've experimented now is that the #2 and #3 seem to be unused.

    When I make a deliberate write violation to the area I want to protect I get a softdevice_fault_handler() call with id 1. Still not able to get that to go to the MWU handler. :(

Children
No Data
Related