Giter Site home page Giter Site logo

iliasam / stm32_host_uvc_camera Goto Github PK

View Code? Open in Web Editor NEW
136.0 13.0 64.0 2.32 MB

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

License: GNU Lesser General Public License v3.0

C 99.04% Batchfile 0.03% Assembly 0.92%
stm32 usb host uvc camera

stm32_host_uvc_camera's Introduction

stm32_host_uvc_example

Example of connecting USB Web camera to STM32F4
Article in Russian: http://we.easyelectronics.ru/STM32/zahvat-izobrazheniya-s-usb-kamery-pri-pomoschi-stm32.html
Video:
https://youtu.be/qacLZCAig08

  • "stm32F429_project"
    Hardware: Core429I devboard + custom devboard with R-2R VGA DAC, USB type A connector, SDCard and camera connectors:
    Alt text

Custom devboard schematic: https://github.com/iliasam/stm32f429_vga_examples/tree/master/schematic
USB camera is connected to the USB Host of the STM32F429 MCU; and picture from is displayed at the VGA monitor.
USB host is working in Full Speed mode (FS). As I found, some USB cameras not working in this mode.
Logitech C100 is working well - in YUY2 and MJPEG mode. Maximum resolution of this camera is 640x480 in MJPEG mode.

Working board:
Alt text

  • "stm32F4_discovery_project"
    Simple example for STM32F4-Discovery. Just save one captured frame to the PC (using IAR).

stm32_host_uvc_camera's People

Contributors

iliasam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stm32_host_uvc_camera's Issues

JDR_FMT1 : Data format error. The input JPEG data can be collapted.

Hello,
First of all thanks for the UVC it helps a lot.

I worked on YUV2 succesfully but when i turn to MJPEG format i got some error which is like JDR_FMT1 : Data format error. The input JPEG data can be collapted. Have you met this kind of error before ? if you met , im wondering how you overcome for this stiuation.

PS: MJPEG is working there is no problem, im getting the frames and displaying on the screen but the images are shaking and corrupted because of the decomp JDR_FMT1 error.

Some of the problems

If I'm USB_SUBCLASS_VIDEOCONTROL device,And then why we go through USBH_VIDEO_FindStreamingIN(phost) change USB_SUBCLASS_VIDEOSTREAMING device!Why use USB_SUBCLASS_VIDEOSTREAMING this way instead of USB_SUBCLASS_VIDEOCONTROL

1

please tell me what is your version of IAR?

Need to compile for STM32 Cube IDE

Hello,

I have tried to include and compile for STM32 Cube IDE successfully with some chances into reference example code.

But facing issue like not getting any USB Event even after connecting any USB Camera.

So, Does anyone has tried with STM32 Cube IDE to compile and test it successfully with any USB camera? If yes then let me know

Regards,
Ritesh Prajapati

USBH_LL_GetLastXferSize returns 0.

Hi. Lemme start by saying "thank you", for posting this great example. I've used it to succesfully open a webcam.
However, on USBH_VIDEO_InputStream
volatile uint32_t rxlen = USBH_LL_GetLastXferSize(phost, VIDEO_Handle->camera.Pipe);//Return the last transfered packet size. always returns 0.
After reading your articles (those linked by you - thank god for google translate), I understood that this might be caused by the usb FIFO size. I changed the value up to 256, however I can't seem to get any data. Always rxlen 0.
I'm trying to get 640x480 frames (fps does not matter), and the endpoint im using is 1022 bytes long.
PS: I'm not trying to send the frames over to the PC or store them or whatever. Just getting the packets would be perfect. Any kind of help would be greatly appreciated!

STM32H7

Hi, I am trying to port this project to an STM32H7. What files are specific to the STM32F4 and need modification in order to use in STM32H7?

The discovery project can not go into USBH_VIDEO_Process()

I connect the usb camera(which can work ok on my computer) to my STM32F407 borad,and run the discorery project,I find that
the program can not go into USBH_VIDEO_Process(&hUsbHostFS) in USB_HOST_fast_class_call(),I find that the hUsbHostFS.gState = HOST_ABORT_STATE.I don't know the reason.Can you help me?
void USB_HOST_fast_class_call(void)
{
if (hUsbHostFS.gState == HOST_CLASS)
{
USBH_VIDEO_Process(&hUsbHostFS);
}
}

TEST: Porting to STM32F779

Hi iliasam,
just now thanks for your project...
during my porting I meet some diffilculty, but still now I can't understard what is exactly the problem... maybe you can easly found the mistake.

##My Configuration:##
HW:

  • Custom board with STM32F779;
  • External RAM;
  • LCD connected by LTCD->DSI->LVDS_converter;
  • USB CAM Logitech V-U0013 (should be the same you use for your tests);
    SW:
  • ARM-GCC compiler;
  • makefile;

##Project changes##

  • Adapt pinout to my board;
  • Add DSI + LVDS converter startup;
  • ADD F7 HAL (release 1.17.0 - last one);
  • Patch "usb_host.c" generated by CubeMX with changes in your sources;
  • Patch "stm32f4xx_ll_usb.c" by Lib with changes in your sources;
  • NO Patch "stm32f4xx_hal_hcd" in Lib: (hhcd->hc[ch_num].ep_type == EP_TYPE_ISOC)) fix already present in the HAL version!

##ISSUES:##

  • I need to change
    usbh_video.c = if ((ep_size > ep_size_in) && (ep_size < UVC_RX_FIFO_SIZE_LIMIT)) -> if ((ep_size > ep_size_in) && (ep_size <= UVC_RX_FIFO_SIZE_LIMIT)) : "ep_size" for my CAM is always 1024!!!
    (Have_ you ever notice this _problem???)
  • The uvc_prev_packet_eof never goes to 1: condition if (tmp_packet_framebuffer[UVC_HEADER_BIT_FIELD_POS] & UVC_HEADER_EOF_BIT) never happend.

Many thanks again for your project.
Andrea

移植工程运行不正常

你好,
你的工程在我的开发板上能够正常运行,然后我根据你的文件自己创建的时候, usb 摄像头则一直无法工作。
以下 10 个文件是直接从你工程里复制出来的
main.c
usbh_host.c
usbh_config.c
usbh_core.c
usbh_ctlreq.c
usbh_ioreq.c
usbh_pipes.c
usbh_video.c
usbh_video_desc_parsing.c
usbh_video_stream_parsing.c
我是使用 STM32CUBEMX 自动创建的工程。
请问是不是还有哪里需要修改的呀,谢谢

Camera does not return data

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.