There are ISR for each endpoints inside the file USBUART_episr.c. You can add your code in the OUT EP. When host is sending data to device OUT EP ISR will be triggered.
Perfect, thank you very much
At the end of the day, all your interrupt could do is stuff the data into a buffer and set a flag that there is something in the buffer.
Then, your main loop would need to periodically check the flag, and then process the buffer contents if the flag is set.
The copy-to-buffer is already done for you, and you can consider the call to USBUART_1_DataIsReady() as the same thing as checking your flag. So why doen't the approach you pasted above work for you? I can't think of any other way to do it.
You certainly should not be processing the contents of the received data inside the interrupt service routine.
Hi alex934, I am facing the same problem as you faced .I too want to interrupt my while(1) loop. can you please share the solution with me beacuse i don't know how to use interrupts given in episr.c. Now i Know how to use ISR but it is transmitting and receiving only 64 bytes at a time. I wish to send 512 bytes at a time. plz give some solution