[riot-notifications] [RIOT-OS/RIOT] cpu/stm32_common: add watchdog for stm32 (#11252)

Alexandre Abadie notifications at github.com
Fri Sep 13 08:31:15 CEST 2019


aabadie commented on this pull request.



> +from testrunner import run
+
+# We test only up to 10ms, with smaller times mcu doesn't have time to
+# print system time before resetting
+reset_times_ms = [1e2, 5e2, 1e3, 5e3]
+
+# We don't check for accuracy, only order of magnitude. Some MCU use an
+# an internal un-calibrated clock as reference which can deviate in
+# more than 50% from theoretical values (e.g STM32 board CLOCK_LSI)
+error_margin = 0.5
+
+
+def get_reset_time(child):
+    reset_time = 0
+    try:
+        while True:

I had the case where this ended up in an endless loop (because the boards was resetting too fast ?), preventing the python script to exits. This seems more robust:
```suggestion
        now = time.time()
        timeout = 10  # seconds
        while time.time() < now + timeout:
            child.expect(u"reset time: (\d+) us", timeout=1)
            reset_time = int(child.match.group(1))
        else:
            # timeout
            return reset_time
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11252#pullrequestreview-287831908
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190912/baa8a32d/attachment.htm>


More information about the notifications mailing list