4.1.2.1 DIAG_CPU_RegisterResetStateCheck

Software Requirement Reference ID : SW_CPU_REGISTER_RESET_STATE_CHECK_01.

This diagnostic API performs an initialization-time check of the default value

(expected Reset state) of all CPU control and status registers.

It helps detect incorrect reset or default states of individual bits or registers. If the Reset state of any register is found incorrect, the function re-initializes the register with its correct default value. The return value is a simple PASS/FAIL result.

CPU registers considered for RESET state check are:
  • STATUS
  • WREG
  • FSR0H
  • FSR0L
  • FSR1H
  • FSR1L
  • FSR2L
  • FSR2H
  • PRODL*
  • PRODH*
  • PCLATH
  • PCLATU
  • BSR
  • TABLAT
  • TBLPTRU
  • TBLPTRH
  • TBLPTRL These registers are supported for PIC18(L)FxxK42 device family only. Some user-requirements and limitations of this diagnostic API are listed below: (a) This diagnostic must be executed prior to any other diagnostic on startup, in order to avoid incorrect operation of other diagnostics or application initialization code due to unexpected initial register values. (b) No interrupts must be enabled before executing this diagnostic function. (c) Some registers PCL, STKPTR, TOSU, TOSH and TOSL are not tested in this diagnostic mechanism, because the C run-time startup environment would initialize and modify these registers (thereby making their states unpredictable). Please note, the registers PRODH & PRODL are not supported for other devices, except K42 family because of this reason as well.

Error reporting:

DIAG_CPU_RegisterResetStateCheck_GetStatus should be called from main to know the status of CPU register reset state check diagnosis.

void DIAG_CPU_RegisterResetStateCheck(
    void
)

Returns