USB superspeed peripherals Forum Discussions
Hi,
FX3 Control IN request fails when the response size is:
- multilpe of the packet size (64, 128, 192.. for HS, 512, 1024, 1536.. for SS)
- smaller than wLength (if response size equals wLength, no problems occur)
The error occurs in PC side (ex, Control Center shows error 997)
but in the firmware side, CyU3PUsbSendEP0Data() returns no error.
I guess, in this situation, the last ZLP may be lost.
In Setup Request callback, calling additional CyU3PUsbSendEP0Data() with 0 bytes length
hides this problem, like this:
CyU3PUsbSendEP0Data( bytes, buf );
if( (bytes % glPacketSize) == 0 )
CyU3PUsbSendEP0Data(0, buf);
This workaround code is Appropriate?
I attach test project.
This firmware accepts Vendor-IN Request, and response [wValue] bytes.
If wIndex is 1, the workaround is enabled.
Regards.
Show LessFrom the forum, I found that there are a lot of post disscuss the AN75779 sample. But when I search the sdk folder , there are no AN75779 sample code , and from "http://www.cypress.com/?rID=57990" (related files ) I also can not find the sample .
There are only two samples about uvc "usbvideoclass" and "usbbulkvideoclass" . And from AN75779 , there is a file named "uvc.c ", but there are no files named uvc.c. Ago I think that the AN75779 should be developed by developers, but from forum, it seems that Cypress offer the source code .
Is the sample free?? if free how can I get it? thanks!
Show LessHi!
I've build an application in C# wich takes data from a Spartan6 FPGA and put them into a txt file.
I am testing the slave fifo interface (32 bit).
While the Streamer shows a bitrate of 180MB/s, the actual transfer rate is around 8MB/s.
This is the C# code of Streamer that show the bitrate:
public unsafe void XferData(byte[][] cBufs, byte[][] xBufs, byte[][] oLaps, ISO_PKT_INFO[][] pktsInfo)
{
int k = 0;
int len = 0;
Successes = 0;
Failures = 0;
XferBytes = 0;
t1 = DateTime.Now;
for (; bRunning; )
{
// WaitForXfer
fixed (byte* tmpOvlap = oLaps
{
OVERLAPPED* ovLapStatus = (OVERLAPPED*)tmpOvlap;
if (!EndPoint.WaitForXfer(ovLapStatus->hEvent, 500))
{
EndPoint.Abort();
PInvoke.WaitForSingleObject(ovLapStatus->hEvent, 500);
}
}
if (EndPoint.Attributes == 1)
{
CyIsocEndPoint isoc = EndPoint as CyIsocEndPoint;
// FinishDataXfer
if (isoc.FinishDataXfer(ref cBufs
{
ISO_PKT_INFO[] pkts = pktsInfo
for (int j = 0; j < PPX; j++)
{
if (pkts
{
XferBytes += pkts
Successes++;
}
else
Failures++;
pkts
}
}
else
Failures++;
}
else
{
// FinishDataXfer
if (EndPoint.FinishDataXfer(ref cBufs
{
XferBytes += len;
Successes++;
}
else
Failures++;
}
k++;
if (k == QueueSz) // Only update displayed stats once each time through the queue
{
k = 0;
t2 = DateTime.Now;
elapsed = t2 - t1;
xferRate = (long)(XferBytes / elapsed.TotalMilliseconds);
xferRate = xferRate / (int)100 * (int)100;
// Call StatusUpdate() in the main thread
this.Invoke(updateUI);
// For small QueueSz or PPX, the loop is too tight for UI thread to ever get service.
// Without this, app hangs in those scenarios.
Thread.Sleep(1);
}
// Re-submit this buffer into the queue
len = BufSz;
EndPoint.BeginDataXfer(ref cBufs
} // End infinite loop
}
And this is the code that I use to write into file:
public unsafe void WriteToFileThread()
{
int bytes = 16384;
byte[] buffer = new byte[bytes];
bool bXferCompleted = false;
bool IsPkt = false;
CyBulkEndPoint bulkEpt = EndPoint as CyBulkEndPoint;
if (bulkEpt != null)
bXferCompleted = bulkEpt.XferData(ref buffer, ref bytes, IsPkt);
try
{
while(true)
WriteXferData(buffer, bytes, bXferCompleted);
}
catch (NullReferenceException e)
{
e.GetBaseException();
this.Invoke(handleException);
}
}
What is the problem?
Thank you!
Show LessHi!
I am trying to create a C# application that saves data into a text file when the fx3 is interfacing with a FPGA.
Using the XferData function from CyUSB.dll, i can only get transfer rates less then 10MB/s (saving into SSD) while your Streamer application show a throughput around 180MB/s.
What is wrong?
Thank you!
Show LessI was reading some documentation and found a piece of material similar to what I need,
it's a bitbang implementation for the FX2.
I have the FX3 development kit. what kind of differences should I expect ?
I am new to this, I would really appreciate your help
Show LessHello,
I am new to this environment and recently ordered the Cypress EZ-USB FX3 development kit.
My goal is to use this test board in order to do spi writes to another device.
How can I start ?
I have read all the documentation and little project USBBluk loop auto, but the SPI projects seem to work differently.
I have tried just compiling it and loading it on the board with the same steps, it just hangs at "Programming of SPI Flash in progress".
Is there a library of functions I could use to write my own DLL for example ?
I was trying to find more documentation or guides on the SPI bus, but returned empty handed.
I would really appreciate any help or advice,
regards
Show Less#define VIDEO_LINE_DATA_WIDTH (8272) #define VIDEO_DMA_BUFFER_COUNT (2) #define USB3_MAX_BURST (1) /* was (8) */ /* set up an auto many-to-one DMA channel to send the UVC video stream */ CyU3PMemSet((uint8_t *)&mdmaCfg, 0, sizeof(mdmaCfg)); mdmaCfg.size = VIDEO_LINE_DATA_WIDTH + 16; mdmaCfg.count = VIDEO_DMA_BUFFER_COUNT * USB3_MAX_BURST; mdmaCfg.prodSckId[0] = CY_U3P_PIB_SOCKET_0; mdmaCfg.prodSckId[1] = CY_U3P_PIB_SOCKET_1; mdmaCfg.prodHeader = 12; mdmaCfg.prodFooter = 4; mdmaCfg.consSckId[0] = CY_U3P_UIB_SOCKET_CONS_0 | USB_EP_VIDEO_CONS_SOCKET; mdmaCfg.validSckCount = 2; mdmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE; mdmaCfg.notification = CY_U3P_DMA_CB_CONS_EVENT | CY_U3P_DMA_CB_ERROR; mdmaCfg.cb = mdma_cb; cli_dprintf(1, "Attempting to allocate %d %d-byte buffers (%d KB total) for DMA...\n", mdmaCfg.count, mdmaCfg.size, mdmaCfg.count * mdmaCfg.size / 1024); apiRetStatus = CyU3PDmaMultiChannelCreate(&dch_video, CY_U3P_DMA_TYPE_MANUAL_MANY_TO_ONE, &mdmaCfg); if (apiRetStatus != CY_U3P_SUCCESS) { cli_dprintf(1, "could not create video DMA channel (%d)\n", apiRetStatus); CyFxAppErrorHandler(apiRetStatus); }The multi channel DMA creation is successful. With the values above I should have 4 8284 byte buffers, each with room for a 12 byte header and 4 byte footer to maintain the necessary alignment. The main loop looks like this:
status = CyU3PDmaMultiChannelGetBuffer(&dch_video, &dmabuf, CYU3P_NO_WAIT); if (status == CY_U3P_SUCCESS) { /* replace DMA data here, see comment below */ len = sizeof(uvc_header); if (dmabuf.count == VIDEO_LINE_DATA_WIDTH) { uvc_add_header(dmabuf.buffer - len, CyFalse); } else { uvc_add_header(dmabuf.buffer - len, CyTrue); gotPartial = CyFalse; } if (status != lastgetbufferstatus) { cli_dprintf(1, "getbuffer change: 0x%x -> 0x%x\n", lastgetbufferstatus, status); lastgetbufferstatus = status; } status = CyU3PDmaMultiChannelCommitBuffer(&dch_video, dmabuf.count + len, 0); if (status == CY_U3P_SUCCESS) { ++tx_count; } if (status != lastcommitstatus) { cli_dprintf(1, "commitbuffer change: 0x%x -> 0x%x\n", lastcommitstatus, status); lastcommitstatus = status; } } /* if everything produced has been consumed, restart DMA */ if (hitFV && tx_count == rx_count && ! gotPartial) { tx_count = rx_count = 0; hitFV = CyFalse; uvc_header[1] ^= UVC_HEADER_FRAME_ID; CyU3PDmaMultiChannelReset(&dch_video); CyU3PDmaMultiChannelSetXfer(&dch_video, 0, 0); }As you can see I only ever call CyU3PDmaMultiChannelCommitBuffer() if I was able to successfully get the DMA buffer with CyU3PDmaMultiChannelGetBuffer(). My GPIF-II data is bursty so I expect that there will be considerable time when there is no GPIF data available. However, CyU3PDmaMultiChannelGetBuffer() would not give me a success return code unless there was a buffer available. What exactly does the status CY_U3P_ERROR_INVALID_SEQUENCE mean in this scenario? I get it once every 5 or 6 DMA transfers, and can go long (hundreds of transfers) times without any error. It does not appear to be a fatal error, as I do get the correct amount of data on the PC. Unfortunately the actual data values received from the GPIF-II interface are corrupt. I know that the USB transfer is fine because if I replace the contents of the DMA buffer with known data at the /* replace DMA data here */ comment above I receive the known data correctly on the PC. What causes this error, what is the correct way to recover from it and how can I prevent it from occurring? Show Less
The programmer manual, lists (7.1.3 cyfxbulklpmanual – MANUAL Channel) as an example. I can not find it anywhere. Can you give me a link to the examples listed in the programmers manual?
Show Less