Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Multitasking problem

Altera_Forum
Honored Contributor II
1,354 Views

Hello, 

 

I have modified Simple Socket Server example for my application where my processor is a client. 

 

In this I am required to send and recv simultaneously. So in the beginning in CreateSocketTask, I create a socket and connect it to the server (After succesful connect, this task deletes itself). I have then two independent tasks: SendTask and RecvTask. In SendTask I periodically read data from a FIFO peripheral, format the data and send it. And In RecvTask, I can receive messages from the server. SendTask has higher priority then RecvTask. These two tasks are suspended before 'connect' and resume after 'connect' call. 

 

I observed while SendTask executes properly, RecvTask is not executing at all. However, if I keep RecvTask at higher priority, it is only the RecvTask which executes and the SendTask appears redundant. 

 

What could be the problem? 

 

Sincerely,
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
446 Views

In order for a lower priority task to get CPU time the higher priority task must have a OS Pend (OSFlagPend, OSMBoxPend etc...) or OSTimeDly() somewhere. Maybe the recv() and send() functions are non blocking and therefore do not suspend the task. 

I think you could use the select() function, which is blocking and uses the OS calls.
0 Kudos
Reply