...
Note | |||||
---|---|---|---|---|---|
| |||||
If the EP6's buffer is not is not properly written by the FPGA(reference design)/other(custom design) the EP6's buffer will become empty and the host computer will be no longer able to receive further packets. In this case the TE_USB_FX2_GetData() function could experience strange behaviors. For example, a very low throughput (9-10 Mbyte/s even if a 31-38 Mbyte/s are expected) could be measured or the function TE_USB_FX2_GetData() fails returning false. During USB read transmission test (RX: host computer perspective) the EP6's buffer writing is carried out by MicroBlaze (inside the FPGA); this behavior is setted by MicroBlaze API command FX22MB_REG0_START_TX (TX: USB FX2 microcontroller perspective)
|
...
TE_USB_FX2_GetData() seems unable to use too large arrays or, more precisely, this fact seems variable by changing host computer. To be safe, do not try to transfer in a single packet very large data (e.g. 120 millions of byte); transfer the same data with many packets instead (1,200 packets * 100,000 byte) and copy the data in a single large data array if necessary (with Buffer.BlockCopy()).
Note |
---|
...
This function returns true if it is able to receive the data from buffer EP6 within Timeout milliseconds. This function returns false otherwise.
Code Block | ||
---|---|---|
| ||
PACKETLENGTH=100000; packets=1200; byte[] data = new byte[packetlen*packets]; byte[] buffer = new byte[packetlen]; for (int i = 0; i < packets; i++) { TE_USB_FX2_GetData(ref TE_USB_FX2_USBDevice, ref buffer, ref packetlen, PI_EP6, TIMEOUT_MS,BUFFER_SIZE) Buffer. |
...
BlockCopy(buffer, 0, data, total_cnt, packetlen);
total_cnt += packetlen;
} |
Code Block | ||||
---|---|---|---|---|
| ||||
PACKETLENGTH=100000;
packets=1200;
byte[] data = new byte[packetlen*packets];
byte[] buffer = new byte[packetlen];
//starts test: the FPGA start to write data in the buffer EP6 of FX2 chip
SendFPGAcommand(ref TE_USB_FX2_USBDevice, MB_Commands.FX22MB_REG0_START_TX, TIMEOUT_MS);
test_cnt = 0;
total_cnt = 0;
for (int i = 0; i < packets; i++)
{
//buffer = &data[total_cnt];
packetlen = PACKETLENGTH;
//fixed (byte* buffer = &data[total_cnt])
bResultXfer = TE_USB_FX2.TE_USB_FX2.TE_USB_FX2_GetData(ref TE_USB_FX2_USBDevice, ref buffer, ref packetlen, PI_EP6, TIMEOUT_MS,BUFFER_SIZE);
Buffer.BlockCopy(buffer, 0, data, total_cnt, packetlen);
if (bResultXfer == false)
{
//cout << "ERROR" << endl;
Console.WriteLine("Error Get Data");
SendFPGAcommand(ref TE_USB_FX2_USBDevice, MB_Commands.FX22MB_REG0_STOP, TIMEOUT_MS);
return;
}
total_cnt += packetlen;
}
//stop test: the FPGA start to write data in the buffer EP6 of FX2 chip
SendFPGAcommand(ref TE_USB_FX2_USBDevice,
MB_Commands.FX22MB_REG0_STOP, TIMEOUT_MS) |
...