SPRADI6 May   2024 F29H850TU , F29H859TU-Q1 , TMS320F2800132 , TMS320F2800133 , TMS320F2800135 , TMS320F2800137 , TMS320F2800152-Q1 , TMS320F2800153-Q1 , TMS320F2800154-Q1 , TMS320F2800155 , TMS320F2800155-Q1 , TMS320F2800156-Q1 , TMS320F2800157 , TMS320F2800157-Q1 , TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DH-Q1 , TMS320F28P659DK-Q1 , TMS320F28P659SH-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2Overview of C2000™ MCU Devices in Appliances
  6. 3Introduction of IEC/UL 60730-1/60335-1 Standards
  7. 4Diagnostic Libraries for UL/IEC 60730-1/60335-1 Provided by C2000™
    1. 4.1 Stack Overflow Detection
    2. 4.2 Watchdog
    3. 4.3 CPU and FPU Registers
    4. 4.4 Program Counter (PC)
    5. 4.5 Clock
    6. 4.6 RAM
    7. 4.7 Flash
    8. 4.8 ADC
    9. 4.9 Cycle Time and Memory Usage
  8. 5References

Stack Overflow Detection

The enhanced bus comparator (EBC) unit in the ERAD module can monitor the internal address and data buses, and the EBC triggers the RTOSINT interrupt when a specified bus and mask matches a specified value. Hence, the basic approach for detecting stack overflow is to configure the EBC unit to trigger an interrupt when the data write address bus falls within some range prior to the end of a stack. Figure 4-2 illustrates this concept. Since this memory is reserved for stack use only, a data write within the specified address range indicates that the stack usage is approaching the allocated size limit. Detection of an impending stack overflow triggers a maskable interrupt. Programmed error response and any necessary software requirements are defined by the system integrator.

 Stack Overflow
                    Monitoring Figure 4-2 Stack Overflow Monitoring

The API function STL_SP_configSP(const STL_SP_Handle spHandle) is found in the example project, and the source code is in f280013x\source\stl_sp.c. The STL_SP_MARGIN parameter needs to be configured, with a reference value of 0x50. This parameter defines the memory space range observed from the end of the stack.