Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Error Handling

Definitions related to error handling for Class B tests.

In order to make the library as flexible as possible, the user can configure the response to the different errors that can appear during the tests. Therefore, the user is responsible to handle the errors in a way such that the application is safe and reliable.

Enumerations

enum  classb_error_value {
  CLASSB_ERROR_NONE = 0x00,
  CLASSB_ERROR_WDT = 0x01,
  CLASSB_ERROR_ANALOG = 0x02,
  CLASSB_ERROR_CRC = 0x04,
  CLASSB_ERROR_FREQ = 0x08,
  CLASSB_ERROR_INT = 0x10,
  CLASSB_ERROR_CPU = 0x20,
  CLASSB_ERROR_SRAM = 0x40,
  CLASSB_ERROR_OTHER = 0x80
}
 Class B error values for the global error variable. More...
 

Global variables defined in the main application.

NO_INIT enum classb_error_value classb_error
 Global error indicator, defined in main.c. More...
 

Error handlers for Class B tests.

These are the statements that should be run if a test fails.

Note
The statements need to be declared as:
  • do{<statements>}while(0) or similar.
  • Example: in order to hang the device it is possible to set do{}while(1).
#define CLASSB_ERROR_HANDLER_ANALOG()
 Error handler for the ADC, DAC and analog multiplexer test. More...
 
#define CLASSB_ERROR_HANDLER_CRC()
 Error handler for the CRC test. More...
 
#define CLASSB_ERROR_HANDLER_FREQ()
 Error handler for the CPU frequency test. More...
 
#define CLASSB_ERROR_HANDLER_INTERRUPT()
 Error handler for the interrupt monitor. More...
 
#define CLASSB_ERROR_HANDLER_REGISTERS()
 Error handler for the CPU registers test. More...
 
#define CLASSB_ERROR_HANDLER_SRAM()
 Error handler for the SRAM test. More...
 
#define CLASSB_ERROR_HANDLER_WDT()
 Error handler for watchdog timer test. More...
 

Configurable actions and conditions for Class B tests.

Some tests have a configurable behavior.

Note
  • The conditions should be declared as: (<condition>).
  • Statements need to be declared as: do{<statements>}while(0) or similar.
  • Example: in order to hang the device it is possible to set: do{}while(1).
#define CLASSB_CONDITION1_INTERRUPT   (!classb_error)
 Condition to assign a new state. More...
 
#define CLASSB_CONDITION2_INTERRUPT   (classb_error)
 Condition to stop checking interrupts within the monitor. More...
 
#define CLASSB_ACTIONS_RTC()   ;
 Configurable actions in the RTC interrupt. More...
 
#define CLASSB_ACTIONS_WDT_RUNTIME_FAILURE()
 First group of configurable actions in the watchdog timer test. More...
 
#define CLASSB_ACTIONS_WDT_OTHER_FAILURE()   do{ } while (0)
 Second group of configurable actions in the watchdog timer test. More...
 

#define CLASSB_ACTIONS_RTC ( )    ;

Configurable actions in the RTC interrupt.

Referenced by classb_rtc_callback().

#define CLASSB_ACTIONS_WDT_OTHER_FAILURE ( )    do{ } while (0)

Second group of configurable actions in the watchdog timer test.

Referenced by classb_wdt_test().

#define CLASSB_ACTIONS_WDT_RUNTIME_FAILURE ( )
Value:
do { \
/* In our example application we set the error variable and \
* re-enable watchdog timer. \
*/ \
/* WDT configuration for the main application: WDT in normal mode*/ \
CCP = CCP_IOREG_gc; \
WDT.CTRL = WDT_ENABLE_bm | CLASSB_WDT_PER | WDT_CEN_bm; \
/* Wait until WDT Synchronized */ \
while (WDT.STATUS & WDT_SYNCBUSY_bm) { \
} \
/* Set Closed period (when WDT cannot be reset) */ \
CCP = CCP_IOREG_gc; \
WDT.WINCTRL = WDT_WEN_bm | CLASSB_WDT_WPER | WDT_WCEN_bm; \
/* Wait until WDT Synchronized */ \
while (WDT.STATUS & WDT_SYNCBUSY_bm) { \
} \
} while (0)
#define CLASSB_WDT_WPER
Closed period, during which WDT cannot be reset.
Definition: classb_wdt_test.h:108
#define CLASSB_WDT_PER
Open period, during which WDT has to be reset.
Definition: classb_wdt_test.h:99
NO_INIT enum classb_error_value classb_error
Global error indicator, defined in main.c.
Definition: xmega/applications/xmega_a3bu_xplained_classb_oven/main.c:190
Watchdog timer error (runtime)
Definition: error_handler.h:91

First group of configurable actions in the watchdog timer test.

Referenced by classb_wdt_test().

#define CLASSB_CONDITION1_INTERRUPT   (!classb_error)

Condition to assign a new state.

Referenced by classb_intmon_set_state().

#define CLASSB_CONDITION2_INTERRUPT   (classb_error)

Condition to stop checking interrupts within the monitor.

Referenced by classb_intmon_callback().

#define CLASSB_ERROR_HANDLER_ANALOG ( )
Value:
do { \
} while (0)
NO_INIT enum classb_error_value classb_error
Global error indicator, defined in main.c.
Definition: xmega/applications/xmega_a3bu_xplained_classb_oven/main.c:190
Analog IO error.
Definition: error_handler.h:93

Error handler for the ADC, DAC and analog multiplexer test.

Referenced by classb_dac_adc_test().

#define CLASSB_ERROR_HANDLER_CRC ( )
Value:
do { \
} while (0)
NO_INIT enum classb_error_value classb_error
Global error indicator, defined in main.c.
Definition: xmega/applications/xmega_a3bu_xplained_classb_oven/main.c:190
CRC error.
Definition: error_handler.h:95

Error handler for the CRC test.

Referenced by CLASSB_CRC16_EEPROM_HW(), CLASSB_CRC16_EEPROM_SW(), CLASSB_CRC16_Flash_HW(), CLASSB_CRC16_Flash_SW(), CLASSB_CRC32_EEPROM_HW(), CLASSB_CRC32_EEPROM_SW(), CLASSB_CRC32_Flash_HW(), and CLASSB_CRC32_Flash_SW().

#define CLASSB_ERROR_HANDLER_FREQ ( )
Value:
do { \
} while (0)
Clock frequency error.
Definition: error_handler.h:97
NO_INIT enum classb_error_value classb_error
Global error indicator, defined in main.c.
Definition: xmega/applications/xmega_a3bu_xplained_classb_oven/main.c:190

Error handler for the CPU frequency test.

Referenced by classb_freq_callback(), and classb_freq_tc_callback().

#define CLASSB_ERROR_HANDLER_INTERRUPT ( )
Value:
do { \
} while (0)
NO_INIT enum classb_error_value classb_error
Global error indicator, defined in main.c.
Definition: xmega/applications/xmega_a3bu_xplained_classb_oven/main.c:190
Interrupt monitor error.
Definition: error_handler.h:99

Error handler for the interrupt monitor.

Referenced by classb_intmon_callback(), and classb_intmon_set_state().

#define CLASSB_ERROR_HANDLER_REGISTERS ( )
Value:
do { \
} while (0)
NO_INIT enum classb_error_value classb_error
Global error indicator, defined in main.c.
Definition: xmega/applications/xmega_a3bu_xplained_classb_oven/main.c:190
CPU register error.
Definition: error_handler.h:101

Error handler for the CPU registers test.

Referenced by classb_register_test().

#define CLASSB_ERROR_HANDLER_SRAM ( )
Value:
do { \
} while (0)
NO_INIT enum classb_error_value classb_error
Global error indicator, defined in main.c.
Definition: xmega/applications/xmega_a3bu_xplained_classb_oven/main.c:190
SRAM error.
Definition: error_handler.h:103

Error handler for the SRAM test.

Referenced by classb_march_x().

#define CLASSB_ERROR_HANDLER_WDT ( )
Value:
do{ \
} while (1)

Error handler for watchdog timer test.

Referenced by classb_wdt_test().

Class B error values for the global error variable.

Enumerator
CLASSB_ERROR_NONE 

No error.

CLASSB_ERROR_WDT 

Watchdog timer error (runtime)

CLASSB_ERROR_ANALOG 

Analog IO error.

CLASSB_ERROR_CRC 

CRC error.

CLASSB_ERROR_FREQ 

Clock frequency error.

CLASSB_ERROR_INT 

Interrupt monitor error.

CLASSB_ERROR_CPU 

CPU register error.

CLASSB_ERROR_SRAM 

SRAM error.

CLASSB_ERROR_OTHER 

Other error, e.g., detected by application.

Note
In this application, this value is used to signal that the periodic temperature sanity test (in oven_controller.c) failed.

NO_INIT enum classb_error_value classb_error

Global error indicator, defined in main.c.

Global error indicator, defined in main.c.

Referenced by classb_wdt_test(), main(), oven_classb_display_error(), oven_classb_run_tests(), and ovenctl_periodic_temperature_sanity_check().