Stuck in OS_Delayus

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

  • Stuck in OS_Delayus


    I am experiencing an issue with OS_Delayus().

    1. Which embOS do you use?
    embOS V3.88 and stmlib V3.5
    Code Sourcery/gcc

    2. Which CPU and eval board do you use?
    Custom board

    3. Which start project do you use?
    Custom project

    Our code is :

    OS_Delayus(1); //CS disable time >50ns
    pCSpin->set( false );
    OS_Delayus(1); //CS setup time >150ns

    We are stuck
    in OS_Delayus(1)
    When we debug step by step here, the program keeps entering and exiting OS_GetTimeCycles(), like it's not leaving OS_Delayus().
    We can't debug OS_Delayus(1), because it's a library.

    We saw in embos release notes that OS_GetTimeCycles() was rewritten since embos 3.86. So maybe there is an issue here.

    Please could you give us any advice?

  • Hello,

    please have a look in the generic embOS manual.
    Each chapter includes a table which shows where each API function may be called.

    Yes, you can use OS_Delayus() in main() before OS_Start() is called.
    Please note that OS_Delayus() uses the hardware timer so it works only after the timer is initialized.

    Best regards,
  • Hi,

    Okay i found the API tables and OS_Delayus() seems to work before call of OS_Start()
    I cannot reproduce the bug I had with OS_Delayus for the moment, maybe a stack corruption problem.

    I have another issue with software timers.
    In the manual, the API functions for software timers claim that OS_CreateTimer() and OS_StartTimer() can be called before OS_Start().

    So I use it this way:

    Source Code

    1. void I2C2_InitTimeout(
    2. OS_CreateTimer( &Timer, I2C2_TimeoutCallback, 10 );
    3. OS_StartTimer(&Timer);
    4. )
    5. void I2C2_TimeoutCallback( void )
    6. {
    7. I2C2_timeout = true;
    8. }

    If I call InitTimeout() before OS_Start(), I never enter the callback.
    If I call InitTimeout() after OS_Start(), I enter the callback after the expected period.

    So do software timers only work after OS is started?