Hello all, I have an application I'm testing that uses bi-directional communication on the native USB port of the Due. It sends 32 to 64 byte packets back and forth at 2400 times per second both directions. I don't have any problems going from the Due to the pc at even 4800 times per second. However, as soon as I start sending any data even at slower speeds like 1200 times per second from the PC to the Due while the Due is also sending at any speed, I get massive errors, data loss, and after about 5 seconds or so it will even hang the Due and it must be reset to recover. Here are a few things I've already tried:
Making sure data being sent/received is isolated so I'm not running into any concurrency issues (although I'm not sure how that would be a problem anyway since this thing doesn't really appear to be multi-threaded)
Currently output from the Due is on a timer (TC1, ch2 so TC5_Handler) but I've tried just processing it in the main loop "as fast as it can" as well but I see the same behavior.
I tried synchronizing the I/O so that the Due doesn't send it get's the response from the PC and the PC doesn't send until it gets a response from the Due. That solves the problems, makes it stable and run fine, but us WAAAY too slow at around 250 packets per second.
I have standard packet sizes. I've tried both 32 byte and 64 byte packets and I get the exact same results.
I'm about ready to give using SerialUSB as the read line and Serial as the write line a try to see if I can make that work. Ugly as heck but I figured it was worth a try. Can anyone help me understand why as soon as I try to go bi-directional with the USB I/O everything goes to crap?