Elephantus
Junior Member level 3
cyusb
I am designing a streaming data acquisition application with the Cypress EZ-USB FX2, using CyAPI. The data is transferred from external logic via the slave FIFO interface to a quad-buffered bulk endpoint in the FX2. The PC fetches data from the FX2 using transfer prescheduling by queuing overlapped transfers (the BeginXfer-WaitXfer-FinishXfer approach as shown in the CyAPI streamer example).
The given approach should yield continuous fetching of data on the USB bus and extensive buffering is used on the PC in order to maximize stream throughput.
However,upon testing and measurements, monitoring the FLAGB (FIFO full flag) has shown that the FX2 fifo is being emptied non-continuously depending on the current CPU load. In an application which uses three parallel threads(one to fetch and pre-schedule USB data, second to receive data and trigger processing and third which simulates processing for a given duration) monitoring the FLAGB had shown that the FX2 FIFO was full(unserviced by the USB Host) for the exact duration of the simulated processing (a specified period of high CPU load). Similar results were achieved when the overall CPU load was raised using a parallel CPU-time consuming process.
Additional measurements and observation of the FLAGB behavior indicated that there is a possibility that the fetch and preschedule thread is not given sufficient CPU time, resulting in the unsufficient speed of transfer rescheduling, which empties the prescheduled transfer queue. However, increasing the buffer/transfer sizes and changing the thread priority did not eliminate the problem. For the given design, achieving the continuous data streaming is crucial due to limited buffering capabilities of the underlying hardware. The non-continuous fetching of data results in a data loss due to buffer overflow, which is unacceptable in the given design.
The questions are: is the dependency of the transfer rate on the CPU load caused by the CyAPI/CyUSB driver architecture, and is there a way to increase performance with the CyUSB driver? Could performance be increased by directly accessing the CyUSB driver via the CyIOCTL interface?
If anyone has an answer, or any other ideas about the given problem, I would appreciate any help.
I am designing a streaming data acquisition application with the Cypress EZ-USB FX2, using CyAPI. The data is transferred from external logic via the slave FIFO interface to a quad-buffered bulk endpoint in the FX2. The PC fetches data from the FX2 using transfer prescheduling by queuing overlapped transfers (the BeginXfer-WaitXfer-FinishXfer approach as shown in the CyAPI streamer example).
The given approach should yield continuous fetching of data on the USB bus and extensive buffering is used on the PC in order to maximize stream throughput.
However,upon testing and measurements, monitoring the FLAGB (FIFO full flag) has shown that the FX2 fifo is being emptied non-continuously depending on the current CPU load. In an application which uses three parallel threads(one to fetch and pre-schedule USB data, second to receive data and trigger processing and third which simulates processing for a given duration) monitoring the FLAGB had shown that the FX2 FIFO was full(unserviced by the USB Host) for the exact duration of the simulated processing (a specified period of high CPU load). Similar results were achieved when the overall CPU load was raised using a parallel CPU-time consuming process.
Additional measurements and observation of the FLAGB behavior indicated that there is a possibility that the fetch and preschedule thread is not given sufficient CPU time, resulting in the unsufficient speed of transfer rescheduling, which empties the prescheduled transfer queue. However, increasing the buffer/transfer sizes and changing the thread priority did not eliminate the problem. For the given design, achieving the continuous data streaming is crucial due to limited buffering capabilities of the underlying hardware. The non-continuous fetching of data results in a data loss due to buffer overflow, which is unacceptable in the given design.
The questions are: is the dependency of the transfer rate on the CPU load caused by the CyAPI/CyUSB driver architecture, and is there a way to increase performance with the CyUSB driver? Could performance be increased by directly accessing the CyUSB driver via the CyIOCTL interface?
If anyone has an answer, or any other ideas about the given problem, I would appreciate any help.