How to know whether reset is due to watchdog timer?

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
6 posts / 0 new
Last post
Ruchi Patel
Offline
Last seen:2年6个月前
加入:2017-03-29 10:50
How to know whether reset is due to watchdog timer?

亲爱的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

设备:
PM_Dialog
Offline
Last seen:5 days 1 hour ago
Staff
加入:2018-02-08 11:03
Hi 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.

  • 将从新的部分中使用的部分回序,从而从#define retram_len中删除您将使用的字节量并添加新部分的大小(新的Retram_len = Retram_len - sz_aft_rst_data):

§LR_Retention_ram00x00080768(Retram_len + Exchange_memory_size + sz_aft_rst_data){

  • Declare an execution area in the LR_RETENTION_RAM0 that is starting from 0x00080768. The new execution area will start from area 0x00080768 and will have the range of your requirement (lets say for example that the range you would like would be SZ_AFT_RST_DATA 80 bytes). So the scatterfile would change to:

§ret_reset01 0x00080768 uninit sz_aft_rst_data {.any(Unitialized_data_test)} < - 标记新区域。

  • 在这样做之后,zi_ret00将从地址0x00080768 + sz_aft_rst_data开始,而不是0x00080768。

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

jarirenejensen
Offline
Last seen:2个月前1年
加入:2017-02-05 14:44
我也需要这个功能,在

我需要这个功能,以便在手表狗咬伤时进行静默复位。

I am using SDK5 and that is not exactly compatible with this explanation.
你能把这个指南重新申请SDK5吗?

jarirenejensen
Offline
Last seen:2个月前1年
加入:2017-02-05 14:44
I have investigated a bit

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??

PM_Dialog
Offline
Last seen:5 days 1 hour ago
Staff
加入:2018-02-08 11:03
Hi jarirenejensen,

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

jarirenejensen
Offline
Last seen:2个月前1年
加入:2017-02-05 14:44
Thanks - That was the bit I

Thanks - That was the bit I missed.