Stereopi v2 as usb device

SLP v2 RaspiOS image discussion
Post Reply
anu1905
Posts: 2
Joined: Sun Nov 07, 2021 2:11 pm

Stereopi v2 as usb device

Post by anu1905 »

Hello, I would like to use my Stereopi v2 (with CM4) as a USB device. I'm a macOS user and I need the stereopi to be recognized on my MacBook as a webcam. Could someone guide and/or provide instructions? Thanks!

User avatar
Realizator
Site Admin
Posts: 854
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: Stereopi v2 as usb device

Post by Realizator »

Hello anu1905,
To say briefly you have two ways:
1. The simplest one - use HDMI->USB adaptor
In this case, the HDMI capture device (like this one) captures the StereoPi HDMI output. So this device is visible as a web camera. No settings, no tricks.
2. The most difficult - use USB gadget mode
You can force StereoP to use a USB C port in client mode. And StereoPi can act as a USB device - for example, Ethernet card, storage, etc. For example, in this article, you can find a way to use a USB connection as a network (it's for V1, but applicable to V2 too).
But webcam mode is a challenging feature. All known software realizations are unstable and tricky. The most stable realization is described here by Jeff Geerling, but it is for the single camera only.

I know StereoPi v2 is used in USB mode in some advanced projects. But in those cases, it uses a USB connection as a network to pass through the video stream to the host PC, with appropriate receiving part at the Big Brother.

So, if you want to use it in "just works" mode - use the HDMI-USB capture device.
Eugene a.k.a. Realizator

anu1905
Posts: 2
Joined: Sun Nov 07, 2021 2:11 pm

Re: Stereopi v2 as usb device

Post by anu1905 »

The HDMI--USB video capture device worked like a charm! Thank you so much!

asdf
Posts: 4
Joined: Mon May 30, 2022 3:51 pm

Re: Stereopi v2 as usb device

Post by asdf »

I did as described in the article and I cannot make it work, at least with the Stereopi v2. The device does not show up on my host computer. I have tried powering it from one of the usb-a ports in my computer and also from the usb-c one. Is there a problem with the v2?

My /boot/config.txt file is:

Code: Select all

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d
dtoverlay=dwc2,dr_mode=host
start_x=1
gpu_mem=512
dtoverlay=dwc2,dr_mode=peripheral
and my /boot/cmdline.txt is

Code: Select all

console=serial0,115200 console=tty1 root=PARTUUID=cecda96b-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles modules-load=dwc2,g_ether

stereomaton
Posts: 212
Joined: Tue May 21, 2019 12:33 pm
Location: France

Re: Stereopi v2 as usb device

Post by stereomaton »

The article was written for v0.9, I do not have a v2 and thus I did not examine the differences.

You may look at dmesg command to see if the kennel emits an error message about it.

By the way, I see in your config.txt that you set both dr_mode=host and peripheral which could likely be a problem.
Stereophotographer and hacker
Despite my quite active participation in the forum, I am not in the StereoPi team
StereoPi (v1) Standard Edition + CM3Lite module + a few cameras

asdf
Posts: 4
Joined: Mon May 30, 2022 3:51 pm

Re: Stereopi v2 as usb device

Post by asdf »

Found it! As it turns out, I had to connect the usb_cli jumper in the stereopi, which I learned is necessary from this article.

Post Reply