|
From: Tim R. <ti...@pr...> - 2018-11-01 16:44:08
|
zheng rong wrote: > > Are you using a Cypress FX2? > > Exactly, I am using FX2LP CY7C68013 with a CMOS camera. Why are you using libusb, instead of writing a video4linux driver that could work with all applications? > I am using Ubuntu OS on a DELL laptop workstation. > How did you fix the problem finally? We addressed it in three ways. First, my client's camera produced UYVY data, which has 2 bytes per pixel. They wanted 720x564 data, but at 720 width, the FIFOs would overflow on all but the most well-behaved systems. So, we added hardware to limit the output to 640 width. I ran a Python simulation at the microsecond level that showed that this was safe, in the absence of pathogenic behavior. Second, we added a bulk endpoint. A bulk pipe has more available bandwidth than an isoch pipe, but it is also more dependent on bus load. Note that you can do this on the fly by using a different alternate setting. Third -- the real solution -- was to spin the camera board to add a 32k external FIFO chip. > The camera in may design has resolution of 752x480. > When pixel clock is 26.6MHz, the line-valid interval A= 28.2us, > line-blank interval Q = 3.52us, shown as the above figure. > So a 125us micro-frame will cover 3.94 *(A+Q), and the device will get > 752*4=3008 bytes. It looks that this is a little dangerous, right? It's close, but it should fit. > Also, as you mentioned, if it miss one micro frame, the data will be > lost because the device buffer is not very much (4KB) to keep the data > until the next micro frame. right? It's a danger, but a small one. In the real world, isoch devices don't drop packets, unless your USB cables are poor quality. I've run cameras for days at a time and never dropped a packet. > Back to the original problem, for bulk transfer mode, increasing the > buffer size on device side can guarantee smooth data transfer. I've now forgotten your original problem. If you set up the FX2 to use quad-buffering on the bulk endpoint, you should not overrun the FIFOs unless the bus is busy. > What is the appropriate usage of isoc transfer mode? also require > increasing the device buffer? I don't understand the question. For bulk, you'd set EP2CFG to 0xE0 for quad 512-byte buffers. For isoch, you'd set EP2CFG to 0xD8, for quad 1024-byte buffers. -- Tim Roberts, ti...@pr... Providenza & Boekelheide, Inc. |