How to access GPREGRET2 with sd API call?
thanks
jing
How to access GPREGRET2 with sd API call?
thanks
jing
This is an unfortunate miss from our side, the s132 lacks API for setting the GPREGRET2 register. However, it is possible to workaround this by disabling the MWU when you want to access it:
#define TEST_UNPROTECT_POWER \
NRF_MWU->PREGION[0].SUBS &= ~(MWU_PREGION_SUBS_SR0_Include << MWU_PREGION_SUBS_SR0_Pos)
#define TEST_REPROTECT_POWER \
NRF_MWU->PREGION[0].SUBS |= (MWU_PREGION_SUBS_SR0_Include << MWU_PREGION_SUBS_SR0_Pos)
This has already been reported internally.
This is an unfortunate miss from our side, the s132 lacks API for setting the GPREGRET2 register. However, it is possible to workaround this by disabling the MWU when you want to access it:
#define TEST_UNPROTECT_POWER \
NRF_MWU->PREGION[0].SUBS &= ~(MWU_PREGION_SUBS_SR0_Include << MWU_PREGION_SUBS_SR0_Pos)
#define TEST_REPROTECT_POWER \
NRF_MWU->PREGION[0].SUBS |= (MWU_PREGION_SUBS_SR0_Include << MWU_PREGION_SUBS_SR0_Pos)
This has already been reported internally.
How do I clear it?
Lets say I unprotect, then I want to write to it, then I reprotect it.
Previously you have to write a mask of bits to clear and then the value.
Is this just an abstraction on top of a standard R/W register? As I don't see any address that I'd write to it's mask to clear etc..
This is still locking up the NRF52 ......
// TEST_UNPROTECT_POWER
NRF_MWU->PREGION[0].SUBS &= ~(MWU_PREGION_SUBS_SR0_Include << MWU_PREGION_SUBS_SR0_Pos);
// Update it
NRF_POWER->GPREGRET2 = (value_to_write & 0xFF);
// TEST_REPROTECT_POWER
NRF_MWU->PREGION[0].SUBS |= (MWU_PREGION_SUBS_SR0_Include << MWU_PREGION_SUBS_SR0_Pos);
If I comment out the Updating it line of code, no problem.
From s132 v.3.0.0 it is possible to use the sd_power_gpregret_ APIs to access the GREPRET2 register.
Do you get a hardfault when you run the code above?
I have a print statement (via the UART, non interrupt driven, just out the UART register, loop until its done etc so super simple, yes, locks the cpu from much else while printing but quick and dirty)
Print statement never executes.
Comment out the writing to the register and all good. prints fine.
but are you using s132 v.3.0.0?