Watchdog reset both system firmware and application


#1

IWDG is enabled by system firmware. It is also kicked in the system tick function. I have done some tests on P1 with system firmware V0.5.0, and it seems to me that the Kick works in system tick function only if the loop time is very short, for example do nothing. and if the execution time of loop is a little bit long, then IWDG reset.

My question is:

  1. Why the kick in system tick does not work if the execution time in loop is long?
  2. If kick is in system tick, so the IWDG is used to protect the system tick?
  3. Can IWDQ be disabled?

thanks,

JS


#2

@JS2017, from what I see in the firmware, the IWDG is only used by the bootloader as a fail-safe for a bad firmware flash. The system firmware doesn’t use the IWDG.

Perhaps @rickkas7 can provide an insight.


#3

I also believe the IWDG is used as peakay123 described. There is a plan to expand the use in a future system firmware version to help reduce the need to include an external hardware watchdog, but I don’t know the specifics of how that will be implemented.


#4

@peekay123
@rickkas7

Hello Peekay and Rick,

Thank you for your help. Probably the IWDG enabled is written in the system flag on the device. I will do more test let you know what I can get. Is there a way to erase the flag?

thanks,

JS


#5

@JS2017, I’m not sure what you are trying to do. The IWDG is ONLY used by the bootloader to ensure recovery in case of a failed or bad firmware flash. What exactly are you trying to do or asking for?


#6

@peekay123

In the previous application the IWDG is enabled and there is a reset when the WiFi offline and online evens occur.

thanks,

JS


#7

Can you be more specific? Are you referring to your application?


#8

@peekay123

Yes, I mean my application uses the IWDG before. right now I test that I can remove the IWDG in my application. It is not in the system flag.

thanks,

JS


#9

@JS2017, from the STM32F2xx Reference Manual:

Independent watchdog (IWDG): the IWDG is started by writing to its Key register or by hardware option. Once started it cannot be stopped except by a Reset. See Section 17.3 in Section 17: Independent watchdog (IWDG).

So, again, if all this IWDG stuff is in YOUR application and you modified the system firmware (systick), then I’m not sure what your question is. What I can tell you is that if you don’t start the IWDG, it won’t run. Once you start it, the only way to stop it is with a reset, assuming you don’t start again in your application.


#10

@peekay123

Yes, I think I can remove the IWDG from my application. Does the IWDG have any effect on the OTA firmware update? I mean IWDG enabled in my application helps to reset when my application firmware update fails. or this is taken cared of by the system firmware.

thanks,

JS


#11

@JS2017, I think this was answered here:


#12

@peekay123
@rickkas7

I think the OTA firmware update process will use the bootloader. I just saw that my P1 was stuck during the update. Probably I did not wait some time after the device is online.

thanks,

JS


#13

@JS2017, if IWDG is running in your application then it could interrupt OTA depending on how often you bump the IDWG. You may want to put the P1 into safe mode, bypassing your application so that the OTA can work without interference from the IWDG.


#14

@peekay123

sorry I did not make it clear. After I remove the IWDG I saw the device is stuck during the update. However, I will need more test to find out.

thanks,

JS


#15

@JS2017, what does “stuck” mean? Also, try with safe mode. If that works, then it is something in your code.


#16

@peekay123

I saw the led does not change. After I push the reset button then I can flash the firmware.

thank you for your help,

JS


#17

@peekay123
@rickkas7

Hello Peekay and Rick,

My application runs on P1 with sytem firmware V0.5.0. I removed the IDWG and even enabled the application watchdog and debug output. The P1 is frozen. My serial output and the Particle console output are as follows. At the same time:

1 My P1 LED does not change, solid cyan
2.the last message on the Particle Console shows that the device is offline
3. Serial output is frozen, my application loop ended perfectly, the system firmware did sock_send, but there is no read_packet_and_dispose calling like in the normal situation.

Does Particle system firmware V0.5.0 need IWDG?

Serial:

Time: 13:07:43

Millis: 5190000 Data: 85

APP Exit
0005190985:DEBUG: sock_result_t socket_send(sock_handle_t, const void*, socklen_t) (1002):Write 18 bytes to socket 536907528 result=0
Time: 13:07:44

Millis: 5191000 Data: 85

APP Exit
0005191088:DEBUG: int read_packet_and_dispose(tcp_packet_t&, void*, int, wiced_tcp_socket_t*, int) (792):Socket 0 receive bytes 2 of 18
0005191088:DEBUG: int read_packet_and_dispose(tcp_packet_t&, void*, int, wiced_tcp_socket_t*, int) (792):Socket 0 receive bytes 16 of 16
Time: 13:07:45

Millis: 5192000 Data: 85

APP Exit
Time: 13:07:46

Millis: 5193000 Data: 85

APP Exit
Time: 13:07:47

Millis: 5194000 Data: 85

APP Exit
Time: 13:07:48

Millis: 5195000 Data: 85

APP Exit
Time: 13:07:49

Millis: 5196000 Data: 85

APP Exit
Time: 13:07:50

Millis: 5197000 Data: 85

APP Exit
Time: 13:07:51

Millis: 5198000 Data: 85

APP Exit
Time: 13:07:52

Millis: 5199000 Data: 85

APP Exit
Time: 13:07:53

Millis: 5200000 Data: 85

APP Exit
Time: 13:07:54

Millis: 5201000 Data: 85

APP Exit
Time: 13:07:55

Millis: 5202000 Data: 85

APP Exit
Time: 13:07:56

Millis: 5203000 Data: 85

APP Exit
Time: 13:07:57

Millis: 5204000 Data: 85

APP Exit
Time: 13:07:58

Millis: 5205000 Data: 85

APP Exit
Time: 13:07:59

Millis: 5206000 Data: 85

APP Exit
0005206138:DEBUG: sock_result_t socket_send(sock_handle_t, const void*, socklen_t) (1002):Write 18 bytes to socket 536907528 result=0
Time: 13:08:00

Millis: 5207000 Data: 85

APP Exit
Time: 13:08:01

Millis: 5208000 Data: 86

APP Exit
Time: 13:08:02

Millis: 5209000 Data: 86

APP Exit
Time: 13:08:03

Millis: 5210000 Data: 86

APP Exit

Particle Console:

device went offlineno dataOctober 6th at 1:23:55 pm
{“data”:“offline”,“ttl”:60,“published_at”:“2017-10-06T17:23:55.315Z”,“coreid”:“26003d001547343231323438”,“name”:“spark/status”}

Thanks,

JS


#18

@JS2017, it’s time to show your code :wink:


#19

@peekay123

I will talk to my leader first.

Good weekend,

thanks,


#20

we will keep using IWDG.

thank you for your help.