The IEC60730 v4.1 package for DSCs contains example projects for MC56F81768 (MC56F81000-EVK board) and MC56F83789
(FRDM-MC56F83000 board). These projects are built using the CodeWarrior for MCU IDE v11.1. If your toolchain is not ready
yet, install it according to the instructions in the following chapter.
1.1 Installing the toolchain
Find the web pages for your development board (for example MC56F81000-EVK) and click the getting started user's guide
document in the "Documents" section (see Support). The "Get Software" section contains all the necessary steps to set up
the toolchain.
IEC60730 DSC Example v4.1, Rev. 0, 03/2021
User's Guide3 / 14
NXP Semiconductors
Chapter 2
Hardware setup
With the safety_iec60730b example, the default hardware configuration uses an external PE-Micro Multilink debugger. For other
hardware configuration possibilities, see the web pages for the respective development board.
2.1 MC56F81000-EVK HW setup
Figure 1. MC56F81000-EVK development board configured for an external debug probe
• external Multilink for loading and debugging
• Micro USB -J26- for power supply and serial port communication (Silicon Labs CP210x USB to UART Bridge) !! DRIVER
INSTALATION FROM INTERNET MAY BE NEEDED !!
• default UART baud rate: 115200
Default connections for ADC test:
• GPIO pin A4 configured as ANA4 channel, connected to 4th pin of J4 connector. Use a wire to connect to VDD voltage,
for example 8th pin of J3 connector
• GPIO pin A5 configured as ANA5 channel, connected to 6th pin of J4 connector. Use a wire to connect to GND, for
example 12th pin of J3 connector
IEC60730 DSC Example v4.1, Rev. 0, 03/2021
User's Guide4 / 14
NXP Semiconductors
2.2 FRDM-56F83000 hardware setup
Hardware setup
Figure 2. FRDM-MC56F83000 development board configured for an external debug probe
• External Multilink for loading and debugging
• Micro-USB J21 for the power supply
• Default UART baud rate of 115200
• Micro-USB J8 for the serial port communication
The default connections for the ADC test are as follows:
• The GPIO pin A4 is configured as the ANA4 channel, connected to the 4th pin of connector J4. Use a wire to connect the
VDD voltage, for example the 8th pin of connector J3.
• The GPIO pin A5 is configured as the ANA5 channel, connected to the 6th pin of connector J4. Use a wire to connect the
GND, for example the 12th pin of connector J3.
IEC60730 DSC Example v4.1, Rev. 0, 03/2021
User's Guide5 / 14
NXP Semiconductors
Chapter 3
Opening the project
When the toolchain is prepared, add the project from the downloaded package into your workspace. Click on the “import project”
icon in the commander menu and then the “Browse” option in the “Select root directory” list. Navigate to the downloaded and
unpacked folder. Go to the “boards/your board” file and click the “OK” button. The example project for the selected board shall
appear in the “Projects” window.
Leave the “Copy projects into workspace” and “Add project to working sets” options unchecked and click the “Finish” button.
Now the "safety_iec60730b : flash_ldm_lpm_debug" project appears in the "Projects" window in your workspace. After building
the project, the
safety_iec60730.elf
binary file is created and the project is ready to be loaded into your device.
IEC60730 DSC Example v4.1, Rev. 0, 03/2021
User's Guide6 / 14
NXP Semiconductors
Chapter 4
Project files structure
The example project is a simple application which demonstrates the use of IEC60730 safety tests. The
with the initialization (after-reset) and runtime parts. The runtime part consists of an endless loop (background) and a periodical
interrupt routine. All these project parts are used to call safety test routines or their handling functions, respectively.
main.c
file is a central file
4.1 Files engaged in safety tests
safety_config.h
main.c
– central file, contains references from the linker file, global variables definition, and software loops
safety_dsc.c
safety_dsc.h
IEC60730_DSC_Class_B_CW_v4.1.lib
safety/…
project_setup_mcXXXXX.c
project_setup_mcXXXXX.h
safety_test_items.c
safety_test_items.h
MCXXXXXXXX_Internal_PFlash_LDM.cmd
– header file with general configurations for safety tests and the application.
– handling functions for the safety tests; contains references from the linker and global variables' definitions
– header file for the
– folder with library header files and the remaining source files
– configuration of the GPIO pins used for the digital input/output tests
– header file for the
safety_dsc.c
– configuration of peripherals that are related to the safety tests
– header file for the
file
– precompiled binary file with the IEC60730 Class B tests
project_setup_mcXXXXX.c
safety_test_items.c
– linker configuration file
file
file
IEC60730 DSC Example v4.1, Rev. 0, 03/2021
User's Guide7 / 14
NXP Semiconductors
Chapter 5
Project configuration
For a basic setup, use the
make sure that the WATCHDOG_ENABLED and WATCHDOG_TEST_ON macros are not defined. It is recommended to leave
the SAFETY_ERROR_ACTION macro value at zero. Otherwise, if any safety tests recognize an error, it is most probably due to
incorrect setup and the software becomes stuck in an endless loop.
safety_config.h
file. When starting, turn off the watchdog test and also the watchdog itself. To do so,
5.1 Linker configuration
Some of the key project configurations are made in the CMD file.
NOTE
The names of the symbols from the CMD file that are referenced in the application start with a capital "F" letter. In
the application code, they are referenced without the "F" letter.
5.1.1 Placing variables into a dedicated section
Placing the selected variables into a specific section in RAM can look as follows:
• In the CMD file, place a definition of your own section into the field that specifies the RAM area:
F_safety_ram = .;
* (.safety_ram.data)
. = ALIGN(4);
F_end_safety_ram = .;
• Reference and fill the section in the application code:
In this case, this technique is used for the Program Counter test. It is necessary to choose a valid, available, and accessible part
of memory, where the linkable object file will be placed and recognized by the application.
• Define and place the section using the CMD file:
PC_test_address_1 = 0x05555;
…
PC_test_address_1 = .;
*(.pc_test_1.text)
This definition allows for a specific placement of the
iec60730b_dsc_pc_object2.c
file.
iec60730b_dsc_pc_object1.c
file. The same approach is repeated for the
IEC60730 DSC Example v4.1, Rev. 0, 03/2021
User's Guide8 / 14
NXP Semiconductors
Project configuration
5.1.3 Calculating CRC of specified part of binary file before loading into device
This is a very useful feature, widely used in safety-related applications. The CodeWarrior linker allows you to configure such
calculation in the CMD file.
The reference in the application code is as follows:
extern __pmem CRC16_record g_crc_linker;
extern uint32_t start_text;
extern uint32_t end_text;
5.1.4 Stack overflow and underflow test
The stack overflow and underflow test is a part of the safety library. It is an additional test that watches the application stack for
the overflow and underflow situations.
In the CMD file, an optionally wide test area is defined below and above the stack.
The symbols are then referenced in the application code.
extern uint16_t _stack_test_p_2; /* symbol from Linker command file */
extern uint16_t _stack_test_p_3; /* symbol from Linker command file */
These are the basic linker configurations that are used in the "safety_iec60730b" example project. For more information see the
library user's guide.
5.2 MCUXpresso configuration tool
The example project is compatible with the MCUXpresso configuration tool. The setup of pins and clocks was done using this tool.
The configuration MEX file is in the project folder. For more information, see the MCUXpresso configuration tool pages.
IEC60730 DSC Example v4.1, Rev. 0, 03/2021
User's Guide9 / 14
NXP Semiconductors
Chapter 6
Loading project into device and debugging
When the project is ready and the binary ELF file is built, you can load the software into the device. Click "Run>Debug Configurations" and choose the most suitable configuration from the left-hand side window. In our case, it is
"***flash_ldm_lpm_debug_PnE U-MultiLink". Then click the "Debug" icon. To become more familiar with the example project,
standard debugging features can be used. If the watchdog test is enabled (WATCHDOG_TEST_ON is defined), the watchdog
resets the processor and the debugger loses the connection. When debugging, the watchdog test must be disabled.
6.1 FreeMASTER monitoring
Download and install FreeMASTER v3.x from www.nxp.com/freemaster.
For a correct hardware setup, see Hardware setup.
Open the
• Set the correct port and speed in "Project->Options->Comm", under "RS232".
• Check if the correct ELF file is selected in "Project->Options->MAP Files". See Figure 3.
safety_iec60730b.pmpx
file from the project folder.
Figure 3. Freemaster options window
• Click the “OK” button and then the green “GO!” button.
In the "Variable Watch" window, you shall see some variables with their values.
IEC60730 DSC Example v4.1, Rev. 0, 03/2021
User's Guide10 / 14
NXP Semiconductors
Loading project into device and debugging
To add or remove monitored variables, click "Project->Variables->Generate" and select the variables to be added to the
"Watch" window.
Move the mouse cursor anywhere into the "Variable Watch" window, right click, and select "Watch properties". By moving from
the "Available variables" window to the "Watched variables" window, the desired variables become monitored.
IEC60730 DSC Example v4.1, Rev. 0, 03/2021
User's Guide11 / 14
NXP Semiconductors
Chapter 7
Support
1. Main pages about the IEC60730 safety test routines https://nxp.com/iec60730