Page 1 of 1

How to handle interrupt when Client-Server (TCP/IP) running?

Posted: Thu Jan 01, 2009 3:23 am
by savaliya_ambani
hi,

As my issue of getting Max. TCP/IP rate is still remain @26 Mbps.

Now, my Client NNDK is communicating with the Server (Window PC) , and my communication Shoud starts with Interrupt arrival @ IRQ1 . But the problem is that,
As the interrupt request came, and goes to ISR , My client-server Link got Kill and fd returns <=0. I.E. NO more send , recv from this point.

As i expect , the Connection should be Established forver between NNDK and PC even interrupt comes @ any time.

can i have the solution of this problem?
Thanks in advance for your expected reply.

Re: How to handle interrupt when Client-Server (TCP/IP) running?

Posted: Thu Jan 01, 2009 12:24 pm
by bbracken
Two points:

1) Although I've never tried, it seems unlikely that you would be able to execute a send within the ISR. Even if it did work it certainly seems that you wouldn't want to do that. A better approach would be to have the ISR unblock a task and let the task send and receive.

2) What is happening within your ISR? I did a data acquistion project where 16 bit A/D readings were being received at up to 250k samples/sec. Data was received via IRQ7 and stored in a queue of structures to be transmitted by an uCOS task via TCP. It had to run at IRQ7 to ensure that none of the samples were missed. Processing a single sample via the IRQ destroyed TCP perfomrance and periodically caused link problems. I eventually had to periodically disable the IRQ to allow the FIFO hardware to almost fill completely and then empty the FIFO hardware in a single interrupt. I don't remember the exact data throughput, but the application was able to transmit the A/D samples in real-time without data loss. I also had 2 other simultaneous TCP connections that were also active, but at lower data rates (i.e., 3 simultaneous TCP connections). This code was written prior to the modifications to use the on chip RAM which should significantly increase the performance. Again, the interferrence of IRQ7 with TCP had to do with the rate of the IRQ.

Check with NB regarding item #1.

Hope this helps...

bb

Re: How to handle interrupt when Client-Server (TCP/IP) running?

Posted: Tue Jan 27, 2009 10:29 am
by pbreed
You are not allowed to do ANY network or serial I/O in an interrupt.
The best way to do this is to create a task that waits forever on a Semaphore and
have the interrupt release the task by posting to a semaphore.


Paul

static OS_SEM SemISR;


//The task to run and wait forever
void ISR_ProcessTask( void *p )
{
while(1)
{
OSPend(&SemISR,0);
//Do your NetWork I/O here

}
}


INTERRUPT(my_isr, 0x2700)
{
//Whatever is necessary to clear the interrupt
//Then
OSPost(&SemISR);
}



/* Inside your Initialization */
OSSemInit( &SemISR, 0 );

//The priority needs to be somewhat higher (IE a lower priority number) than you normal tasks
OSSimpleTaskCreatewName(ISR_PRocessTask,someunusedpriority,"MyISR Task")

//Now do you interrupt setup

Re: How to handle interrupt when Client-Server (TCP/IP) running?

Posted: Thu Jan 29, 2009 9:55 pm
by savaliya_ambani
Yes Thanks for your good reply,

I have already implemented this method of running the separate task for sending & receiving the packet,which will wait for the semaphore posted by the ISR. and its working greatly.

Once again thank you.