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.

Sysbios Hwi

Other Parts Discussed in Thread: TMS320TCI6618, SYSBIOS

Hi,

I have an issue with Hwi_create (), when called for the first time it works fine. I delete using Hwi_delete() and re-create using Hwi_create. I get the following error.

"E_alreadyDefined: Hwi already defined: intr# 6

xdc.runtime.Error.raise: terminating execution"

Following are the other details.

 Bios version 6_32_01_38


Here is the code that i am using.

Hwi_Params_init (&intParams);
intParams.arg       = (UInt32)instHandle;
intParams.enableInt = TRUE;
instHandle->hwiHandle =   Hwi_create(   6, 
                                        Isr, 
                                        &intParams, NULL);


Hwi_delete(&(instHandle->hwiHandle));

Hwi_Params_init(&intParams);
intParams.arg       = (UInt32)instHandle;
intParams.enableInt = TRUE;
instHandle->hwiHandle =   Hwi_create(  6, 
                                        Isr, 
                                        &intParams, NULL);

Thanks,

Bharti

  • Bharti,

    I'm able to create a Hwi and then delete it successfully from within main().  I did this by updating the standard SYS/BIOS swi example (new code bolded):

    Void hwiIsr(UArg x) {}

    /*
     *  ======== main ========
     */
    Void main()
    {       
        Swi_Params swiParams;
        Hwi_Params hwiParams;
        Hwi_Handle myHwi;
        Task_Params taskParams;
        Clock_Params clkParams;

        Hwi_Params_init(&hwiParams);
        myHwi = Hwi_create(6, &hwiIsr, &hwiParams, NULL);

        Hwi_delete(&myHwi);

    I have a question about the code you posted ...

    Bharti Jain said:
    intParams.arg       = (UInt32)instHandle;

    Could you please show me the declaration of the variable 'instHandle'?

    Bharti Jain said:
    instHandle->hwiHandle =   Hwi_create(   6, 

    Curious as to why you are doing this?  I'm wondering if this "self reference" is causing the issue ...

    Steve

  • Bharti,

    I also re-created the same Hwi and it worked, I didn't get the error (I only forgot to paste all of the code above)

    Steve

  • Hi,
    
    
    If I try this,even this does not work.& I don't want to create & delete in main() but during IPC.
    
    
    Hwi_Params          hwiParams;
    Hwi_Handle hwihandle;
        Int32               vectId;
    Int16 eventId;

    eventId = 75;
    vectId = 7;

    Hwi_Params_init(&hwiParams);

    hwiParams.arg = (UArg) hModule;
    hwiParams.eventId = eventId;
    hwiParams.enableInt = TRUE;

    hwihandle = Hwi_create(vectId,ISR, &hwiParams, NULL);
    
    
     Hwi_delete(&hwihandle);

     hwihandle = Hwi_create(vectId,ISR, &hwiParams, NULL);
  • Which hardware platform are you using?

    Thanks,

    Steve

  • Ok, I see from a different post that you're using:

    BIOS version : 6_32_01_38  (c66)

    Device : TMS320TCI6618

    I will try to reproduce this on the same hardware tomorrow (need to borrow that hardware from a colleague ...).

    Steve

  • ok steve,thanks !

    Bharti

  • Bharti,

    I created a simple project for the 6678 hardware (which is the same as TCI6618 you are on). But, I was not able to reproduce the problem.

    I've attached the project ... can you try to import this project and run it on your hardware set up?  Does it work for you or do you see the same problem?

    Steve

    3755.hwi_6678.zip

  • I have modified the HWI_example to add a CAN RX ISR at vector 101 on the 28x335. I added this using the GUI

     

    The HW CAN registers show I have a mailbox RX IRQ pending but I never hit a breakpoint in the ISR

    Ignore the fact I have all possible CAN IRQ's mapped to the same ISR below

    If I manually  set my PC to

    Void Hwi_dispatchC(register Int intNum) and set intNum to 101 I reach my ISR code showing the PIE vector is correct

     

    var

    Defaults = xdc.useModule('xdc.runtime.Defaults');

    var

    Diags = xdc.useModule('xdc.runtime.Diags');

    var

    Error = xdc.useModule('xdc.runtime.Error');

    var

    Log = xdc.useModule('xdc.runtime.Log');

    var

    LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');

    var

    Main = xdc.useModule('xdc.runtime.Main');

    var

    Memory = xdc.useModule('xdc.runtime.Memory')

    var

    SysMin = xdc.useModule('xdc.runtime.SysMin');

    var

    System = xdc.useModule('xdc.runtime.System');

    var

    Text = xdc.useModule('xdc.runtime.Text');

    var

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

    var

    Boot = xdc.useModule('ti.catalog.c2800.init.Boot');

    /*

    * Use SysMin for output (System_printf() and error messages) and

    * minimize the output buffer size to save data space.

    */

    System.SupportProxy = SysMin;

    SysMin.bufSize = 80;

    /*

    * Create a LoggerBuf and make it the default logger for all modules.

    */

    var

    LoggerBufParams = newLoggerBuf.Params();

    LoggerBufParams.numEntries = 16;

    var

    logger0 = LoggerBuf.create(LoggerBufParams);

    Defaults.common$.logger = logger0;

    Main.common$.diags_INFO = Diags.ALWAYS_ON;

    /*

    * Minimize size of the system stack. System stack usage by the app

    * can be reviewed with ROV in the module view for ti.sysbios.knl.Task.

    */

    Program.stack = 512;

    /*

    * Program.argSize sets the size of the .args section.

    * The examples don't use command line args so argSize is set to 0.

    */

    Program.argSize = 0x0;

    /*

    * Uncomment this line to globally disable Asserts.

    * All modules inherit the default from the 'Defaults' module. You

    * can override these defaults on a per-module basis using Module.common$.

    * Disabling Asserts will save code space and improve runtime performance.

    Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;

    */

    /*

    * Uncomment this line to keep module names from being loaded on the target.

    * The module name strings are placed in the .const section. Setting this

    * parameter to false will save space in the .const section. Error and

    * Assert messages will contain an "unknown module" prefix instead

    * of the actual module name.

    Defaults.common$.namedModule = false;

    */

    /*

    * Minimize exit handler array in System. The System module includes

    * an array of functions that are registered with System_atexit() to be

    * called by System_exit().

    */

    System.maxAtexitHandlers = 4;

    /*

    * Uncomment this line to disable the Error print function.

    * We lose error information when this is disabled since the errors are

    * not printed. Disabling the raiseHook will save some code space if

    * your app is not using System_printf() since the Error_print() function

    * calls System_printf().

    Error.raiseHook = null;

    */

    /*

    * Uncomment this line to keep Error, Assert, and Log strings from being

    * loaded on the target. These strings are placed in the .const section.

    * Setting this parameter to false will save space in the .const section.

    * Error, Assert and Log message will print raw ids and args instead of

    * a formatted message.

    Text.isLoaded = false;

    */

    /*

    * Uncomment this line to disable the output of characters by SysMin

    * when the program exits. SysMin writes characters to a circular buffer.

    * This buffer can be viewed using the SysMin Output view in ROV.

    SysMin.flushAtExit = false;

    */

    /*

    * Application specific configuration

    */

    /*

    * Disable unused BIOS features to minimize footprint.

    * This example does not use Swis, Tasks, or Clocks.

    */

    var

    BIOS = xdc.useModule('ti.sysbios.BIOS');

    BIOS.swiEnabled =

    false;

    BIOS.taskEnabled =

    false;

    BIOS.clockEnabled =

    false;

    /* Minimize system heap size */

    BIOS.heapSize = 0x0;

    /*

    * In this example, runtime support functions that need

    * a lock are NOT called from multiple threads that can

    * pre-empt each other.

    *

    * Use the simplest lock function available.

    */

    BIOS.rtsGateType = BIOS.NoLocking;

    /* Add a background idle function */

    var

    Idle = xdc.useModule('ti.sysbios.knl.Idle');

    Idle.addFunc(

    "&myIdleFxn");

    /*

    * Build a custom BIOS library. The custom library will be smaller than the

    * pre-built "instrumented" (default) and "non-instrumented" libraries.

    *

    * The BIOS.logsEnabled parameter specifies whether the Logging is enabled

    * within BIOS for this custom build. These logs are used by the RTA and

    * UIA analysis tools.

    *

    * The BIOS.assertsEnabled parameter specifies whether BIOS code will

    * include Assert() checks. Setting this parameter to 'false' will generate

    * smaller and faster code, but having asserts enabled is recommended for

    * early development as the Assert() checks will catch lots of programming

    * errors (invalid parameters, etc.)

    */

    BIOS.libType = BIOS.LibType_Custom;

    BIOS.logsEnabled =

    false;

    BIOS.assertsEnabled =

    true;

    Boot.pllOSCCLK = 25;

    BIOS.cpuFreq.lo = 75000000;

    Boot.pllcrDIV = 6;

    Boot.configurePll =

    false;

    var

    hwi0Params = new Hwi.Params();

    hwi0Params.instance.name =

    "hwi0";

    hwi0Params.arg =

    null;

    Program.global.hwi0 = Hwi.create(48,

    "&epwm1_timer_isr", hwi0Params)

    var

    hwi1Params = new Hwi.Params();

    hwi0Params.instance.name =

    "hwi1";

    hwi1Params.instance.name =

    "hwi1";

    Program.global.hwi1 = Hwi.create(101,

    "&CAN_LowPriorityISR", hwi1Params);

    var

    hwi2Params = new Hwi.Params();

    hwi2Params.instance.name =

    "hwi2";

    hwi2Params.arg =

    null;

    Program.global.hwi2 = Hwi.create(49,

    "&epwm2_timer_isr", hwi2Params);

    var

    hwi3Params = new Hwi.Params();

    hwi3Params.instance.name =

    "hwi3";

    hwi3Params.arg =

    null;

    Program.global.hwi3 = Hwi.create(50,

    "&epwm3_timer_isr", hwi3Params);

    var

    hwi4Params = new Hwi.Params();

    hwi4Params.instance.name =

    "hwi4";

    Program.global.hwi4 = Hwi.create(51,

    "&epwm4_timer_isr", hwi4Params);

    var

    hwi5Params = new Hwi.Params();

    hwi5Params.instance.name =

    "hwi5";

    Program.global.hwi5 = Hwi.create(52,

    "&epwm5_timer_isr", hwi5Params);

    var

    hwi6Params = new Hwi.Params();

    hwi6Params.instance.name =

    "hwi6";

    hwi6Params.arg =

    null;

    Program.global.hwi6 = Hwi.create(53,

    "&epwm6_timer_isr", hwi6Params);

    var

    hwi7Params = new Hwi.Params();

    hwi7Params.instance.name =

    "hwi7";

    Program.global.hwi7 = Hwi.create(100,

    "&CAN_LowPriorityISR", hwi7Params);

    var

    hwi8Params = new Hwi.Params();

    hwi8Params.instance.name =

    "hwi8";

    Program.global.hwi8 = Hwi.create(102,

    "&CAN_LowPriorityISR", hwi8Params);

    var

    hwi9Params = new Hwi.Params();

    hwi9Params.instance.name =

    "hwi9";

    Program.global.hwi9 = Hwi.create(103,

    "&CAN_LowPriorityISR", hwi9Params);

     

     

     

     

  • Mark,

    Please open a new Forum thread for this issue.

    Having said that, I suspect that the problem you're having is that you're application is being interrupted to death because ALL or SEVERAL of the interrupts you created are enabled and pending.

    Just prior to calling the user's ISR, the interrupt dispatcher re-enables global interrupts.

    If another interrupt is pending, it will be serviced immediately, preventing the ISR code from being arrived at.

    On the way to servicing the pre-empting interrupt, the dispatcher will again re-enable global interrupts just before calling the ISR code. etc, etc...

    By default, when interrupts are created, they are also enabled.

    The Hwi parameter that controls whether an interrupt is automatically enabled when created is 'enableInt' and it is true by default.

    If you want only ONE of your CAN interrupts enabled when created, set this parameter to 'false' in your config script for all Hwi's except the one you're interested in.

    Alan