19.3.2.4.1 Fault Injection
The Control B (CTRLB) register controls fault injection into VMON. The VMON Diagnostic Mode (DMODE) bitfield controls the type of fault injected (correct voltage, undervoltage or overvoltage). Writing DMODE to UNDER or OVER brings VMON into diagnostic mode, triggering a fault injection. Writing DMODE to NO brings VMON out of diagnostic mode. A successful error injection will set the VOV or VUV flags in the INTFLAGS register but will not trigger a Machine Check Reset. When the VMON has entered diagnostic mode, the VMON Has Entered Diagnostic Mode (VDENTER) flag in the INTFLAGS register is set. This flag can also be used to detect if VMON has entered the diagnostic mode in error.
When VMON enters diagnostic mode, an internal diagnostic timer in VMON starts. If the VMON has not transitioned to normal mode before the timer reaches its timeout value (TDIAGNOSTIC in the figure below), VMON is automatically transitioned to normal mode. To manually end diagnostic mode, write DMODE to NO. The application is expected to manually end diagnostic mode once the diagnostic has been completed with the expected result, enabling maximum system protection as soon as possible. The automatic transition to normal mode upon timeout is intended as a safety mechanism in case a fault in the system somehow prevents manual exit from diagnostic mode.
During the diagnostic cycle, the VUV and VOV flags in the INTFLAGS register are updated as appropriate. The flags can be polled or interrupts enabled for VUV and VOV to detect that the diagnostic is successful. A failed diagnostic, meaning VUV and/or VOV not being set as expected, can be detected by the diagnostic timer reaching its timeout value and the VMON Has Exited Diagnostic Mode (VDEXIT) flag in the INTFLAGS register being set. The VDEXIT flag is also set if VMON transitions to normal mode by writing the DMODE bit field of the CTRLB register to NO.