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 LPC55Sxx family supports the following development boards: •...
Page 5
• Bandgap - connect a custom reference (for example 1.65 V) to PIO0_15 (P9-1). The expected value of the custom bandgap can be set in the safety_config.h file ( #define ADC_EXTERNAL_PIN_LEVEL 1.65 LPC55Sxx Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 6
If downloading to the device does not work, press and hold the S1 button during the download. FreeMASTER FreeMASTER communication is used via an onboard debugger with a speed of 9600 bd. LPCXpresso55S69/55S28 Development Boards User Manual (document UM11158) for more details. See the LPC55Sxx Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 7
#define ADC_EXTERNAL_PIN_LEVEL 1.65 Figure 3. Hardware connection of LPCXpresso55S28 The test voltage of 1.65 V is provided by a resistor voltage divider from the VCC (3.3 V). LPC55Sxx 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. LPC55Sxx 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). LPC55Sxx Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 12
.pinNum = 8, /*Position in DIR registor*/ .gpio_clkc_shift = SYSCON_AHBCLKCTRL0_GPIO1_SHIFT /* NULL terminated array of pointers to dio_test_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 }; LPC55Sxx Safety Example , Rev. 3, 07/2021 NXP Semiconductors...
Page 13
4.4 Source file - safety_safety_cm33_lpc.c/.h safety_cm33_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 LPC55Sxx 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: LPC55Sxx 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: LPC55Sxx 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. LPC55Sxx 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: LPC55Sxx 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 LPC55Sxx 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"))) = LPC55Sxx 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. LPC55Sxx 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> → LPC55Sxx 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. LPC55Sxx 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. LPC55Sxx 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 LPC55Sxx 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 LPC55S Series and is the answer not in the manual?
Questions and answers