I am making a basic "oscilloscope" project using the PSOC-5 and I thought I had it all working smoothly till I wrote the PC software to visualize the data. I am using a SAR_SEQ ADC with two channels. The EOC output of the ADC goes into a demux that feeds four different DMA channels, each with its own TD, buffer, and interrupt. This is to implement a hardware-based ping pong buffer, and the interrupt output of each DMA is routed not only to and ISR (that loads the now full buffer into the IN endpoint) but also to a counter that will move the EOC signal to the next DMA channel. In case I am not explaining this well I have attached a picture of that schematic page.
The problem is this: The buffers are 500 bytes, and since each result from the ADC is an array of two 16 bit numbers, the first byte should be the same channel in every packet, and the second byte should be the other channel. But as data is streamed the order changes randomly. I know ISOC transfers can loose data but none of the packets are marked as bad and all packets received are full sized.
- Added more DMA channels to the buffer cycle (it was only two originally)
- Used wireshark to sniff USB traffic over usbmon to eliminate the possibility of stupid mistakes in my PC app.
- Slowed down the clock triggering the ADC to 100kHz
- Made buffers on PSOC smaller (still even size of course) to not "stress" the usb bus.
I am kind of at a loss, not sure what to do or test at this point. I am new to USB but thought the PSOC was a great place to start with the great documentation and examples. I attached the project as well in case anyone is interested.