Friday, April 20th 2018, 4:59am UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

user255

Beginner

Date of registration: Apr 11th 2013

Posts: 7

1

Monday, July 22nd 2013, 5:24pm

Stuck in OS_Delayus

Hello,

I am experiencing an issue with OS_Delayus().


1. Which embOS do you use?
stm32f103rgt6
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?

Thanks

SEGGER - Til

Super Moderator

Date of registration: Nov 14th 2007

Posts: 266

2

Tuesday, July 23rd 2013, 8:49am

Hello,

there was an issue with OS_GetTime_Cycles() in some RTOSInit.c some time ago but should be now fixed in all RTOSInit.c.
Could you please contact the embOS support via email?
We can check then if you have the fixed implementation of OS_GetTime_Cycles().

Best regards,
Til

user255

Beginner

Date of registration: Apr 11th 2013

Posts: 7

3

Wednesday, July 24th 2013, 4:42pm

Hello,

Does the function OS_Delayus() work correctly before OS_Start() is called?
Do you have a list of all the embos functions than can be used before the OS is started?

Best regards

SEGGER - Til

Super Moderator

Date of registration: Nov 14th 2007

Posts: 266

4

Wednesday, July 24th 2013, 4:45pm

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,
Til

user255

Beginner

Date of registration: Apr 11th 2013

Posts: 7

5

Thursday, July 25th 2013, 9:50am

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
2
3
4
5
6
7
8
9
void I2C2_InitTimeout(
OS_CreateTimer( &Timer, I2C2_TimeoutCallback, 10 );
OS_StartTimer(&Timer);
)

void I2C2_TimeoutCallback( void )
{
I2C2_timeout = true;
}


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?

Thanks

SEGGER - Til

Super Moderator

Date of registration: Nov 14th 2007

Posts: 266

6

Thursday, July 25th 2013, 9:54am

Hello,

yes, the software timer callback functions are called by the scheduler, so they work only after OS_Start().

Best regards,
Til