DRS4 Forum
  DRS4 Discussion Forum  Not logged in ELOG logo
Entry  Tue Sep 10 10:31:30 2013, Akira Okumura, USB connection stops drs_simple.cpp
    Reply  Wed Sep 11 02:41:28 2013, Andrey Kuznetsov, USB connection stops 
       Reply  Wed Sep 25 14:42:00 2013, Akira Okumura, USB connection stops 
    Reply  Wed Jan 15 15:48:55 2014, Stefan Ritt, USB connection stops 
Message ID: 324     Entry time: Wed Jan 15 15:48:55 2014     In reply to: 292
Author: Stefan Ritt 
Subject: USB connection stops 

finally I found some time to look into this problem, sorry for the late delay.

I tried your program and started it maybe 50 times without an issue. So I cannot reproduce your problem.

I know that if you do Ctrl-C then you might have some data "stuck" in the USB interface, like you ask for a 
waveform data buffer but you never read it because you got interrupted by the Ctrl-C. But when you reinitialize 
the board the next time, all stuck data is drained before the board is initialized. This is done in DRS.cpp 
around line 343:

            /* drain any data from Cy7C68013 FIFO if FPGA startup caused erratic write */
            do {
               i = musb_read(usb_interface, 8, buffer, sizeof(buffer), 100);
               if (i > 0)
                  printf("%d bytes stuck in buffer\n", i);
            } while (i > 0);

So occasionally, after a restart after a Ctrl-C, you will see "xxx bytes stuck in buffer", but then the boards 
should come up correctly.

If you have the problem without Ctrl-C, then maybe your specific board has a hardware problem? Do you have 
access to another board? 

Best regards,
ELOG V3.1.5-fc6679b