sparkfun / AmbiqSuiteSDK

A copy of the AmbiqSuite SDK available on GitHub. Can be used to include AmbiqSuite as a submodule. May be used to track issues in SDK releases, however this repo is not maintained by AmbiqMicro
39 stars 31 forks source link

Watchdog timer 8 vs 16 bit #7

Open Colin-at-511100471793 opened 4 years ago

Colin-at-511100471793 commented 4 years ago

misleading documentation issue with am_hal_wdt

looking at the current version of this which I believe uses sdk 2.2

if you look in am_hal_wdt.h then you can see that ui16ResetCount is a 16 bit counter. where the datasheet for the apollo3 it clearly states that it's an 8 bit counter.

if I set up the wdt for 7200(2 hr) seconds with the 1hz counter, I would expect it not to reset if i feed it every hour. What actually happens is that it resets every 32 seconds. that's because 7200 mod 256 is 32.. so the msb's are thrown away..

so if you use this, I think the longest wdt you can make is 16*255=4080 seconds- a bit over an hour.

oclyke commented 4 years ago

Thanks @Colin-at-511100471793! Great to have this documentation.