我在调试N32G457对独立看门狗有些疑问.对代码里面有这段不是很理解,或者我的理解是否存在问题.
/* IWDG timeout equal to 250 ms (the timeout may varies due to LSI frequency
dispersion) */
/* Enable write access to IWDG_PR and IWDG_RLR registers */
IWDG_WriteConfig(IWDG_WRITE_ENABLE);
/* IWDG counter clock: LSI/32 */
IWDG_SetPrescalerDiv(IWDG_PRESCALER_DIV8);
/* Set counter reload value to obtain 250ms IWDG TimeOut.
Counter Reload Value = 250ms/IWDG counter clock period
= 250ms / (LSI/32)
= 0.25s / (LsiFreq/32)
= LsiFreq/(32 * 4)
= LsiFreq/128
IWDG的counter clock是否就是固定的LSI/32. 跟独立看门的预分频8没关系,预分频8只是如下图根据看门狗的溢出时间这块来进行分频配置,设置溢出时间在0.2ms~819.2ms才设置预分频8分频
|