Round Robin working wrong?

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

Round Robin working wrong?

Jump to solution
2,495 Views
M_ttferrari
Contributor III

Hi everyone, I'm doing my first steps with MQX 3.6.1 and I have problems when I want to configurate my tasks in round robin schedule. 

I've read examples, manual raference and user's guide and I could see that if I want to configurate the task schedule in round robin mode, I need to put the macro MQX_TIME_SLICE_TASK in task template. I created two task, both have the same priority in task template, but the first task created never gives the procesor to the second one when the time slice expires.
Tasks are very simple, led1_task, switches on and off a LED1 of my TWR-MCF51CN. By other hand, botones_task detects if SW2 and or SW3 are pressed, then if they were pressed switches on LED2 (SW2) and LED3 (SW3), else, switches off the leds. Both tasks work fine when I put a _time_delay(100) inside (I think that there aren't working in round robin mode).
There is any other parameters or macros to keep in mind at the moment to configurate my tasks in round robin mode? 
My code was attached, please I don't know how I can continue with this...
Thank you in advance.
Matt

 

0 Kudos
1 Solution
749 Views
M_ttferrari
Contributor III

Hi JuroV, Thank you for your anwer.

 

 

Technically, the problem was solved yesterday. I don't know why, but I've uninstalled 
and then reinstalled all codewarrior and mqx again, finally mqx recognizes the 
time_slice and the project works perfect now. 

 

Matt

View solution in original post

0 Kudos
8 Replies
749 Views
FredericoPrado
Contributor II

Use (MQX_AUTO_START_TASK | MQX_TIME_SLICE_TASK) instead of just MQX_AUTO_START_TASK as parameter in the first task.

0 Kudos
749 Views
M_ttferrari
Contributor III

Hi Frederico, thank you for your answer. I tryed with the line that you recommended me, but nothing different has occured... 

Did you fix the problem with (MQX_AUTO_START_TASK | MQX_TIME_SLICE_TASK)  in the first task??

 

 

It looks like MQX doesn't know the MACRO  MQX_TIME_SLICE_TASK (I belive that) but in user_config.h I have the macro MQX_HAS_TIME_SLICE 1, then in mqx.h appears these lines

 

 

#if MQX_HAS_TIME_SLICE
#define MQX_TIME_SLICE_TASK            (0x04)
#endif

 

 

So, there aren't any problem when I compile the project...

 

Thanks

Matt

0 Kudos
749 Views
JuroV
NXP Employee
NXP Employee

Change the last item of task template for time slice to 10 for both tasks (you have set only one task's time slice value).

0 Kudos
749 Views
M_ttferrari
Contributor III
JuroV, Sorry I've made a big mistake, because I had attached a different file that I was working on. This is the correct file... please, forget the previous one. Thank you Matt
0 Kudos
749 Views
JuroV
NXP Employee
NXP Employee

If you have set MQX_HAS_TIME_SLICE in your user_config.h, then rebuilt BSP and PSP and then built your application, it should work.

0 Kudos
749 Views
M_ttferrari
Contributor III

JuroV

 

It have set MQX_HAS_TIME_SLICE in my user_config.h then I rebuild BSP and PSP then my project, but anything has been happened.

 

How do I suppose to do for rebuild BSP and PSP? Because my way to rebuild these kernels are, modify user_config.h of TWR-51CN, then open bsp_twrmcf51cn (inside of ...\Freescale MQX 3.6\mqx\build\cwmcu63) => rebuild it, then open psp_twrmcf51cn and rebuild again... But in this way I didn't have changes on the results. 

 

I don't know, I reintalled MQX3.6 too... It is simple, it should work as you said me.

 

Matt

0 Kudos
749 Views
JuroV
NXP Employee
NXP Employee

Of course you have to rebuild BSP and PSP, when your changes have impact to the kernel. The result from BSP and PSP is after build-phase copied to the lib/<your_board>.cw/mqx

You should find there user_config.h with modified value of MQX_HAS_TIME_SLICE (your copied user_config.h). If not, you did not properly build your BSP and PSP.

0 Kudos
750 Views
M_ttferrari
Contributor III

Hi JuroV, Thank you for your anwer.

 

 

Technically, the problem was solved yesterday. I don't know why, but I've uninstalled 
and then reinstalled all codewarrior and mqx again, finally mqx recognizes the 
time_slice and the project works perfect now. 

 

Matt

0 Kudos