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.

TMS570LC4357: Creating Semaphore and RTI Interrupt Conflict Based on FreeRTOS

Part Number: TMS570LC4357

Hello, may I ask if creating semaphores based on FreeRTOS in TMS570LC4357 conflicts with RTI interrupts

The specific phenomenon is as follows:

When no semaphore is created in the main function, the rtiNotification interrupt of RTI can be entered;

Keep other code unchanged and add CAN1 to the main function_ Semaphore=xSemaphoreCreatBinary(); To create a semaphore,Unable to enter RTI's rtiNotification interrupt

The specific configuration is as follows:

RTI uses Block1 and compare1 for counting and enabling:

rtiREG1->CAPCTRL = 2U | 0U;//enable capture counter 1,triggered by event source 0
rtiEnableNotification(rtiREG1, rtiNOTIFICATION_COMPARE1);
rtiStartCounter(rtiREG1, rtiCOUNTER_BLOCK1);

Configure the interrupt vector table as follows:

static const t_isrFuncPTR s_vim_init[128U] =
{
&phantomInterrupt,
&esmHighInterrupt,
&phantomInterrupt, 
&vPortPreemptiveTick, 
&rticompare1HighLevelInterrupt,
&rticompare2HighLevelInterrupt,
......
}

The configuration of the rticompare1HighLevelInterrupt function is as follows:

#pragma CODE_STATE(rticompare1HighLevelInterrupt, 32)
#pragma INTERRUPT(rticompare1HighLevelInterrupt, IRQ)
void rticompare1HighLevelInterrupt(void)
{
rtiREG1->INTFLAG = 2U;
rtiNotification(rtiREG1,rtiNOTIFICATION_COMPARE1);
}

If there is a conflict between the FreeRTOS operating system and RTI, how can I use a watchdog

Looking forward to your reply very much, thank you very much.

  • Hi Hu Jiangbo,

    Can i get the simplest project to trigger this issue at my end?

    --
    Thanks & regards,
    Jagadish.

  • 1125.rar
    hi jagadish gundavarapu,

    this is my project.

    When I comment it out

    CAN1_Semaphore = xSemaphoreCreateBinary();//创建CAN1信号量
    CAN2_Semaphore = xSemaphoreCreateBinary();//创建CAN2信号量

    The program can enter rtiNotification  interrupt.

    On the contrary, it's not possible.

    Thank you very much and we look forward to your answer

  • Hi Hu Jiangbo,

    I found the root cause for the issue!

    The flag "I" in the CPSR register will decide the IRQ interrupt is in enabled state or disabled state.

    If this IRQ_disable bit is 1 means, then IRQ interrupts are disabled else IRQ interrupts are enabled.

    Actually till before calling the function "taskENTER_CRITICAL" the IRQ_disable bit value is 0 only that means interrupts are enabled only, but once we call this function then the IRQ_disable value becoming 1 as it is a supervisor mode.

    But this flag is not clearing any where again and interrupts are in disabled state only.

    As we are entering into the critical section, so it is good to clear interrupts to eliminate the race around conditions:

    But again, after we exit from the critical section it would be good to reenable the interrupts:

    So, you can just call the "_enable_IRQ_interrupt_" after creating binary semaphores as below:

    This will reenable the interrupts, so our RTI interrupts will again work as we expected.

    --
    Thanks & regards,
    Jagadish.

  • hi,jagadish

    Thank you very much for your reply and for resolving my issue

    To express my highest respect

    Wishing you a happy life and smooth work

  • Wishing you a happy life and smooth work

    Thank you very much and wishing you the same!