cancel
Showing results for 
Search instead for 
Did you mean: 

Example for Azure RTOS USBX device video (UVC)

Johannes
Senior

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

23 REPLIES 23
Johannes
Senior

Thank you mohamed. That was helpful. I was able to build my own video.

Is there an example project to use an uncompressed video stream?

CubeIDE allows for a setting "uncompressed"


_legacyfs_online_stmicro_images_0693W00000blF08QAE.png 

is there an example for that?

mohamed.ayed
ST Employee

Hi Johannes,

It's mentioned in readme file

https://github.com/STMicroelectronics/x-cube-azrtos-h7/blob/main/Projects/NUCLEO-H723ZG/Applications/USBX/Ux_Device_Video/README.md

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.

Johannes
Senior

Hello muhamad

Sorry, but I am still confused.

Stream2.h is an uncompressed stream. You say; i still should set the stream format to MJPEG?

I used MJPEG for "stream1.h" (compressed stream) This works.

For stream2.h don't I need to switch to "uncompressed"?

What about all the other parameters for the stream of "stream2.h"?

Bits per Pixel?

Format YUV2 or NV12?

Color Primaire?

TRF Characteristics?

Matrix Coefficients?


_legacyfs_online_stmicro_images_0693W00000blINPQA2.png 

Thanky you very much for your help

Johannes

Johannes
Senior

Hello Mohamed

Can you explain how the uncompressed video stream is composed? Are these individual images as well? Which format are they and how are they generated?

Johannes