iliasam / STM32_HOST_UVC_Camera

Example of connecting USB Web camera to STM32F4 USB HOST

Home Page:http://we.easyelectronics.ru/STM32/zahvat-izobrazheniya-s-usb-kamery-pri-pomoschi-stm32.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Camera does not return data

shangchenghao opened this issue · comments

hello ,I transplanted your project. My camera can be recognized and configured successfully, but there is no data output.
Stuck here

case VIDEO_STATE_DATA_IN:
  
  result = USBH_LL_GetURBState(phost, VIDEO_Handle->camera.Pipe);
  if((result == USBH_URB_DONE) && ((phost->Timer - VIDEO_Handle->camera.timer) >= VIDEO_Handle->camera.Poll))
  {
    VIDEO_Handle->camera.timer = phost->Timer;
     rxlen = USBH_LL_GetLastXferSize(phost, VIDEO_Handle->camera.Pipe);//Return the last transfered packet size.
    video_stream_process_packet((uint16_t)rxlen);
      
    USBH_IsocReceiveData(phost,
                        (uint8_t*)tmp_packet_framebuffer,
                        VIDEO_Handle->camera.EpSize,
                        VIDEO_Handle->camera.Pipe);
  }

The value of result has always been VIDEO_STATE_IDLE

Hello. What do you mean by "transplanted your project"?
Are you sure that your camera can work in Full-Speed mode?
Are you sure that your camera supports YUY2 or MJPEG modes in Full-Speed mode?
The best way to check it - is to connect camera to the PC with USB forced to Full-Speed mode and see USB descriptors.

Thank you very much for your reply,The following is the log printed by serial port,

image
73fb0c7abdc685238de0cf575044def

OK, looks like camera say, that it is supporting certain video modes, but I have seen cameras that do not send video data is Full Speed mode (but they where sending good descriptors). So it would be useful to check it at the PC - so you would need to switch USB of the PC to Full Speed mode.

hello ,I transplanted your project. My camera can be recognized and configured successfully, but there is no data output. Stuck here

case VIDEO_STATE_DATA_IN:
  
  result = USBH_LL_GetURBState(phost, VIDEO_Handle->camera.Pipe);
  if((result == USBH_URB_DONE) && ((phost->Timer - VIDEO_Handle->camera.timer) >= VIDEO_Handle->camera.Poll))
  {
    VIDEO_Handle->camera.timer = phost->Timer;
     rxlen = USBH_LL_GetLastXferSize(phost, VIDEO_Handle->camera.Pipe);//Return the last transfered packet size.
    video_stream_process_packet((uint16_t)rxlen);
      
    USBH_IsocReceiveData(phost,
                        (uint8_t*)tmp_packet_framebuffer,
                        VIDEO_Handle->camera.EpSize,
                        VIDEO_Handle->camera.Pipe);
  }

The value of result has always been VIDEO_STATE_IDLE

你好,我也用的这个开发板,可以直接在rgb LCD 屏上显示吗?我的没有屏幕没有视频出现

Thank you very much for your reply,The following is the log printed by serial port,

image 73fb0c7abdc685238de0cf575044def

could you share your whole project with me?please 544801730@qq.com.thank you

Hi, I have the same problem as you. I was able to enumerate my UVC device successfully, but I can't get to the interrupt once I start reading data. As per the answer, how to force USB into full speed mode on PC.

Snipaste_2024-04-16_17-53-28

Snipaste_2024-04-16_17-58-49

Another problem is that the descriptor information I read with the microcontroller is not the same as what I recognize with the USB Device Tree Viewer software. The total length of the configuration descriptor read by the microcontroller is 0x145 bytes, while the USB Device Tree Viewer recognizes it as 0x2DF bytes.

"As per the answer, how to force USB into full speed mode on PC."
I know only one way - to select Full Speed in BIOS (if is is supported).
Device will dive different descriptors for FS and HS devices.

"As per the answer, how to force USB into full speed mode on PC."“根据答案,如何在PC上强制USB进入全速模式。” I know only one way - to select Full Speed in BIOS (if is is supported).我只知道一种方法 - 在 BIOS 中选择全速(如果支持)。 Device will dive different descriptors for FS and HS devices.设备将为 FS 和 HS 设备潜入不同的描述符。

Thank you for your answer. I'm guessing my problem is caused by the UVC device not supporting full speed mode. But basically all UVC devices you can buy nowadays run high speed mode. Can you recommend a UVC device that runs in full speed mode?

See: LINK

See: LINK

I purchased the Microsoft HD-3000 camera. Now there is no problem with descriptor analysis and adjusting the camera settings, but it is not possible to open the interface to start data transfer using the USBH_SetInterface() function. Do you have a good solution for this please?

Sorry I don't know. I have not worked with cameras for a long time.