
If you are not familiar with the MCUXpresso IDE yet, see
docs/Getting Started with MCUXpresso SDK for <your_board>.pdf
("Build
an example application" section).
4.2 Example settings - safety_config.h
The main example settings header file is
safety_config.h
. The neccessary macros for the safety example are defined in this file.
The "switch macros", which enable the user to turn off the calling of the safety test, are defined in the beginning. When starting,
turn off the FLASH test and the WDOG test. On LPC devices, turn off also the Clock test.
/* This macro enables infinity while loop in the SafetyErrorHandling() function */
#define SAFETY_ERROR_ACTION 1
/* TEST SWITCHES - for debugging, it is better to turn the FLASH and WDOG tests OFF. */
#define ADC_TEST_ENABLED 1
#define CLOCK_TEST_ENABLED 1
#define DIO_TEST_ENABLED 1
#define FLASH_TEST_ENABLED 1
#define RAM_TEST_ENABLED 1
#define PC_TEST_ENABLED 1
#define WATCHDOG_ENABLED 1
#define FMSTR_SERIAL_ENABLE 1
Other defines are used to configure the safety test as a parameter to a function or to fill structures.
4.3 safety_test_items.c file
The
safety_test_items.c
and
.h
files are the configuration files for the DIO test.
The file contains the
fs_dio_test_<platform>_t
list of structures. The pointers to these structures are collected in the
dio_safety_test_items[]
array, which is used in the example application.
fs_dio_test_lpc_t dio_safety_test_item_0 = /* P0_13 */
{
.iocon_mode_shift = IOCON_PIO_MODE_SHIFT, /*Device depend */
.pPort_byte = (uint8_t *)&(GPIO->B[0][13]), /* Address of byte register in GPIO */
.pPort_dir = (uint32_t *)&(GPIO->DIR[0]), /* Address of dir1 register */
.pPort_Iocon = (uint32_t *)&(IOCON->PIO[IOCON_INDEX_PIO0_13]), /* Address of concrete IOCON
register */
.pinNum = 13, /* Position in DIR register */
.gpio_clkc_shift = SYSCON_SYSAHBCLKCTRL_GPIO_SHIFT
};
/* NULL terminated array of pointers to dio_test_lpc_t items for safety DIO test */
fs_dio_test_lpc_t *dio_safety_test_items[] = {&dio_safety_test_item_0, &dio_safety_test_item_1, NULL};
Example settings - safety_config.h
LPC CM0 Safety Example , Rev. 3, 07/2021
NXP Semiconductors
12