Hi,
I need to save a 16 bit counter into a retained register.
I cannot use the 2 GPRETREG since they are already used and I cannot write internal flash.
I cannot use RAM retained.
Is there any other register suitable for this purpose?
Hi,
I need to save a 16 bit counter into a retained register.
I cannot use the 2 GPRETREG since they are already used and I cannot write internal flash.
I cannot use RAM retained.
Is there any other register suitable for this purpose?
From what I can see GPREGRET2 is defined also in the latest SDK version. Can you clarify exactly where you see GPREGRET2 missing (file and line) and which versions you are comparing?
This documentation doesn't have any mentioning of the GPREGRET2:
https://docs.nordicsemi.com/bundle/nrfx-apis-latest/page/group_nrf_power_hal.html
While the earlier version of SDK documentation has it mentioned here
https://docs.nordicsemi.com/bundle/ncs-2.0.1/page/nrfx/drivers/power/hal.html
as functions to access the value:
NRF_STATIC_INLINE void nrf_power_gpregret2_set(NRF_POWER_Type *p_reg, uint8_t val)
and
NRF_STATIC_INLINE uint8_t nrf_power_gpregret2_get(NRF_POWER_Type const *p_reg)
This is where the confusion comes, as in the latest documentation of SDK or nrfx I am not able to see any mentioning of gpregret2 as a register or any mentioning of a function to use to write to this register.
It does not specifically mention gpregret1 or gpregret2 in the API documentation, but both are there (gpregret2 here).
Thanks for the confirmation, Einar. It is just confusing, that we do have nrfx functions for one, but not for another, which made me thinking the support for the GPREGRE2 was dropped. Especially, that there is a line
"This register is not available in all MCUs."
in the https://docs.nordicsemi.com/bundle/ncs-2.0.1/page/nrfx/drivers/power/hal.html documentation.
I see. That is not the case, though. If you compare the old nrf_power_gpregret_set() and nrf_power_gpregret2_set() you can see it takes two parameters. The new nrf_power_gpregret_set() takes three parameters, where one is the register number. So instead of having separate API functions for each GPREGRET register, the same is used for all.