2012-06-03 04:59 AM
Hi,
Does anybody know if there is example on STM32F2xx to support UVC class? I checked USB lib provided by STM but only similar example (Audio with ISO out) provided and I do think there should be quite some works if I port Audio project towards UVC class, as for they indeed have some differences. That would be good if you can share any idea on the implement method or materials could be shared, I appreciate it pretty much. Basically I am doing a small demo to simulate a USB Camera by STM32F2xx, a real camera is plugged to DCMI I/F. What I am facing issue is USB Part with suppporting on UVC. Thank you... #uvc #usb2012-06-12 11:06 AM
2012-06-12 11:10 AM
2012-06-12 06:00 PM
Hi chinzei.tsuneo
''Set_Interface switches the alternate streaming interface. And then, isoc IN transactions start. '' Is it ISO EP or we can use Bulk ? I always thought it it possible to use any EP2012-06-12 11:40 PM
For video streaming interface, an isoc or bulk endpoint is allowed by the UVC spec.
For isoc endpoint,1) The streaming interface should have zero-bandwidth default interface. One or more alternate interfaces are defined, for required bandwidth (wMaxPacketSize) depending on frame size/ frame rate.At the start of streaming, Set_Interface request switches from default to one of alternate. At the end of streaming, Set_Interface recovers the default interface.2) One payload transfer (payload header + its payload) per single transaction (for full-speed and non-high-bandwidth high-speed)3) The transactions in the frame gap (from the last frame end to next frame), are filled with zero-payload transfers (payload header without any payload).For bulk endpoint,1) The streaming interface doesn't have any alternate, just a default. Set_Interface isn't issued by host.2) One payload transfer is split into multiple transactions.3) The endpoint NAKs in frame gap.These two transfer types have their own pros and cons, respectively.- Bulk firmware code is simpler than isoc, at least for alternate interfaces and Set_Interface support.- For isoc, Set_Interface explicitly gives the start/stop timing of streaming.- Isoc reserves bus bandwidth at Set_Interface. Available bandwidth for bulk varies on the fly.etc.I can't tell which one is better.Tsuneo2012-06-13 08:08 AM
2012-06-13 11:51 PM
You are starting with the descriptors in ''3 Video Camera Player Example'' of USB_Video_Example 1.1.pdf
(included in UVC spec on USB.org, http://www.usb.org/developers/devclass_docs/USB_Video_Class_1_1_090711.zip)1) Simplify descriptors I recommend you to simplify the example more, for the first starting up. And then, you'll see less class requests (Get_Cur/Set_Cur etc.) Drop these optional descriptors. - Input Terminal Descriptor (Media Transport) - Selector Unit Descriptor - Standard Interrupt Endpoint Descriptor - Class-specific Interrupt Endpoint Descriptor - Class-specific Still Image Frame Descriptor - Standard Bulk Endpoint Descriptor - Standard Bulk Endpoint Descriptor (on alternate IF) Dropping these descriptors results in minor tuning of other descriptors. /* Configuration 1 */ LOBYTE(0x00d9), /* wTotalLength 109 bytes*/ <-- decrease by the size of above descs HIBYTE(0x00d9), /* Standard VC Interface Descriptor */ 0x01, /* bNumEndpoints */ <-- 0 /* VideoControl Interface Descriptor: (Header) */ LOBYTE(0x0040), /* wTotalLength */ <-- decrease by the size of Input Terminal (Media Transport) HIBYTE(0x0040), /* wTotalLength */ and Selector Unit /* Input Terminal Descriptor (Camera) */ 0x03, /* bTerminalID => ID of this input terminal */ <-- 0x01 0x00, /* bmControls => Supported controls */ 0x02, <-- 0x00 (no control) 0x00, /* Streaming Descriptor */ 0x01, /* bNumEndpoints => 1 endpoints */ <-- 0x00 (no endpoint on the default) /* Class-specific VS Header Descriptor (Input) */ 0x4C, /* wTotalLength => */ <-- decrease by the size of Still Image Frame 0x00, 0x03, /* bStillCaptureMethod=> Device supports still image capture method 3.*/ <-- 0x00 None /* Operational Alternate Setting 1 */ /* Standard VS Interface Descriptor*/ 0x02, /* bNumEndpoints => 2 endpoints */ <-- 0x01 one endpoint2) Endpoint address In this example descriptors, Video-streaming isoc IN EP is assigned to 0x85 /* Standard VS Isochronous Video Data Endpoint Descriptor */ 0x85, /* bEndpointAddress => IN endpoint 5 */ But the EP addresses on STM32F2xx is limited to 0x81, 0x82 and 0x83. Therefore, you have to change the EP address of the endpoint descriptor into one of these ones. Also, address of the VS isoc IN EP is referred in this descriptor. Change it, too. /* Class-specific VS Header Descriptor (Input) */ 0x85, /* bEndpointAddress => Address of the isochronous endpoint*/ In the convention of STM32_USB-Host-Device_Lib, the endpoint is initialized in usbd_audio_Init() (STM32_USB-Host-Device_Lib_V2.1.0\Libraries\STM32_USB_Device_Library\Class\audio\src\usbd_audio_core.c) by calling DCD_EP_Open(), if you are starting with the audio example. Tsuneo2012-07-31 07:32 AM
Hi! Now,my device has been recognized by the system and can be find as a camera in the hareware management .But when I open the device ,there is no video and with the bushound tool .I find there is only one isochronous transmation paket ,and the ,the device entered in hardwarefault,just after I enable the endpoint 1.
I have been bothered by this trouble for 2weeks ,does any one have any idea about the isochronous trans?does there any other configeration have to do before enable the endpoint 1?Here is the steps I did:
1 .configed the endpoint 1 as isochronous mode;
2.prepare the data buffer
3. In the In token interrupt service ,enable the endpoint 1 .
And then hardwarefault occurred .
2013-09-16 09:50 PM
Hi,
In USB video class demo,Class specific request is not coming. I am worikng on UVC Lib using STM32F2xx. The device gets enumerated,after running descriptor(It appears in the Device Manager as Imaging device). But No IN request comes from Host after that. Thanks & Regards Balmukund Prasad2014-08-13 11:35 AM
On Google ''STM32 uvc'', this gets the most hits, so i may as well pick it up, as i am right here.
I am not aware of any '' USB video class demo'' as mentioned in the previous post. So...I adopted the above ''Descriptor'' with its final modification and ...voila...Windows has a new Video device. Opening a Camera Application, select video device works, video-adjust options are correctly deactivated (as to the Descriptor). Windows correctly selected ''usbvideo.sys'' driver. My uvc-device gets the following Setup messages from Windows: Setup: typ:0xa1 request:129 value:256 Setup: typ:0xa1 request:129 value:512 ...several times. These are Class->Set Interface messages. So here we are trying to start the isochronous IN (INto PC) data transfer of videodata. An Endpoint of type isochronous has been opened. I am currently unclear about the isochronous transfer algorithm. The above ''Set Interface'' messages could be interpreted as ''Hey man, go ahead and start transmitting Videodata with framesize 256 or 512 bytes''. Then i am reading that on isoc-transfers each transmit shall be syncronized with the reception of an SOF frame, thus sending one 512-byte datapacket after each SOF. Maybe someone can bring some light in here. ?2014-09-17 11:40 AM