Is there a routine about AUTOSAR OS for extended tasks?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is there a routine about AUTOSAR OS for extended tasks?

Jump to solution
3,995 Views
lubo_NEW
Contributor III

I added an extension task to the sample, but it could not be called,
or the system was shut down because of configuration problems

0 Kudos
Reply
1 Solution
3,892 Views
namnguyenviet
NXP Employee
NXP Employee

STCOUNTER hasn't any referred clock, either HW or SW, so this counter can increase only by calling IncrementCounter(). In the sample application, IncrementCounter() is called under TaskCnt context, so the duration of STCOUNTER tick is pretty much depended on the period calling time of TaskCnt.

TaskCnt is setup under Schedule table (see the expirePoint), and the duration of Schedule Table is 30000 based on SYSTEMTIMER ticks:

namnguyenviet_0-1616584679741.png

Assumed that SYS_CLK is 16MHz, eMIOS_0 uses FS80 = SYS_CLK/2 = 8MHz. Global prescaler = 2 as per configuration => EMIOS_0 clock is 8MHz/3 = 2.67MHz. 

=> 30000 ticks should be: 1/(2.67*10^6)*30000 = 0.01125 (s) = 11.25 (ms).

Then 1 tick of STCOUNTER should be 11.25ms as every 11.25 ms TaskCnt is called to increase the STCOUNTER tick.

 

 

View solution in original post

0 Kudos
Reply
10 Replies
3,978 Views
namnguyenviet
NXP Employee
NXP Employee

Hello,

Please refer to the Technical Reference (AUTOSAR_OSMPC574xG_tr.pdf), chapter 19: Sample application for the detail of each task in sample application.

0 Kudos
Reply
3,967 Views
lubo_NEW
Contributor III

Thank you for your reply. I have read the document carefully, but there is something I don't understand, the statement "stop schedule table in stop task"
Which dispatch to stop, I'm not sureQQ图片20210321212445.png

Does it stop the scheduling of the entire system, or does it stop the switching point of the scheduling as shown in the figureQQ图片20210321212910.png

stops ScheduleTable (after a while TIMLIMITALARM expires)

This sentence what mean, I found the task of TIMLIMITALARM parameters and TASKRCV1 relations, have not found and TASKSTOP task have relationship

 

 

0 Kudos
Reply
3,958 Views
namnguyenviet
NXP Employee
NXP Employee

StopScheduleTable should cancel the processing of a schedule table immediately at any point while the schedule table is running, according to the AUTOSAR specification. So all the schedule tasks in the schedule table expired points, even running or waiting, are canceled. The OS is still keep running.

stops ScheduleTable (after a while TIMLIMITALARM expires) >> actually ScheduleTable is stop when TASKSTOP is called, which is triggered when STOPALARM is expired, after a while when TIMLIMITALARM expires.

 

 

0 Kudos
Reply
3,928 Views
lubo_NEW
Contributor III

QQ图片20210323183811.png

 

I read the document carefully and there are a few points I don't understand
1, init STCOUNTER counter with value 0, init STCOUNTER counter with value 0
2, • Set relative timLimitAlarm to value 20 (when timLimitAlarm expired it
Set TimLimitEvent Event for this (taskRCv1) task).
Status = setRelAlarm (TimLimitAlarm, 125, 0);

0 Kudos
Reply
3,923 Views
namnguyenviet
NXP Employee
NXP Employee

With 1st point, the STCOUNTER hasn't been initialized yet, so the start value should be zero. There would be no corresponding code for this, just a state to note that situation. Also, you can see in TaskCNT, STCOUNTER is increased, in order to trigger the StopAlarm after STCOUNTER reach 20.

With 2nd point, actually the TIMLIMITVALUE counter is 125, and probably the document has a typo.

0 Kudos
Reply
3,901 Views
lubo_NEW
Contributor III

Thank you for your reply. I understand, but as shown in the figure, EB has configured and generated the STCOUNTER counter variable
What is the duration of each STCOUNTER, how is it calculated, and how long is the duration of each task function that triggers the TaskCNTQQ图片20210324092035.pngQQ图片20210324092300.png

0 Kudos
Reply
3,893 Views
namnguyenviet
NXP Employee
NXP Employee

STCOUNTER hasn't any referred clock, either HW or SW, so this counter can increase only by calling IncrementCounter(). In the sample application, IncrementCounter() is called under TaskCnt context, so the duration of STCOUNTER tick is pretty much depended on the period calling time of TaskCnt.

TaskCnt is setup under Schedule table (see the expirePoint), and the duration of Schedule Table is 30000 based on SYSTEMTIMER ticks:

namnguyenviet_0-1616584679741.png

Assumed that SYS_CLK is 16MHz, eMIOS_0 uses FS80 = SYS_CLK/2 = 8MHz. Global prescaler = 2 as per configuration => EMIOS_0 clock is 8MHz/3 = 2.67MHz. 

=> 30000 ticks should be: 1/(2.67*10^6)*30000 = 0.01125 (s) = 11.25 (ms).

Then 1 tick of STCOUNTER should be 11.25ms as every 11.25 ms TaskCnt is called to increase the STCOUNTER tick.

 

 

0 Kudos
Reply
3,953 Views
lubo_NEW
Contributor III

You mean that the AUTOSAR_OS system is still running after entering the STOP task and stopping the schedule table.
When triggering stopArm, why should TimLimitAlarm Expires be triggered later?Well, I didn't see it in the EB configuration screen
Inevitable or indirect relationship between imlimitAlarm and stopAlarm
TimLimitAlarm mainly activates the taskRcv1 task

0 Kudos
Reply
3,937 Views
namnguyenviet
NXP Employee
NXP Employee

STOPALARM and TIMLIMITALARM are two separate alarms, rather than trigger/depend on each other. The TIMLIMITALARM expires after STOPALARM has expired due to the fact that the period time of TIMLIMITALARM is longer, and that's all. 

0 Kudos
Reply
3,989 Views
lubo_NEW
Contributor III

TASK( TASKRCV1 )
{
volatile StatusType status; /* variable to check system status */
EventMaskType event; /* variable for event masks */
MSGATYPE Msg_A; /* object to receive message MsgA */
InitGPIO(LED3);
Msg_A.value = 0;
for( ; ; ) /* main endless loop */
{
DisableAllInterrupts(); /* to allow to use a breakpoint on next line */
hookNmb = 0;
EnableAllInterrupts();
status = SetRelAlarm( STOPALARM, 20, 0 ); //20
StartScheduleTableRel(SCHEDTAB, 1);
for( ; ; )
{
taskRcv1++;
status = ClearEvent( MSGAEVENT | TIMLIMITEVENT );
status = SetRelAlarm( TIMLIMITALARM, 125, 0 ); //125
status = WaitEvent( MSGAEVENT | TIMLIMITEVENT );
status = GetEvent( TASKRCV1, &event );
if ( event == MSGAEVENT )
{
CancelAlarm( TIMLIMITALARM );
status = GetResource( MSGAACCESS );
status = IocRead_MsgA ( &Msg_A ); /* get message data */
status = ReleaseResource( MSGAACCESS );
}
else
{
if( ++repeatCnt >= (REPEAT_CNT_MAX_VAL * 2) )
{
repeatCnt = 0;
#if defined (MULTICORE)
status = GetSpinlock(SPINLOCK_GPIO);
#endif
SetGPIO(LED3);
#if defined (MULTICORE)
status = ReleaseSpinlock(SPINLOCK_GPIO);
#endif
}
break;
}
}
}

}

Or what exactly does the function in this example here mean or how does it relate to other tasks

0 Kudos
Reply