RTI Safety Example
==================

Introduction
------------

This example displays setting up RTI to

* Setup of Windowed Watchdog Timer (WWDT)
* Handling WWDT failure interrupts received on the ESM module in the MCU domain R5F


Use Cases
---------

    +----------+-------------------------------------+-----------+-----------+---------+------------------------------+----------------------+
    | Use Case | Failure   n                         | RTI Inst  | ESM       | Window  | Input Trigger                | Expected Event       |
    +==========+=====================================+===========+===========+=========+==============================+======================+
    | UC-1     | Permanent Failure (100% Window)     | RTI0      | MCU_ESM0  | 100%    | Stop servicing completely    | Window End           |
    +----------+-------------------------------------+-----------+-----------+---------+------------------------------+----------------------+
    | UC-2     | Permanent Failure (50% Window)      | RTI0      | MCU_ESM0  | 50%     | Stop servicing completely    | Window End           |
    +----------+-------------------------------------+-----------+-----------+---------+------------------------------+----------------------+
    | UC-3     | Latency / Propagation timing error  | RTI0      | MCU_ESM0  | 50%     | Service before window opens  | Window Start         |
    |          | (early) (50% window)                |           |           |         | again after previous feeding |                      |
    +----------+-------------------------------------+-----------+-----------+---------+------------------------------+----------------------+
    | UC-4     | Latency / Propagation timing error  | RTI0      | MCU_ESM0  | 50%     | Service after full window    | Window End, then     |
    |          | (late) (50% window)                 |           |           |         | has passed since previous    | Window Start         |
    |          |                                     |           |           |         | feeding                      |                      |
    +----------+-------------------------------------+-----------+-----------+---------+------------------------------+----------------------+

Example Details
---------------

The example should be loaded to the hardware using the Secondary Boot Loader (SBL) from the SDK.

+---------------------+------------------------------------------------+------------------------------------------+
| Example Name        | Location                                       | Build Command                            |
+=====================+================================================+==========================================+
| rti_app_uc1         | [sdl_install_dir]/examples/rti/UC1/            | make rti_app_uc1 PROFILE=release         |
+---------------------+------------------------------------------------+------------------------------------------+
| rti_app_uc2         | [sdl_install_dir]/examples/rti/UC2/            | make rti_app_uc2 PROFILE=release         |
+---------------------+------------------------------------------------+------------------------------------------+
| rti_app_uc3         | [sdl_install_dir]/examples/rti/UC3/            | make rti_app_uc3 PROFILE=release         |
+---------------------+------------------------------------------------+------------------------------------------+
| rti_app_uc4         | [sdl_install_dir]/examples/rti/UC4             | make rti_app_uc4 PROFILE=release         |
+---------------------+------------------------------------------------+------------------------------------------+

Expected Output
---------------

rti_app_uc1:

.. code:: bash

     RTI Example Test Application
     
     RTI_Test_init: Init MCU ESM complete
     
     RTI Example code UC-1 started
        DWWD configured to 100 percent window size
        DWWD is configured for 10000 ms time-out
     
     RTI DWWD proper servicing test running.
        Please wait for max 10000 ms.
     
     RTI DWWD proper servicing test successful.
     
     
     RTI permanent failure test running.
        DWWD will generate interrupt after 10 seconds
        Wait for 10 sec for interrupt to be generated by DWWD.
     
        Interrupt is generated to ESM
        ESM Call back function called : instType 0x2, intType 0x1, grpChannel 0x2, index 0x14, intSrc 0x54
        Take action
     
     RTI Window End time violation test successful.
     
     Test Name: RTI EXAMPLE TEST  PASSED
     
     All tests have passed.


rti_app_uc2:

.. code:: bash

     RTI Example Test Application
     
     RTI_Test_init: Init MCU ESM complete
     
     RTI Example code UC-2 started
        DWWD configured to 50 percent window size
        DWWD is configured for 10000 ms time-out
     
     RTI DWWD proper servicing test running.
        Please wait for max 10000 ms.
     
     RTI DWWD proper servicing test successful.
     
     
     RTI permanent failure test running.
        DWWD will generate interrupt after 10 seconds
        Wait for 10 sec for interrupt to be generated by DWWD.
     
        Interrupt is generated to ESM
        ESM Call back function called : instType 0x2, intType 0x1, grpChannel 0x2, index 0x14, intSrc 0x54
        Take action
     
     RTI Window End time violation test successful.
     
     Test Name: RTI EXAMPLE TEST  PASSED
     
      All tests have passed.

rti_app_uc3:

.. code:: bash

     RTI Example Test Application
     
     RTI_Test_init: Init MCU ESM complete
     
     RTI Example code UC-3 started
         DWWD configured to 50 percent window size
         DWWD is configured for 10000 ms time-out
     
     
     RTI DWWD Early Trigger violation test running.
     
     
     Servicing before the window open.
     
     Interrupt is generated to ESM
         ESM Call back function called : instType 0x2, intType 0x1, grpChannel 0x2, index 0x14, intSrc 0x54
       Take action
     
     
     RTI DWWD Early Trigger violation test successful.
     
     Test Name: RTI EXAMPLE TEST  PASSED
     
      All tests have passed.

rti_app_uc4:

.. code:: bash

     RTI Example Test Application
     
     RTI_Test_init: Init MCU ESM complete
     
     RTI Example code UC-4 started
         DWWD configured to 50 percent window size
         DWWD is configured for 10000 ms time-out
         DWWD will generate interrupt after 10 seconds
     
     Waiting for window to expire
     
     Wait for 10 sec for interrupt to be generated by DWWD.
     
     Interrupt is generated to ESM
        ESM Call back function called : instType 0x2, intType 0x1, grpChannel 0x2, index 0x14, intSrc 0x54
        Take action
     
     
     RTI Late trigger servicing test running.
     
        Re-Opening the window to service after previous feed
        RTI Late trigger servicing test successful.
     
     Test Name: RTI EXAMPLE TEST  PASSED
     
      All tests have passed.

Reference
---------

`RTI User Guide <../modules/rti.html>`_
