DelfiSpace / FlightSoftwareWorkspace

Code Composer Studio workspace to generate the full flight software for Delfi-PQ.
2 stars 2 forks source link

Add reset cause to telemetry #2

Closed StefanoSperetta closed 3 years ago

StefanoSperetta commented 4 years ago

MSP432 family datasheet: http://www.ti.com/lit/ug/slau356h/slau356h.pdf MSP432 device datasheet: http://www.ti.com/lit/ds/symlink/msp432p401r.pdf

Force a reset in software: call ResetCtl_initiateHardReset() from driverlib

Reset cause: RSTCTL_CSRESET_STAT.0 -> reset caused by POR RSTCTL_REBOOTRESET_STAT.0 -> reset was caused by the SYSCTL RSTCTL_PINRESET_STAT.0 -> RSTn/NMI pin caused reset RSTCTL_PCMRESET_STAT.0 -> Exit from LPM3.5 caused reset RSTCTL_PCMRESET_STAT.1 -> Exit from LPM4.5 caused reset RSTCTL_PSSRESET_STAT.1 -> SVSMH trip caused reset RSTCTL_PSSRESET_STAT.2 -> Band Gap Reference not okay caused reset RSTCTL_PSSRESET_STAT.3 -> VCCDET trip caused reset

(from device datasheet) RSTCTL_HARDRESET_STAT.0 -> Hard reset request RSTCTL_HARDRESET_STAT.1 -> WDT timeout RSTCTL_HARDRESET_STAT.2 -> WDT password violation

(from device datasheet) RSTCTL_SOFTRESET_STAT

CasperBroekhuizen commented 4 years ago

I collected all the reset codes in the documentation, and made the ResetService obtain the reset-codes on initialization:

image

image

image

The 16bits reset registers are: RSTCTL_HARDRESET_STAT RSTCTL_SOFTRESET_STAT RSTCTL_PSSRESET_STAT RSTCTL_PCMRESET_STAT RSTCTL_PINRESET_STAT RSTCTL_REBOOTRESET_STAT RSTCTL_CSRESET_STAT.

However, not all bit-flags are fully utilized, some of the registers even utilize only 1-bit. There are only 16 possible flags, which can be wrapped into one 3-byte ResetStatus:

0 : HARDRESET 0 : RESET_HARD_SYSTEMREQ : POR Caused by System Reset Output of Cortex-M4 1 : HARDRESET 1 : RESET_HARD_WDTTIME : POR Caused by SoftReset WDT Timer expiration 2 : HARDRESET 2 : RESET_HARD_WDTPW_SRC : POR Caused by HardReset WDT Wrong Password 3 : HARDRESET 3 : RESET_HARD_FCTL : POR Caused by FCTL detecting a voltage Anomaly 4 : HARDRESET 14: RESET_HARD_CS : POR Extended for Clock Settle 5 : HARDRESET 15: RESET_HARD_PCM : POR Extended for Power Settle 6 : SOFTRESET 0 : RESET_SOFT_CPULOCKUP : POR Caused by CPU Lock-up 7 : SOFTRESET 1 : RESET_SOFT_WDTTIME : POR Caused by SoftReset WDT Timer expiration 8 : SOFTRESET 2 : RESET_SOFT_WDTPW_SRC : POR Caused by SoftReset WDT Wrong Password 9 : PSSRESET 1 : RESET_PSS_VCCDET : POR Caused by VCC Detector trip condition
10: PSSRESET 2 : RESET_PSS_SVSH_TRIP : POR Caused by Supply Supervisor detected Vcc trip condition 11: PSSRESET 3 : RESET_PSS_BGREF_BAD : POR Caused by Bad Band Gap Reference 12: PCMRESET 0 : RESET_PCM_LPM35 : POR Caused by PCM due to exit from LPM3.5 13: PCMRESET 1 : RESET_PCM_LPM45 : POR Caused by PCM due to exit from LPM4.5 14: PINRESET 0 : RESET_PIN_NMI : POR Caused by NMI Pin based event 15: REBOOTRESET 0 : RESET_REBOOT : POR Caused by SysCTL Reboot 16: CSRESET 0 : RESET_CSRESET_DCOSHORT : POR Caused by DCO short circuit fault in external resistor

image

In commit https://github.com/DelfiSpace/DelfiPQcore/commit/a501e6818a2a16ec122ea19505373cdbab0926ca

CasperBroekhuizen commented 4 years ago

ResetStatus can be obtained from the resetService externally (to be used for AcquireTelemetry()) (https://github.com/DelfiSpace/DelfiPQcore/commit/a4e9e0d64d54977aa5a017cfe8375fdb776ef3cb)

MFvandenBos commented 4 years ago

mention @MFvandenBos