Index: firmware/App/Modes/ModeInitPOST.c =================================================================== diff -u -r0c296cef29037819be204c45a23d4d38a52b2718 -r2830e6300c40e331b274511fa9183937810cc190 --- firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 0c296cef29037819be204c45a23d4d38a52b2718) +++ firmware/App/Modes/ModeInitPOST.c (.../ModeInitPOST.c) (revision 2830e6300c40e331b274511fa9183937810cc190) @@ -15,6 +15,9 @@ * ***************************************************************************/ +#include "reg_crc.h" // Used to hold reset reason code at startup before bits get cleared +#include "reg_system.h" // Used to access exception status registers for reset reason code at startup + #include "Accel.h" #include "ConcentratePumps.h" #include "ConductivitySensors.h" @@ -344,8 +347,13 @@ // when the event data can be sent if ( ++startPOSTDelayCounter > START_POST_DELAY_COUNT ) { + U32 resetReason = systemREG1->SYSESR | crcREG->PSA_SIGREGL1; // power-on reset bit preserved in an unused CRC register + + systemREG1->SYSESR = systemREG1->SYSESR; // clear reset bit(s) after logging event so subsequent resets can be properly identified as not being power-on resets. + // Send the startup event - SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_STARTUP, 0, 0 ) + SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_STARTUP, systemREG1->DEV, 0x12345678 ) // log startup event w/ device ID bits + SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_STARTUP, resetReason, systemREG1->GBLSTAT ) // log startup event w/ reset reason(s) bits // Send the first submode change event. It is the mode Init and it does not start from a previous // mode previous and current are both published as Init SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_OP_MODE_CHANGE, DG_MODE_INIT, DG_MODE_INIT )