2023-05-11 05:46 AM
Hello everyone
Does anyone have example code for Azure RTOS USBX device class video (UVC)?
I was able to add Video to my USBX demo application on Nucleo H7A3
There was sample code for CDC_ACM and MSC (mass storage), this worked fine. But for device class video, I was not able to find any example code.
CubeIDE 1.12.1 generated two files
ux_device_video.c
ux_device_video.h
But both files only contain prototypes of callback functions which need to be filled
Like this:
/**
* @brief USBD_VIDEO_StreamRequest
* This function is invoked to manage the UVC class requests.
* @param video_stream: Pointer to video class stream instance.
* @param transfer: Pointer to the transfer request.
* @retval status
*/
UINT USBD_VIDEO_StreamRequest(UX_DEVICE_CLASS_VIDEO_STREAM *video_stream,
UX_SLAVE_TRANSFER *transfer)
{
UINT status = UX_SUCCESS;
/* USER CODE BEGIN USBD_VIDEO_StreamRequest */
UX_PARAMETER_NOT_USED(video_stream);
UX_PARAMETER_NOT_USED(transfer);
/* USER CODE END USBD_VIDEO_StreamRequest */
return status;
}
How to fill it, that it works?
Thanks
Johannes
Solved! Go to Solution.
2023-05-31 08:13 AM
Hi Johannes,
It's mentioned in readme file
if you you open ioc of application (download https://www.st.com/en/embedded-software/x-cube-azrtos-h7.html) change VIDEO_STREAMING_FORMAT to MJPEG and change video width and height finally generate code and include stream2.h in project instead of stream1.h
- stream2 FORMAT : UNCOMPRESSED and Width = 176, Height = 144 and the descriptor shall be updated.
2023-05-11 05:49 AM
2023-05-11 08:29 AM
Hi @Johannes ,
Please refer to this example application with STM32H723-Nucleo:
2023-05-12
12:58 AM
- last edited on
2023-12-06
05:13 AM
by
Laurids_PETERSE
Hello Mohamed
Thanky you very much (I could have found this myself, silly me)
Unfortunately I have additional problems
Windows is still complaining, that the camera cannot be started.
It complains about a wrong parameter being transmitted
Code 0x0A Status 0xC000000D
Do you have an idea, what the problem might be?
I must admit, that I haven't run the exact example,
I checked the file usb descriptors and they look the same. (i am using endpoin 0x84 for video)
Thank you .
Johannes
2023-05-12 01:54 AM
Hi @Johannes can you please share with an usb trace of your device enumeration, or you can port Ux_Device_Video with STM32H7A3-Nucleo to ensure that it work and then intergrate it in your application.
2023-05-12 06:31 AM - edited 2023-11-20 05:41 AM
Hello Mohamed
Good news: I was able to make the USB Device Video example run.
But I needed to strip my demo code down to a single endpoint USB device.
Strangely: If the device endpoint address is less than 0x83 for video, the camera app on windows does not show the video, just a black screen.
If the endpoint is 0x83 or higher, The camera app shows the demo video.
As soon as I make the device a compound device by adding MSC storage, windows is complaining about the wrong parameter for the USB camera.
I have a wireshark USB trace. There are multiple strange packets:
And a malformed packet
The rest of the packets are related to MSC storage, i think
2023-05-12 06:37 AM - edited 2023-11-20 05:41 AM
2023-05-12 06:54 AM
@Johannes if you modifie device descriptor you need to modifie PID (Product ID)
2023-05-12 07:36 AM
@mohamed.ayed Change the PID to what?
If I change the PID from e.g. 0x5710 to 0x5711, windows re-installes the drivers. But the malformed package is still there.
2023-05-12 07:41 AM - edited 2023-11-20 05:42 AM
If a package is "ok", this seems to be the position is the lengh information of the payload
bLengh = 4, 1 byte "bDescriptor type" and 2 bytes payload = 4 bytes.
In the malformed package
bLength = 4, but only the bDescriptor is following and 2 bytes are missing