How could I know whether the reset is caused by the watchdog???

12 posts / 0 new
Last post
liyang
Offline
Last seen:6 months 2 weeks ago
Expert
Joined:2014-09-24 11:51
How could I know whether the reset is caused by the watchdog???

Hi, Dialog ,

Now , I need to know whether the reset is caused by the watchdog, could I ? what can I do???

Device:
MT_dialog
Offline
Last seen:3 months 3 days ago
Staff
Joined:2015-06-08 11:34
Hi liyang,

Hi liyang,

You can check if a platform reset issues by replacing the platform_reset_func in the jump_table.c file with a custom empty function and try to catch the call of the function with a break point in debbuging.

Thanks MT_dialog

liyang
Offline
Last seen:6 months 2 weeks ago
Expert
Joined:2014-09-24 11:51
Hi, Dialog ,

Hi, Dialog ,

May be my question is not clear . You see there are kinds of reset of the DA14580, I only care the SW reset by the watchdog . when the DA14580reset,then it runs again ,my application need to know whether the reset is caused by the watchdog or not .

Thanks liyang

MT_dialog
Offline
Last seen:3 months 3 days ago
Staff
Joined:2015-06-08 11:34
Hi liyang,

Hi liyang,

Sorry i can't. I just misunderstood your question.

如果the reset is caused by the watchdog timer it goes to the NMI_Handler. Can you debug your program and try to catch it there ?

Thanks MT_dialog

liyang
Offline
Last seen:6 months 2 weeks ago
Expert
Joined:2014-09-24 11:51
Hi, Dialog ,

Hi, Dialog ,

I know If the reset is caused by the watchdog timer it goes to the NMI_Handler. and it will reboot the MCU.
Only when the system startup ,my application will judge whether the reset is caused by the watchdog or not .
But when the MCU restart,I can not find anything to prove the Mcu is reboot by the watchdog.

Thanks liyang

MT_dialog
Offline
Last seen:3 months 3 days ago
Staff
Joined:2015-06-08 11:34
Hi liyang,

Hi liyang,

There is no specific way for knowing that the reset was issued by the watchdog timer. A way i can think of is maybe storing a value, in an external memory(if your system has one)or in a retained space, from the NMI handler and to read this particular memory to see if there was a reset.

Thanks MT_dialog

liyang
Offline
Last seen:6 months 2 weeks ago
Expert
Joined:2014-09-24 11:51
Hi, MT_dialog,

Hi, MT_dialog,

Thanks for your idea! I think you have solve my problem . Another question how to handle the retained space ? Is it available?

Thanks liyang

MT_dialog
Offline
Last seen:3 months 3 days ago
Staff
Joined:2015-06-08 11:34
Hi liyang,

Hi liyang,

You can find examples of how to store variables in the retained memory space in most of examples of the SDK and in the reference designs, the keyboard ref design for example.

In order to store a variable in the retained space you can use this for example int extended_timer_cnt __attribute__((section("retention_mem_area0"), zero_init));

The thing is that the retention rams when the system reboots are initialized to zero by the SystemInit() in the system_ARMCM0.c so i 'm not certain if this can help you even if you remove the part that where the initialization to zero happens. The external memory scenario is more certain.

Thanks MT_dialog

liyang
Offline
Last seen:6 months 2 weeks ago
Expert
Joined:2014-09-24 11:51
Hi, MT_dialog,

Hi, MT_dialog,

Thanks for your scenario! I think I will chose the external memory to handle it.

Thanks liyang

YuanhangWu
Offline
Last seen:5 years 1 day ago
Expert
Joined:2015-03-25 08:19
Hi, all,

Hi, all,

I set variable not like this int extended_timer_cnt __attribute__((section("retention_mem_area0"), zero_init));
I set variable is like this :int extended_timer_cnt;
is the extended_timer_cnt save in retention_mem_area0 or retention_mem_area1?

thanks

liyang
Offline
Last seen:6 months 2 weeks ago
Expert
Joined:2014-09-24 11:51
哥们,你到底想问什么问题? 那个变量放哪有什么关系吗

哥们,你到底想问什么问题? 那个变量放哪有什么关系吗?你不这样定义int extended_timer_cnt __attribute__((section("retention_mem_area0"), zero_init)); ,是不会存在retention 区的。

MT_dialog
Offline
Last seen:3 months 3 days ago
Staff
Joined:2015-06-08 11:34
Hi YuanhangWu,

Hi YuanhangWu,

如果you decalre a variable without the __attribute__ then your variable isn't located in a retention space.

Thanks MT