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.

Enableing the HWI Dispatcher in SysBios (Bios 6.x)

Other Parts Discussed in Thread: SYSBIOS, OMAP3530

I'm using SysBios on the Cortex A8 core of the OMAP3530.  I would like to post a SWI from an HWI by calling Swi_or().  However, I apparently don't have the Hwi Dispatcher properly enabled, because I can post the SWI outside of the ISR but not from within.

I looked through the .cfg file Help documentation and the Bios 6.x User's Guide but couldn't find any information on explicitily enabling the Hwi Dispatcher.  The documentation indicates that the extern global variables  associated with the Hwi Dispatcher are enabled by default, but apparently I'm missing an initialization step.

Any assistance would be greatly appreciated.

Thanks

Bob

 

  • Are you saying that you arrive at your Hwi thread which posts a Swi, but the Swi never runs?

  • Alan,

    I originally called Swi_or inside the ISR, but the SWI didn't run.  I looked in the SysBios User's Guide and it said that it's not possible to post a SWI from within an HWI unless the HWI Dispatcher was enabled.  This sounded like my problem, so to confirm, I tried posting Swi_or from a task outside of the HWI and the SWI ran as expected. 

    That led me to suspect that the HWI Dispatcher wasn't properly enabled, but i couldn't find any information on enabling it. (there doesn't appear to be a Use Dispatcher check box as there was in the DSP/BIOS 5.4x configuration GUI).

    The program that I'm working with is the SysBios Mutex example that I selected when creating my SysBios project.  I added the code from the SWI example to implement the SWI, but there weren't any HWI examples in the template, so I wrote  the HWI ISR from scratch.;

    Thanks

    Bob

     

  • There is no need to "enable the HWI dispatcher". It is always enabled.

    Do you know for certain that the ISR is even being invoked?

    I'm thinking there may be a problem with the way you've defined your Hwi function.

    Chapter 6.2 of The BIOS User's Guide shows examples of how to bind an ISR function to a particular system interrupt.

    Can you provide the C or config script code you're using to create your Hwi object?

  • Alan,

    I'm definitely getting into the ISR.  I can set a break-point at Swi_or() and hit it when I receive an IPC message from the C64x+ core.  However, when I run Swi_or(), the SWI isn't invoked.  If I run Swi_post() from within a task it is invoked.

    I have zipped up both the C source and config files.  As you can see they are based on the Mutex and SWI examples from the CCSv4.2 Bios 6 project examples.  If you like, I can send you the entire project, however, I need to sanitize some of the header files before I can do that. 

    Let me know if you spot something or need more information.

    Regards,

    Bob

     4657.mutex.zip

  • Hmmm. Only one thing jumps out at me.

    You're using SysStd and calling System_printf() from an ISR. This is usually a fatal thing to do. Can you try commenting out the System_printf() call or using SysMin instead?

    Which version of BIOS are you using?

     

  • Alan,

    I'll remove the Sys_printf() statement and see if that solves the problem.  I don't really need it anyway.   I'll keep you informed of the result.

    Thanks,

    Bob

     

  • Alan,

    I removed the Sys_printf() statement but the SWI will still not run when I post it within the ISR.  I found an HWI example in the BIOS 6 User's Manual.  I copied the source code, but haven't had a chance to build and run the project. This particular example uses the timer interrupt, so there isn't any HWI initialization code in the example, but if it works, it might provide a clue about what is going on.  I'll let you know.

    Thanks

    Bob

     

  • Alan,

    I missed your question about the BIOS version.  I'm using 6.31.02.23, which I think is the latest.

    Bob

     

  • Once the IPC interrupt occurs, does your background thread ever run again?

    I'm wondering if you're properly servicing the IPC interrupt within your Hwi thread.

    If not, then you may be taking the interrupt over and over again, which would prevent Swis from running.

     

  • I created and ran the attached testcase on my beagle board to prove to myself that Swi_or() when executed from a Hwi thread will result in the Swi getting run properly.

    The testcase utilizes a feature in the interrupt controller that allows you to initiate an interrupt programmatically (the Hwi_post() API uses this feature).

    Can you try building and running this testcase on your setup?

    ---

    I was able to reproduce a condition similar to what you're getting by commenting out this line in the hwiFxn() that acks the interrupt:

        Hwi_intc.ISR_CLEAR0 = (0x10000);

    Without this line, the interrupt never gets serviced properly and remains asserted when the dispatcher calls the Swi scheduler. Because the Swi scheduler re-enables interrupts prior to calling any Swi functions, we re-enter the dispatcher, and the cycle begins again...

    2475.HwiSwiOrTest1.ZIP

  • Alan,

    I just logged on to tell you that I had solved the problem and read your response.  The problem was just as you described in your previous post and your test case: I was not properly clearing the interrupt after writing to the IPC mailbox register. 

    It took some time to find the problem, because I was processing the wrong User channel on the ARM side.  I was clearing User 0 IRQ bit (IRQSTATUS bit 0) when I should have been clearing User 1 (IRQSTATUS bit 2).  Once I changed the IRQ reset mask to clear bit 2, the Swi posted properly.  My bad!!!

    I've downloaded your test code and will try it out as well.  Thanks for taking the time to create it.

    One final question..I wasn't able to link the HwiSwiTaskExample that I copied from the BIOS 6.2 User's Guide.  The reason is that it uses List objects, and couldn't find the ti.sdo.utils library.  The release notes for my verion of Bios 6 indicate that this library has now been integrated with the IPC library.  Is this the library that will be available in the Release 6.23?  I'm curious because I would  eventually like to use List objects in the Bios 6 version of my project, since they appear to be very similar to DSP/BIOS 5.4.x QUE objects.

    Thanks again for your help.  I'll mark this thread as verifited.

    Bob