亲爱的Dialog_Support,
I have stored one variable's value into flash and i want to retrieve that value after reset occurs by watchdog timer. But i am not able to recognize that reset occurs due to watchdog or any other reason. I have read this post
https://support.dialog-semiconductor.com/how-could-i-know-whether-reset-...
I came to know that if we declare variable in retention RAM then we can retrieve it after watchdog. And another solution is use external memory. As my application don't have any external memory, i have to declare variable into retention RAM. I have tried to do so but I could not retrieve its value after watchdog reset. So can you suggest me any example that storing value into retention RAM and retrieving back after device gets reset.
先感谢您
With Regards,
Ruchi Patel
Hi Ruchi Patel,
您能够将数据存储到保留RAM中,作为您已发布的过去线程中所描述的。请注意,在设备重置后,存储数据将丢失。请检查SystemInit()函数,并找到setBits16(PMU_CTRL_REG,RETENT_MODE,0xF);因此,由于您已经看到了归零器,因此已经看到了归零器的归零器,因此在沉睡的沉睡中升起时应该完成的东西,所以归零ram的归零器是应该完成的。除了用户数据,额外的BLE信息(BLE堆,堆栈等)。
After reset the zeroing out function will run again and will wipe out any data that you have in the retention memory area. In order to avoid that what you can do is to know where your “data” reside in the retention memory area and during the initialization you should avoid zeroing them out. There is no reference design or example that demonstrates that, what I would do is the following:
In the scatterfile where the retention memory area is defined for deep sleep allocate a space that will hold your data that should be not initialized.
§LR_Retention_ram00x00080768(Retram_len + Exchange_memory_size + sz_aft_rst_data){
§ret_reset01 0x00080768 uninit sz_aft_rst_data {.any(Unitialized_data_test)} < - 标记新区域。
So now you are aware that the data that will be tagged with the unitialized_data_test will reside from the address 0x00080768 up to the address 0x00080768 + SZ_AFT_RST_DATA. Since you are aware of that you can go to the SystemInit() function and instruct the function not to zero out the memory between the 0x00080768 and 0x00080768+SZ_AFT_RST_DATA.
// Fill 0x80000 - 0x83000 with zeros
unsigned int *p_retmem = (unsigned int *)0x80000;
for (i = 0xBFF; i >= 0; i--)
{
if((p_retmem > (unsigned int *)0x80768) && (p_retmem < (unsigned int *)(0x80768 + 80)) )
*(valatile unsigned *)p_retmem ++;
Else
*(volatile unsigned *)p_retmem++ = 0;
}
Thanks, PM_Dialog
我需要这个功能,以便在手表狗咬伤时进行静默复位。
I am using SDK5 and that is not exactly compatible with this explanation.
你能把这个指南重新申请SDK5吗?
I have investigated a bit further
If I use uint8_t silent_reset __attribute__((section("retention_mem_area_uninit") )); (omitting the zero_init attribute) my variable “silent_reset” ends up at the start of “Execution Region RET_DATA” and is of type Data not Zero - like so:
0x07fd4804 0x07fd4804 0x00000001 Data RW
虽然看狗并没有生存一口。
If I use __attribute__((section("retention_mem_area_uninit") )); one should think it ended up in Execution Region RET_DATA_UNINIT but it ends up at the end of LR_IROM3 – WHY??
Hi jarirenejensen,
The sectors of the Keil are 32 bytes aligned, so the maximum uninitialized retained data that required by the application (CFG_RET_DATA_UNINIT_SIZE definition in da1458x_stack_config.h header file) must be multiple of 4 (4 x 8=32bytes) and greater or equal to the sum of the total data. If the CFG_RET_DATA_UNINIT_SIZE is not multiple of 4, the Keil will truncate it into the smallest multiple of 4, otherwise if the data cannot be fit then the hole section will be deleted. Please make sure that the CFG_RET_DATA_UNINIT_SIZE is multiple of the 4.
Thanks, PM_Dialog
Thanks - That was the bit I missed.