Software Diagnostic Library

Current and future C2000™ microcontrollers are designed with integrated features that can be used in safety-critical systems. Manufacturers of end equipment must take steps to ensure safe and reliable operation of their systems in order to meet the relevant standards.

Hardware features such as write-protected registers and supervisory circuits have all been integrated in C2000 MCUs. These features, leveraged to the diagnostic test and safety mechanism requirements of the targeted safety standard, make compliance in the electronic segment of the tests more easily achievable.

The C2000™ Software Diagnostic Library is a collection of optimized independent test functions for C2000 MCUs. The library includes C-callable optimized test functions that return the status of the test performed. In case of a failure returned signifying a detected fault, it is up to the user application to determine the appropriate action to take.

The SDL consists of individual functions that are called and managed by the user’s application software. Each function is designed with a specific task to verify functionality of a device component using a specific safety mechanism consistent with safety standards with minimal impact on the real-time control performance of the target MCU. STL functions are provided to support POST, PEST, or both.

In addition to the library modules, the SDL also contains examples to demonstrate the use of the library and the configuration of hardware diagnostic features.

Overview of the Library

The following subsections briefly list and describe the error reporting mechanisms, contents, and coverage of the diagnostic library. The library is delivered with several example CCS projects. The test_application demonstrates the use of all the library modules. See the Self-Test Application section of this document for more details on the example.

../_images/directory.jpg

Fig. 1 Directory Structure

Error Reporting

All the API functions in the diagnostic library return the status of the test. If the test fails, the functions set a unique error code to a 32-bit global variable, STL_Util_globalErrorFlags. All codes are defined in stl_util.h and start with STL_UTIL_ followed by a representation of the test. For example, STL_UTIL_OSC_TIMER2 represents the error code the oscillator frequency test.

Library Files

The diagnostic library consists of the following files. All source files with a .c and .asm extension have an associated header file that contains function prototypes and data structures. For example for stl_osc_ct.c there is an associated stl_osc_ct.h file that declares the function prototypes, data types, and #defines.

File Name

Source Description

stl_can_ram.c

CAN Message RAM March and parity logic test

stl_cpu_reg.asm

C-callable assembly test of CPU, FPU, VCRC registers

stl_crc.c

CRC code for E2E communications and memory tests

stl_crc_s.asm

C-callable assembly CRC code

stl_lcm.c

Lockstep Compare Modules tests

stl_march.c

March test

stl_march_s.asm

C-callable assembly for March test

stl_mcan_ram.c

MCAN RAM March and ECC logic test

stl_osc_ct.c

Internal OSC Frequency test

stl_osc_hr.c

High Resolution OSC (HRPWM) Frequency test

stl_pie_ram.c

PIE RAM test

stl_sp.c

Stack Pointer Monitoring test

stl_util.c

Utility functions, primarily for managing error flags

Using the Library

This section describes all the necessary steps that are required to rebuild and use the library in an application.

Library Build Options

The current version of the library was built with CCSv12 using C28x Codegen Tools 22.6.0.LTS with the following options:

  • -v28

  • -ml

  • -mt

  • –vcu_support=vcrc

  • –float_support=fpu32

  • –tmu_support=tmu0

Rebuilding the Library

The diagnostic safety library ships with the original CCS projectspec file that was used to build the library. This project can be used as a template to modify and rebuild the library.

  1. Create a new workspace.

  2. Import the projectspec file found in the ccs folder

  3. Make the required changes.

  4. Right click project and select Build Configurations -> Clean All and when that completes Build Configurations -> Build All.

  5. The new library will be placed in the lib folder.