NXP Semiconductors Chapter 1 IEC60730B Safety library example user's guide For easier development of the IEC60730B application, the library also provides the example code. This example is distributed through the MCUXpresso SDK website. This example user's guide describes how to set the hardware correctly and how to use the example code with the IEC60730B Safety library.
NXP Semiconductors Chapter 2 Hardware settings This chapter describes how to set up the hardware of the evaulation board. The MCU peripherals' setup is described later on. The IEC60730B library example for the LPC CM0 family supports the following development boards: •...
Page 5
The ADC module on LPCXpresso845MAX does not allow to connect the VrefH, VrefL, and Bandgap internally to the ADC input. Connect these signals (for the Analog I/O test) as follows: • VrefH - 3.3 V on PIO0_23 (conn. J6-2). • VrefL - GND on PIO0_14 (conn. J6-1). LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 6
The ADC module on the LPCXpresso51U68 does not allow the VrefH, VrefL, and Bandgap to connect internally to the ADC input. Connect these signals (for the Analog I/O test) as follows: • VrefH - connect VCC to PIO_0_30 (J8-2). LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 7
( #define ADC_BANDGAP_LEVEL 2.5 Figure 3. Hardware connection of LPCXpresso51U68 The test voltage of 2.5 V is provided by a resistor voltage divider from the VCC (5 V). LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
NXP Semiconductors Chapter 3 File structure Safety is only a small part of the whole SDK package for your device. The IEC60730 library and examples are located in the middleware and in the board folders. The IEC60730 library is independent of the SDK and can be used stand-alone.
Page 9
The following files are generated by the MCUXpresso configuration tool: clock_config.h • clock_config.c • pin_mux.c • pin_mux.h • Other files are used only for safety examples and their contents are described in the next chapter. LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
NXP Semiconductors Chapter 4 Example application The structure of the example is common in all supported IDEs (IAR, Keil, MCUXpresso). Figure 6. IAR example application structure The project contains the CMSIS, SDK, library, and safety example-related folders. The safety-related folders are the following: •...
Page 11
Open the project file located at MCUXpresso IDE <name_of_the_package>.zip package into the MCUXpresso IDE (into the "Installed SDKs" tab). Firstly, drag and drop the Secondly, import the SDK example (safety_iec60730b). LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 12
.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}; LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 13
4.4 Source file - safety_cm0_lpc.c/.h safety_cm0_lpc.c source file and the corresponding *.h file contain a library handling function. Each function contains a SafetyErrorHandling() function is called. detection. If a safety error ocurrs, the LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
NXP Semiconductors Chapter 5 Running example For the first run of the example on your hardware, it is recomended to turn off Flash, WDOG, Clock, AIO, and DIO test. In the next step, turn on step by step. When the WDOG is turned off and a safety error happens, the example stays in an endless loop.
Page 15
FreeMASTER monitoring Figure 9. Setting UART speed Now you can connect to the development board by pressing "CTRL+G" or clicking the "GO" button: LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 16
SDK package, in the <sdk_package>/middleware/safety_iec60730b/tools/crc folder. The complete post-build command, which is used in the safety example to calculate CRC32 in the uVision Keil IDE is as follows: LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 17
*.hex file. This can be assured by a linker script. The linker script depends on the IDE This table must be placed at the end of the used. The exact description for the supported IDE is in the following chapter. LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 18
*.hex file. For this purpose, it is good to define your own section in the linker. In the uVision Keil IDE, it can be the following: LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 19
It is necessary to set the post-build string, so go to the "Options → C/C++ Build → Settings → Build steps → Post-build steps" menu. Copy and paste the following post-build string into it: arm-none-eabi-objcopy -v -O ihex "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.hex" ${ProjDirPath}/crc_hex.bat -${ConfigName}/${BuildArtifactFileBaseName}.hex -${ConfigName}/$ {BuildArtifactFileBaseName}_crc.hex -tools\\srecord\\srec_cat.exe LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 20
16 bytes of the input *.hex file. This table can be defined as the following structure: /* The safety-related FLASH CRC value. */ fs_crc_t c_sfsCRC __attribute__((used, section(".flshcrc"))) = LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 21
• Open the "Debug Configurations" menu ("Run → Debug configuration") and select the "Startup" tab. In this tab, select <YOUR_PROJECT_NAME_crc.hex ". "Load Image -> Use File -> *.hex file is in the <workspace>/<your_project>/Debug/<your_project>_crc.hex folder. • This edited This can be set in the OpenSDA, CMSIS-DAP, or J-Link debuggers. LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 22
Using GUI Flash Tool *.hex files. Only the SEGGER J-Link probes in the GUI Flash Tool support <PROJECT_NAME>_crc.hex " file for download. In the GUI Flash Tool settings, select "Workspace → <Configuration> → LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
NXP Semiconductors Chapter 6 IEC60730B tests The library contains the following tests: • Analog I/O test • Clock test • CPU register test • Digital I/O test • Invariable memory (flash) test • Variable memory (RAM) test • Program counter test •...
Page 25
CRC result and causes a safety error. 6.6 Variable memory test The variable memory on the supported MCU is an on-chip RAM. The RAM memory test is provided by the MarchC or MarchX tests. LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 26
For this test to run correctly, it is necessary to keep the WDOG_backup variable in a part of memory which is not corrupeted by the WDOG reset. NOTE Some debuggers do not allow the WDOG reset. Due to this, it is necessary to turn off the WDOG when debugging the application. LPC CM0 Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
NXP Semiconductors Chapter 7 Revision history Table 1. Revision history Revision number Description 2.9.0 Intial release. 2.10.0 Change devices supported in SDK rel. 2.10. 2.10.0 Post-build description added. Version cover SDK 2.9 and SDK 2.10 release - document for web LPC CM0 Safety Example , Rev.
Page 28
How To Reach Us Information in this document is provided solely to enable system and software implementers to use NXP products. There are no express or implied copyright licenses granted hereunder Home Page: to design or fabricate any integrated circuits based on the information in this document. NXP nxp.com reserves the right to make changes without further notice to any products herein.
Need help?
Do you have a question about the LPC CM0 Series and is the answer not in the manual?
Questions and answers