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.

Creating Hwi dynamically

Other Parts Discussed in Thread: SYSBIOS

Hi there,

I am having problem creating Hwi dynamically. In a thread I put the following code:

#include <ti/sysbios/hal/Hwi.h>

 ......
 Hwi_Handle hwi0;
Hwi_Params hwiParams;
Error_Block eb;
Error_init(&eb);
Hwi_Params_init(&hwiParams);
hwiParams.arg = 0;
hwiParams.enableInt = 1;
hwiParams.eventId = 84;
hwiParams.priority = 8;
hwi0 = Hwi_create(4, (Hwi_FuncPtr)isrConverter, &hwiParams, &eb);
if (hwi0 == NULL) {
System_abort("Hwi create failed");
}

The code runs with no complain, but the isrConverter is not running at all - the break point at the begining of the routine was not hit!
I have tried setting up the Hwi statically in the cfg file, and it runs well.
What am I missing here? How should I debug?

BR
C.J.
  • Hi there,

    I am having problem creating Hwi dynamically. In a thread I put the following code:

             #include <ti/sysbios/hal/Hwi.h>

     ......
     Hwi_Handle hwi0;
    Hwi_Params hwiParams;
    Error_Block eb;
    Error_init(&eb);
    Hwi_Params_init(&hwiParams);
    hwiParams.arg = 0;
    hwiParams.enableInt = 1;
    hwiParams.eventId = 84;
    hwiParams.priority = 8;
    hwi0 = Hwi_create(4, (Hwi_FuncPtr)isrConverter, &hwiParams, &eb);
    if (hwi0 == NULL) {
    System_abort("Hwi create failed");
    }
    
    
    The code runs with no complain, but the isrConverter is not running at all - the break point at 
    the begining of the routine was not hit!
    I have tried setting up the Hwi statically in the cfg file, and it runs well.
    What am I missing here? How should I debug?
    
    
    BR
    C.J.
  • C.J.,

    Can you attach your *.cfg file (that you create the Hwi in) for the working case?

    One thing you could try is the most basic code for creating the Hwi (with default parameters).  Does the following work?

      Hwi_Handle hwi0;

    hwi0 = Hwi_create(4, isrConverter, NULL, NULL);
    if (hwi0 == NULL) {
    System_abort("Hwi create failed");
    }

    Steve

  • Hi Steven,

    In the attachment is my cfg file for the working case.

    As to the code you suggested above,  can it work without specifying the event id? 

    The Hwi_create suceded, but the isrConverter is not running, the same as that I showed above.

    Do I neede to add a command like Hwi_start or something to make it work? 

    3568.my.cfg.txt

  • Chunjian Li,

    Are you sure that the interrupt that your Hwi is mapped to is actually firing?

    Can you try using ROV (in CCS: tools -> ROV) to view the Hwi instance that you are creating?  You can use ROV to compare the properties of the Hwi instance?  For example, I created a Hwi called "hwi0" and can see it in ROV:

    Also, a trick you can try is to modify the IFR register (interrupt flag register).  This is the register that is updated when an actual hardware interrupt occurs.  I set a break point in my program and then modified this register to signal my Hwi to fire.  Once I ran the program again, I was able to reach the breakpoint of my Hwi function "hwiIsr()":

    Can you try this also?

    Steve

  • You are right Steve, my Hwi was not fired because the optimizer has removed an empty loop in my code, which is a critical part of my converter driver. Now I have fixed the problem. Thanks a lot!