You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the system is crashing, the I2C lines (SDA/SCL) are not being
reset and might stay LOW. To address this issue, we need to ensure that
none of the user i2c driver callbacks (that are doing reads or writes)
are taking longer than CONFIG_I2C_MSPM0G3XXX_WATCHDOG_TIMEOUT. So we
fire a timer before each call. If the callback doesn't finish fast
enough, the watchdog callback will reset the i2c lines, NACK the i2c
message and panic with the CONFIG_MSPM0G3XXX_I2C_WATCHDOG_PANIC_CODE
error code.
The timeout is configured with CONFIG_I2C_MSPM0G3XXX_WATCHDOG_TIMEOUT
The panic error code is configured with
CONFIG_MSPM0G3XXX_I2C_WATCHDOG_PANIC_CODE.
To make sure of this reboot feature, the device tree needs to provide
a reference to a hardware timer. Let's say we want to use timer timg7
as a watchdog:
We need to configure that timer in the dts:
```
&timg7 {
status = "okay";
mode = <ONE_SHOT_DOWN>;
prescaler = <0>;
divide-ratio = <RATE_1>;
};
```
and then reference in the i2c block:
```
&i2c0 {
watchdog-timer = <&timg7>;
extras ...
```
Since we are invoking a software panic on the mcu, make sure to disable
the COREDUMP since the default backend is the "logging" one and it takes
too much of the cpu resources, thus delaying the mcu reboot.
This can be done with:
```
CONFIG_DEBUG_COREDUMP=n
```
Of course for now, the implementation is using a counter timer since
we don't have a mspm0 watchdog.
Signed-off-by: Dimitris Karnikis <dika@bang-olufsen.dk>
0 commit comments