The SysFault driver provides an API to configure the Fault reporting structure.
The functions and other declarations used in this driver are in cy_sysfault.h. You can include cy_pdl.h to get access to all functions and declarations in the PDL.
The Fault subsystem contains information about faults that occur in the system. The fault subsystem captures only faults and it does not take any action to correct it. The subsystem can cause a reset, give a pulse indication, or trigger another peripheral. This is a centralized fault report structure. The centralized nature allows for a system-wide consistent handling of faults, which simplifies software development as follows only a single fault interrupt handler is required. The fault report structure provides the fault source and additional fault-specific information from a single set of memory mapped input/output (MMIO) registers, no iterative search is required for the fault source and fault information. All pending faults are available from a single set of MMIO registers. Below is the block diagram.
Fault IP provides fault report structure. Fault report structures capture faults. The number of fault report structures is specified by a design time configuration parameter (FAULT_NR). There are two instances of fault structures, each fault report structure has a dedicated set of MMIO control and status registers and captures a single fault. A fault report structure provides the fault source and additional fault specific information from a single set of MMIO registers. The fault structures capture faults like MPU/SMPU/PPI protection violations, peripheral specific errors, memory controller specific errors. E.g., SRAM controller ECC errors, FLASH controller read while program and ECC errors, Processor tightly coupled memory (TCM) ECC errors.
System fault will be captured by fault report structures. A fault report structure provides the fault source and additional fault specific information from a single set of MMIO registers. The captured fault information includes:
- A validity bit field that indicates a fault is captured.
- A fault index that identifies the fault source.
- Additional fault information describing fault specifics.
Configuration Considerations
Fault configuration includes clearing the existing fault status, enabling fault source, setting interrupt mask, and fault initialization. Below is the code snippet for the fault configuration.
{
.OutputEnable = true,
.TriggerEnable = false,
};
{
.intrPriority = 2UL
};
NVIC_SetPriority((IRQn_Type) NvicMux3_IRQn, 2UL);
NVIC_EnableIRQ((IRQn_Type) NvicMux3_IRQn);
bool ResetEnable
Enables the Reset request when it is True.
Definition: cy_sysfault.h:268
Configuration structure for a Fault control register.
Definition: cy_sysfault.h:265
cy_en_SysFault_status_t
SysFault driver error codes.
Definition: cy_sysfault.h:159
void Cy_SysFault_ClearStatus(FAULT_STRUCT_Type *base)
Clears status register.
Definition: cy_sysfault.c:47
void Cy_SysFault_SetInterruptMask(FAULT_STRUCT_Type *base)
Sets an interrupt mask.
Definition: cy_sysfault.c:196
cy_en_SysFault_status_t Cy_SysFault_Init(FAULT_STRUCT_Type *base, cy_stc_SysFault_t *config)
Initializes the SysFault for recording faults.
Definition: cy_sysfault.c:31
void Cy_SysFault_SetInterrupt(FAULT_STRUCT_Type *base)
Triggers an interrupt via a software write.
Definition: cy_sysfault.c:190
void Cy_SysFault_SetMaskByIdx(FAULT_STRUCT_Type *base, cy_en_SysFault_source_t idx)
Enable the Fault to be captured.
Definition: cy_sysfault.c:112
IRQn_Type intrSrc
Interrupt source.
Definition: cy_sysint.h:227
Initialization configuration structure for a single interrupt channel.
Definition: cy_sysint.h:225
cy_en_sysint_status_t Cy_SysInt_Init(const cy_stc_sysint_t *config, cy_israddress userIsr)
Initializes the referenced interrupt by setting the priority and the interrupt vector.
Definition: cy_sysint_v2.c:80
#define CY_SYSINT_INTRSRC_MUXIRQ_SHIFT
Bit 0-11 indicate system interrupt and bit 12-15 will indicate the CPU IRQ.
Definition: cy_sysint.h:177
Once the configured fault occurs, the interrupt handler will be triggered where the fault information can be captured. Below is the code snippet that can be part of a interrupt handler.
if(status != CY_SYSFAULT_NO_FAULT)
{
if(status == CY_SYSFAULT_SRSS_MCWDT0)
{
}
}
@ CY_SYSFAULT_DATA0
Used to get the Fault data for DATA0 register.
Definition: cy_sysfault.h:179
uint32_t Cy_SysFault_GetFaultData(FAULT_STRUCT_Type *base, cy_en_SysFault_Data_t dataSet)
Returns the Fault information for the provided dataSet.
Definition: cy_sysfault.c:69
uint32_t Cy_SysFault_GetInterruptStatusMasked(FAULT_STRUCT_Type *base)
Returns whether masked interrupt triggered the interrupt.
Definition: cy_sysfault.c:212
void Cy_SysFault_ClearInterrupt(FAULT_STRUCT_Type *base)
Clears Active Interrupt Source.
Definition: cy_sysfault.c:184
cy_en_SysFault_source_t Cy_SysFault_GetErrorSource(FAULT_STRUCT_Type *base)
Returns the source of error for the Fault.
Definition: cy_sysfault.c:53
uint32_t Cy_SysFault_GetInterruptMask(FAULT_STRUCT_Type *base)
Returns the interrupt mask.
Definition: cy_sysfault.c:206
uint32_t Cy_SysFault_GetInterruptStatus(FAULT_STRUCT_Type *base)
Returns the status of the interrupt.
Definition: cy_sysfault.c:178
void Cy_SysFault_ClearInterruptMask(FAULT_STRUCT_Type *base)
Clears an interrupt mask.
Definition: cy_sysfault.c:201
More Information
For more information on the System Fault, refer to the technical reference manual (TRM).