I am just curious to know if there is a way on S7G2 to detect Power OFF condition to write couple of variables to internal data flash, and if there is a way to do that, the next question is would it have enough time to write 8 bytes before quitting.
If there is way then I don't have to worry about designing a super cap board/Circuitry that can hold the charge for 3-5 secs on power OFF.
I have a requirement to keep track some variables every 0.1 changes, and I don't want to write to memory every 0.1 change as I would hit the upper limit of 100,000 erase/write cycles in a couple of months.
Any input on this is much appreciated.
Thanks,
Sam
Hello Sam,
there is the Low Voltage Detection (LVD) HAL module available in the SSP. It could be used to execute user's code when the VCC crosses the detection threshold.
Best regards,anper
How can I access the below mentioned VBAT Backup Register Area using Synergy API's for storing application data:
Sam,
I do not think that there are any API that you can use to access the VBATT backup registers.
But they are easily accessed.
Below is an example.
Regards,
Richard
/* HAL-only entry function */
#include "hal_data.h"
void hal_entry(void)
{
/* TODO: add your own code here */
/*
* VBATT registers are Write Protected
* Enable access
* Refer to section 13 of S7G2 Hardware User's Manual for more info
*/
R_BSP_RegisterProtectDisable(BSP_REG_PROTECT_OM_LPC_BATT);
/* Zero out VBATT Backup Registers */
for( uint16_t count=0; count<512;count++ )
R_SYSTEM->VBTBKRn[count] = 0;
}
/* Write some test data */
R_SYSTEM->VBTBKRn[count] = (uint8_t)count;
/* Enable Write Protection */
R_BSP_RegisterProtectEnable(BSP_REG_PROTECT_OM_LPC_BATT);
while(1);