TM4C1294NCPDT: Time it should take a pending semaphore to run once it's posted in TIRTOS.

Part Number: TM4C1294NCPDT

Hello,

I have Timer1 set with a period of 20us.  I post a semaphore in the timer function as well as toggle a port pin as a test.  The pending semaphore is in a high priority task.  It's taking almost 13us from when the semaphore is posted until the pending semaphore in the task stops blocking.  This seems like a long time.  I would expect just a few microseconds.  Is this a normal?

static void timer1(UArg arg)
{

  HWREG(GPIO_PORTN_BASE + ((GPIO_PIN_2 << 2))) = 4;
  HWREG(GPIO_PORTN_BASE + ((GPIO_PIN_2 << 2))) = 0;
  Semaphore_post(sem1);

}

static void mainTaskFxn(UArg arg0, UArg arg1)
{

    while (1)
    {
       Semaphore_pend(sem1, BIOS_WAIT_FOREVER);   // Takes 13us to unblock once posted


       HWREG(GPIO_PORTN_BASE + ((GPIO_PIN_2 << 2))) = 4;
       HWREG(GPIO_PORTN_BASE + ((GPIO_PIN_2 << 2))) = 0;
    }   
}

   

  • Hi,

      Can you try using different pins between timer1() and  mainTaskFxn? For example, use PN3 in mainTaskFxn but PN2 in timer1(). I suppose it should produce the same result but just wanted to make sure measuring rise edge of PN2 to rise-edge of PN3 is giving the same result.  What is the system clock you are running? What if you change the priority of the task? What if you change the period of timer? If you change any of them does it make a difference. Sorry that I'm not an expert of TI-RTOS. My knowledge is mainly on the MCU, not the OS. If you change the parameters I mentioned and you still measure the same latency, then I guess I will have to believe your measurement and that is how it is. 

      Just wanted to give you a heads-up. I will be out of office for the rest of the week. If you have follow up questions I will ask my colleague to assist you. Incase your post is missed, I will suggest you open a new thread so the moderator can assist you.