embOS software timer

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • embOS software timer

    Hi,

    with embOS on stm32f103

    when I create a timer with a period of 1ms

    ex:

    C Source Code

    1. void TimerCallback(void)
    2. {
    3. /* Reset PA0 */
    4. GPIOA->BRR = 0x00000001;
    5. }
    6. void StartTimer()
    7. {
    8. /* Set PA0*/
    9. GPIOA->BSRR = 0x00000001;
    10. OS_CreateTimer(&Timer, TimerCallback, 1);
    11. OS_StartTimer(&Timer);
    12. }
    Display All

    what is the possible period between StartTimer() and TimerCallback().
    Does it depend on the delay between OS Tick and call to StartTimer?

    Currently I am experiencing random periods between 0 and 1ms.
  • Hello,

    the embOS software timer timing is based on the system tick.
    The system tick is generated by a hardware timer which increments the system tick per default every 1 msec (you can also work with other system ticks, e.g. 100 usec or 10 msec).
    This means that the following could happen:
    You call StartTimer() 50 usec before the next hardware timer interrupt occurs.
    In this case the time between StartTimer() and the callback function is not 1 msec but around 50 usec.
    Please have a look in the generic embOS documentation in chapter "Chapter 17 Time measurement" for more details.

    Best regards,
    Til
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.