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.

IWR1443: Semaphore timeout

Part Number: IWR1443
Other Parts Discussed in Thread: TIDEP-0091, SYSBIOS

Hello,

How can I make the semaphore timeout work?
I've tested it with the code below, but it keeps waiting for the semaphore with semaphore_pend.
Semaphore timeout not working.

Semaphore creation:
  Semaphore_Params_init(&semParams);
  semParams.mode = Semaphore_Mode_BINARY;
  gMmwMCB.endSpiSlaveTransaction_semHandle = Semaphore_create(0, &semParams, NULL);

Waiting for semaphore:
  Semaphore_pend(gMmwMCB.endSpiSlaveTransaction_semHandle, 100); //100ms timeout

Best Regards,
Horoyuki Taguchi

  • Hi Horoyuki,

    Could you please provide some additional context on how you are testing this (breakpoint, print statements, etc...)? Also have you ensured there is no task prioritization issues that could be causing this?

    Best Regards,

    Josh

  • Hi Josh,

    A1.I added the following code at the end of the TIDEP-0091 demo main.c init_Task function to check the UART output messages.
    It will be confirmed by Flashing, not on the CCS debugger.

    TIDEP-0091 mein.c init_Task() additional code:

    CLI_init();

    Semaphore_Params_init(&semParams);
    semParams.mode = Semaphore_Mode_BINARY;
    gMmwMCB.endSpiSlaveTransaction_semHandle = Semaphore_create(0, &semParams, NULL);

    SemaphoreP_Status status;
    CLI_write("semaphore wait\n");

    status = SemaphoreP_pend(gMmwMCB.endSpiSlaveTransaction_semHandle, 100); //for semaphore wait test

    if (status == SemaphoreP_TIMEOUT)
    {
    CLI_write("semaphore timeout\n");
    }
    else
    {
    CLI_write("semaphore ok\n");
    }


    Create init_Task:

    Task_Params_init(&taskParams);
    taskParams.stackSize = 6*1024;
    Task_create(init_Task, &taskParams, NULL);

    A2.>Also have you ensured there is no task prioritization issues that could be causing this?
    Could you give me some specifics about the task priority issue?
    Does it mean that there is a task priority constraint for the semaphore timeout function?

    Best Regards,
    Hiroyuki

  • Hi Josh,

    I was able to solve the issue that the semaphore_pend timeout does not work.

    It was caused by the following settings in mss.cfg.

    BIOS.clockEnabled      = false;

    What is the difference if BIOS.clockEnabled is true or false?

    I couldn't find an explanation of this setting in the SYS/BIOS user guide, so could you point me to some reference documents?

    Best Regards,

    Hioryuki

  • Hi,

    The documentation that you are looking for regarding the clockEnabled setting can be found in your sys bios installation under <sys bios install>/docs/cdoc/ti/sysbios/BIOS.html in the section called 'config BIOS_clockEnabled'.

    From the above documentation: when clockEnabled is set to false "For APIs that take a timeout, values other than NO_WAIT will be equivalent to WAIT_FOREVER."

    Best Regards,

    Josh

  • Hi Josh,

    Thank you for your reply.

    It looks like the timeout doesn't work because the timer object isn't created.

    I got it now!

    Thanks,

    Hioryuki