How do you keep a task that is normally on a 10ms interval from timing out?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How do you keep a task that is normally on a 10ms interval from timing out?

ソリューションへジャンプ
903件の閲覧回数
boogy
Contributor III

I have two tasks that are on a 10 ms time slice.

My understanding is that after 10ms each task will defer to the highest priority task.

Here is my template:

 

 

const TASK_TEMPLATE_STRUCT MQX_template_list[] ={    /* Task Index, Function,   Stack,  Priority,    Name,  Attributes, Param,  Time Slice */{TELNET_TASK_ID, uTelnet_task,   1500, 10, "nc500_Telnet" , 0,   0,      0 },{HTTP_TASK_ID,   uhttp_task,   2500, 7,   "http" , 0,  0,      0 },{ARCNET_TASK_ID, uArcnet_task,   512, 9,   "Arcnet" , 0,  0,      0 },{SOCKET_TASK_ID,   uSocket_task,   1000, 7,   "Socket" , 0,   0,      0 },{LIF_TASK_ID, uLif_task,   700, 10,   "Lif" , 0,  0,      0 },{FLASH_UP_TASK_ID, uFlash_Up_task, 1000, 10,  "Flash_up" , MQX_AUTO_START_TASK,  0,      0 },{VNC_TASK_ID, uVNC_task, 3000, 10,   "VNC",   0,  0, 10},{A2D_TASK_ID, uA2D_task, 1000, 10, "A2D",   0,  0, 10},    {0,     0,    0,  0,   0,   0,      0,  0 }};

 My "VNC" and "A2D" tasks use a time slice of 10ms. My "Arcnet" task has a priority of 9 and "VNC  has a priority of 10.

During a memory write operation that takes longer than 10 ms to complete while in my VNC task the "Arcnet " task switches on and changes the chip select on my hardware and when I return to the VNC task I am no longer selecting the correct memory chip.

I have tried disabling interrupts during big memory operations but didnt acheive good results.

I have also tried _sched_set_rr_interval(_task_get_id(),0);

but it didnt work also.

 

 

 

 

0 件の賞賛
返信
1 解決策
594件の閲覧回数
tr9
Contributor II

The functions;  _task_start_preemption() and  _task_stop_preemption() might work for you. . . assuming that none of your interrupt handlers cause the chip selects to change.

 

In your VNC task, follow these steps:

 

1) Call _task_stop_preemption()

2) perform the memory write

3) Call _task_start_preemption()

 

See MQX Reference Manual, Sect 2.1.287

 

Disclaimer: I don't know what your software does, nor the implications of preventing other threads (tasks) from running while you perform the memory write. . . Your original problem could be handled multiple ways, but the alternatives would likely involve significant changes to your app.

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
595件の閲覧回数
tr9
Contributor II

The functions;  _task_start_preemption() and  _task_stop_preemption() might work for you. . . assuming that none of your interrupt handlers cause the chip selects to change.

 

In your VNC task, follow these steps:

 

1) Call _task_stop_preemption()

2) perform the memory write

3) Call _task_start_preemption()

 

See MQX Reference Manual, Sect 2.1.287

 

Disclaimer: I don't know what your software does, nor the implications of preventing other threads (tasks) from running while you perform the memory write. . . Your original problem could be handled multiple ways, but the alternatives would likely involve significant changes to your app.

0 件の賞賛
返信