This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS320F28388D: Using Watchdog Interupt in SYS/BIOS Project

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE, SYSBIOS

Tool/software: Code Composer Studio

Dear Todd,

As we know, it's necessary to create Hwis for PIE interrupts in SYS/BIOS project.  Nonetheless, what should I do with watchdog interrupt or other system exceptions like NMI interupts?

Could I do with them like what I do in C2000ware project? Or should I create Hwis or Swis for them? Is there sample for it?

Thanks!

QL

  • QL,

    Can you please describe how you will be using the watchdog?  For example are you wanting to know how to detect if it reset the CPU?  Or are you wanting to respond to an interrupt that a watchdog reset the other CPU?

    Also, can you clarify “like what I do in C2000ware project”?  Is there a sample project you are referring to?

    Thanks,
    Scott

  • Hi Scott,

    I want to use Watchdog just like the example project below from C2000ware:

    watchdog_ex1_service.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    //#############################################################################
    //
    // FILE: watchdog_ex1_service.c
    //
    // TITLE: Servicing Watchdog Example
    //
    //! \addtogroup driver_example_list
    //! <h1> Watchdog </h1>
    //!
    //! This example shows how to service the watchdog or generate a wakeup
    //! interrupt using the watchdog. By default the example will generate a
    //! Wake interrupt. To service the watchdog and not generate the interrupt,
    //! uncomment the SysCtl_serviceWatchdog() line in the main for loop.
    //!
    //! \b External \b Connections \n
    //! - None.
    //!
    //! \b Watch \b Variables \n
    //! - wakeCount - The number of times entered into the watchdog ISR
    //! - loopCount - The number of loops performed while not in ISR
    //!
    //
    //#############################################################################
    // $TI Release: F2838x Support Library v2.00.00.03 $
    // $Release Date: Sun Sep 29 07:45:41 CDT 2019 $
    // $Copyright:
    // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
    //
    // Redistribution and use in source and binary forms, with or without
    // modification, are permitted provided that the following conditions
    // are met:
    //
    // Redistributions of source code must retain the above copyright
    // notice, this list of conditions and the following disclaimer.
    //
    // Redistributions in binary form must reproduce the above copyright
    // notice, this list of conditions and the following disclaimer in the
    // documentation and/or other materials provided with the
    // distribution.
    //
    // Neither the name of Texas Instruments Incorporated nor the names of
    // its contributors may be used to endorse or promote products derived
    // from this software without specific prior written permission.
    //
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    // $
    //#############################################################################
    //
    // Included Files
    //
    #include "driverlib.h"
    #include "device.h"
    //
    // Globals
    //
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Thanks!

    QL

  • Hi QL,

    OK, thank you.  

    Since you are using the watchdog in interrupt mode instead of reset mode, you can create a Hwi for it, similar to what you do for other peripheral interrupts.

    Regards,
    Scott

  • Hi Scott,

    Thanks a lot for your advice. What about other NMI interrupt? If I want to cope with corresponding NMI and do something (i.e. protection mechanism) especially for them, what should I do with them in BIOS. Also should I use Hwis or not?

    Thanks again!

    QL

  • Hi QL,

    Yes you can use the Hwi module to catch an NMI.  Since this is not a ‘normal’ interrupt it is configured differently.  Instead of using Hwi_create() you need to ‘plug’ a handler to catch the NMI.  

    To plug the NMI at runtime, in your C file you can do something like this:

    #include <ti/sysbios/family/c28/Hwi.h>

       Hwi_plug(18, <your NMI function>);


    If you want to plug the NMI statically in your application configuration script, you can do something like this:

    var Hwi = xdc.useModule('ti.sysbios.family.c28.Hwi');

    Hwi.plugMeta(18, <your NMI function>);


    To test this you can use a TRAP or INTR instruction to activate the handler, for example:
        asm(" TRAP #18");

    Here are a couple of forum links for reference:
    https://e2e.ti.com/support/legacy_forums/embedded/tirtos/f/355/t/182614?How-to-handle-the-NMI-and-ILLEGAL-interrupt-in-BIOS-for-c28x-
    https://e2e.ti.com/support/legacy_forums/embedded/tirtos/f/355/t/365033?NMI-Event-Handling-with-SYSBIOS-6-40

    Regards,
    Scott