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.

Problem with priority handling.

Other Parts Discussed in Thread: SYSBIOS

Hello,

I have two Hwi threads (Timers) and one ISR function (called directly by the Hwi_dispatcher). The 20Khz thread must have the highest priority.

Using oscilloscope, I notice that my 20Khz timers thread (ti_sysbios_hal_Timer) seems to be preampted by the CAN ISR (ti_sysbios_family_arm_tms570_Hwi, priority 16) even if the 20Khz interrupt number is lower (higher priority).   I have jitter in the 20Khz thread as I have CANBUS interrupts (16).  

In the ROV diagnostic, I could see that the priority of the 20Khz timer thread is higher (2, lower than 16), which is ok.

So what's going on? It seems that the BIOS doesn't handle the priority properly.

Another question:

I don't see where we configure the priority of  timer thread. I can configure the priority of the CAN interrupt (Hwi) tough.  





CCS 4.2, sysbios 6.31.4.27, xdc 3.20.8.88, TMS570

Simon

  • Simon,

    My understanding of the function of priorities (channel numbers) in the Vectored Interrupt Manager (VIM) is that they only determine which interrupt to service when multiple interrupts are pending simultaneously. The VIM does not appear to automatically suppress lower priority interrupts while a particular interrupt is being serviced.

    The Hwi module for the TMS570 does provide a mechanism for controlling which interrupts are enabled while a particular interrupt is being serviced by means of the enumerated "maskSetting" instance config parameter.

    By default, the maskSetting parameter is set to Hwi.MaskingOption_SELF which results in all but the current interrupt being enabled while it is being serviced.

    Other settings are:

    1) MaskingOption_NONE, which enables ALL interrupts (including the interrupt-under-service) while the current interrupt is being serviced.

    2) MaskingOption_ALL, which disables ALL interrupts while the current interrupt is being serviced (this may be what you want to use for 20KHz Timer interrupt).

    3) MaskingOption_BITMASK, which, combined with the disableMask0, disableMask1, restoreMask0, and restoreMask1 bit mask parameters allow you to precisely control which interrupts are disabled while an interrupt is being serviced.

    4) Some device interrupt architectures (unfortunately not the VIM) also support MaskingOption_LOWER, which would yield the behavior you want.

     

    To control the Hwi settings for the Timer instances, use the Timer.Params.hwiParams config parameter. Here is an example I think might work for you:

     var Hwi = xdc.useModule('ti.sysbios.family.arm.tms570.Hwi');
     var Timer = xdc.useModule('ti.sysbios.family.arm.tms570.Timer');

     var timerParams = new Timer.Params()

     timerParams.hwiParams = new Hwi.Params();

     timerParams.period = 50;    /* 50us = 20 KHz */
     timerParams.hwiParams.maskSetting = Hwi.MaskingOption_ALL; /* don't allow nesting  */

     Timer.create(Timer.ANY, '&myTimerFunc', timerParams);

  • «

    MaskingOption_BITMASK, which, combined with the disableMask0, disableMask1, restoreMask0, and restoreMask1 bit mask parameters allow you to precisely control which interrupts are disabled while an interrupt is being serviced. 

    »

    Hello,

    Could-you describe a little bit more on this.

    In my case, I interested to use Hwi_MaskingOption_BITMASK in a way that all the others interrupt sources at that moment are disabled, except the one being handled. For instance, my interrupt number is 10. I guess disableMask0 must equal ~(0x01000), disableMask1 equal to 0xffffffff. But what about restoreMask0 and restoreMask1?

    Simon

    TMS570, ccs5.1