cancel
Showing results for 
Search instead for 
Did you mean: 

Read USB camera with MSC usb

PCu1
Senior

Hi,

I have a request from a client to take photos(from a camera) at a fixed time (timelapse) and send to the cloud.

My idea would be to load photos from the device via USB with an STM32.

I tried a USB example MSC Host with my STM32F746-Disco kit.

With a usb stick as a device, it works well. But nothing happens if I connect my smartphone or my own Sony camera.

I'm not sure what I should do to read the files on these devices ...

Thank you,

Pierre

5 REPLIES 5

If it's a still camera, don't want MSC (Mass Storage Class) but MTP (Media Transfer Protocol).

If it's a video camera, you are after the USB Video Class (UVC), but I don't think that's what you want.

JW

>>I'm not sure what I should do to read the files on these devices ...

Guess you're going to have to work through the mechanics of the MSC Host, and understand if you can get connectivity, where things are failing, or how much data the READ from the target actually gets you.

Check the descriptors returned by the devices that aren't working, contrast to support in the code, and the specification.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

> Check the descriptors returned by the devices

Indeed, that's where you should start, to find out what class (if any) the given device is.

Easiest is to plug it in into a PC and look at the descriptors there.

JW

PCu1
Senior

I checked the device descriptor.

They remain empty, while it is filled with USB stick.

Upstream I see that the state in USBH_Process() is in HOST_IDLE, and device_connected becomes true but the interrupt

if (__HAL_HCD_GET_FLAG (hhcd, USB_OTG_GINTSTS_DISCINT)) is true and calls the callback to force device_connected to false.

So state remains in HOST_IDLE.

I connected my Salae Logic analyser on the Bus, and surprise there is no data on it. May be it is linked with the USB micro A/B to female USB A adapter and OTG_ID net...

Pierre

PCu1
Senior

Finally I found the problem: the external power supply from my USB hub was broken. The voltage level from the PC was not enough for the camera but enough for a usb key...

Now I can read the SD flash content.

Pierre