some questions about USB-CDC and ISR

nobody wrote on Tuesday, December 06, 2005:

Dear Sirs,

I adapted the USB-CDC demo for AT91SAM7A3, taken from the lwIP_Demo_Rowley_ARM7, it works but then I modified the vUSBCDCTask function to implement a simple Echo for that I at the end of the for(;:wink: block:

while( xQueueReceive( xRxCDC, &ucByte, usbNO_BLOCK ) ){
    xQueueSend( xTxCDC, &ucByte, usbNO_BLOCK );
}

Then I test the throughput but It is really slow (about 300 @ 115200baud nominal). I would like to know how to improve the responsiveness. Should I do everything in the ISR function? Or should I wake up a task from the ISR? And then, howto to make a task waits the receipt of data (from ISR)? I put xQueueReceive (…) with some delay (e.g. usbSHORT_DELAY), but in this case the task is polling the queue…

Thank you for your help

nobody wrote on Wednesday, December 07, 2005:

Try searching the forum for "circular buffer".  You should find some helpful discussion.

nobody wrote on Wednesday, December 07, 2005:

Dear sir,

thank you for your answer. I had a look at the old messages, but I couldn’t find any new ideas.
I followed the R.Barry instruction I had:
- an ISR routine collecting data from the hardware and then it puts them in a Queue;
- a task replying with a simple echo. But the throughput is near 300baud (or less…)…note that if I repeat more times an incoming character (eg. 2 times) I double the speed…4 times speedx4 etc…

I wonder if the bottleneck would be on the pc side…

I try to put everything in the ISR routine

nobody wrote on Wednesday, December 07, 2005:

Sorry but the last part of the message is:


I try to put everything in the ISR routine but I didn’t have any improvement

Thanks for your help

nobody wrote on Thursday, December 08, 2005:

Have you checked that your ISR time doesn’t exceed
your timer tick?

nobody wrote on Thursday, December 08, 2005:

No, I haven’t. How can I do that?

I have one more question, can happen a task switch while ISR is executing? 
I put the ‘echo’ in the ISR, which is a smal amount of code: get data from usb IN buffer and put it in the OUT buffer.

thank for your help

M