• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Embedded Software » BIOS » BIOS forum » Creating Hwi dynamically
Share
BIOS
  • Forum
  • Announcements
Options
  • Subscribe via RSS

Forums

Creating Hwi dynamically

This question is answered
Chunjian Li
Posted by Chunjian Li
on Apr 16 2012 09:29 AM
Intellectual580 points

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.
SYS/BIOS 6
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Chunjian Li
    Posted by Chunjian Li
    on Apr 16 2012 09:32 AM
    Intellectual580 points

    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.
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Steven Connell
    Posted by Steven Connell
    on Apr 16 2012 17:00 PM
    Mastermind20580 points

    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

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Chunjian Li
    Posted by Chunjian Li
    on Apr 17 2012 03:15 AM
    Intellectual580 points

    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

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Steven Connell
    Posted by Steven Connell
    on Apr 17 2012 17:52 PM
    Verified Answer
    Verified by Chunjian Li
    Mastermind20580 points

    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

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Chunjian Li
    Posted by Chunjian Li
    on Apr 23 2012 02:11 AM
    Intellectual580 points

    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!

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use