AlexisAtWork
Posts: 2
Joined: Wed Feb 01, 2017 4:54 pm

CM3 and usb gadgets (DWC2)

Wed Feb 01, 2017 5:14 pm

Hi,
I've got a Compute module 3 that I'm trying to get going as a USB gadget. Right now, I have the kernel build, the modules load, tons of debug information spitting out, but my computer doesn't see any devices (right now set for CDC_ACM) I have a hunch I am missing something small that I overlooked. I think the problem boils down to these lines in the syslog:

Nov 25 18:17:09 raspberrypi kernel: [ 0.631633] dwc2 3f980000.usb: complete: ep b9bd6810 ep0, req b9be5f40, -104 => 803fb3a0
Nov 25 18:17:09 raspberrypi kernel: [ 0.631648] dwc2 3f980000.usb: dwc2_hsotg_complete_setup: failed -104


shortly after that, it suspends it. am I missing a jumper or something?

Edit: pastbin link of full syslog: http://pastebin.com/ZXjQDL5r
Last edited by AlexisAtWork on Wed Feb 01, 2017 6:25 pm, edited 1 time in total.

gregeric
Posts: 1509
Joined: Mon Nov 28, 2011 10:08 am

Re: CM3 and usb gadgets (DWC2)

Wed Feb 01, 2017 6:24 pm

There's a resistor on the CMIO pulling USB_OTGID low (forcing host mode). Have you installed a jumper cable from USB_OTGID to 3V3, so as to switch to gadget mode?

AlexisAtWork
Posts: 2
Joined: Wed Feb 01, 2017 4:54 pm

Re: CM3 and usb gadgets (DWC2)

Wed Feb 01, 2017 6:28 pm

That's exactly what I missed. Thanks!

sp01109
Posts: 5
Joined: Fri Mar 31, 2017 4:17 am

Re: CM3 and usb gadgets (DWC2)

Fri Mar 31, 2017 4:37 am

AlexisAtWork wrote:That's exactly what I missed. Thanks!
Hi Alexis,

I am recently trying to use USB gadgets and set it as g_ether on CM3. I follow the way how people do on Pi Zero which has following steps:
  • 1. add dtoverlay=dwc2 into /boot/config.txt file
    2. add dwc2 g_ether into /etc/modules
    3. jump USB_OTGID pin to 3V3 on CMIO board as Gregeric mentioned
However, I still cannot make it work. Am I missing something?
Could you share the magic you performed on CM3 to make USB gadgets work?

Thanks a lot!

Raspiator
Posts: 4
Joined: Thu Nov 17, 2016 6:37 pm

Re: CM3 and usb gadgets (DWC2)

Thu Dec 21, 2017 7:37 am

I flash my "compute modul 3, Version V1.0 2015" with the image "raspbian strech lite". I do update and upgrade and it runs perfectly. Then I add the line "dtoverlay=dwc2" to "config.txt", and by doing so and reboot, the host connection is gone, the USB keyboard does no longer work. Even if I add dwc2 and g_ether in /etc/momdules there is no USB g_ether, the modul is in no way reachable (I have to start the bootloader and remove the "dtoverlay=dwc2" line in the config.txt file, then I can access again the CM3 via USB keyboard).

(I know about the OTG USB jumper...)

I dont have this when I flash the compute modul 1 with the same OS "raspbian stretch lite", there I can establish the g_ether usb.

Question 1: Is there anybody having the same trouble with CM3?
Question 2: Any idea, do I miss something else?

TurquoiseBlue
Posts: 4
Joined: Wed Dec 13, 2017 3:05 am

Re: CM3 and usb gadgets (DWC2)

Mon Dec 25, 2017 3:28 am

I've had the same problem -- I haven't been able to get the g_ether to work. I've recompiled and use Raspbian to no avail. Perhaps an old version of Raspbian might work? I haven't tested this yet, though.

And regarding the USB Keyboard -- IIRC the Compute Module can't be both a gadget *and* a host, since it only has one USB interface. So, keyboards/mice won't really work in gadget mode. (I just use a TTL <--> USB cable to connect to my compute module when trying to get DWC2 to work).

Raspiator
Posts: 4
Joined: Thu Nov 17, 2016 6:37 pm

Re: CM3 and usb gadgets (DWC2)

Tue Jan 02, 2018 3:05 pm

Agreed, device and host the same time can not work. There is this silicon switch on the "motherboard", it multiplexes the host and device mode according to the detected VBUS (of the host notebook) when plugging the notebook.

But with CM1: The moment I unplugged the CM1 in device mode from my notebook (with the USB keyboard still connected), with no further change the keyboard was detected by Linux and made available again, and when I reconnect my notebook, the CM1 was recognized as a device again though because of the USB multiplexer the keyboard was gone of course.

For me there is a different behavior between the CM1 and CM3, when doing the same steps as described in my first post. And this behavior for me is crucial, because not only the USB gadget does not work, even the "normal" USB host connector is broken somehow when adding dwc2 in the config.txt .. :?

I wonder how people were able to launch the USB in device mode at all, maybe something on my CM3 is broken...

kajaldesai
Posts: 2
Joined: Wed Jan 09, 2019 6:06 am

Re: CM3 and usb gadgets (DWC2)

Thu Jan 10, 2019 11:27 am

I also face same problem..

I am using raspberry pi compute module 3 and i/o board. i wanted to login in cm3 module like raspberry pi zero. so I add dtoverlay=dwc2,dr_mode=peripheral in config.txt file and modules-load=dwc2,g_ether in cmdline.txt file. In this case i am able to login like pi zero using raspberrypi.local but when I remove above command from config.txt and cmdline.txt file, my mouse and keyboard are not working.

pvdmeer
Posts: 28
Joined: Mon Feb 22, 2016 10:29 am

Re: CM3 and usb gadgets (DWC2)

Mon Sep 23, 2019 2:06 pm

There's a mention a PULL-UP on the USB_OTGID pin needed to get DWC2 to run. However, in the CMIO schematic this is a PULL-DOWN!!! See for yourself: https://www.raspberrypi.org/documentati ... IO_3p0.pdf

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2374
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: CM3 and usb gadgets (DWC2)

Mon Sep 23, 2019 2:15 pm

Read the comment again:
There's a resistor on the CMIO pulling USB_OTGID low (forcing host mode). Have you installed a jumper cable from USB_OTGID to 3V3, so as to switch to gadget mode?
With USB_OTGID pulled low, the USB controller is in Host mode, which is a sensible default that is supported by the dwc2 and dwc-otg drivers. If you want to run in Gadget mode then you need to pull USB_OTGID high and have to use the dwc2 driver.

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1436
Joined: Sat Sep 10, 2011 11:43 am

Re: CM3 and usb gadgets (DWC2)

Tue Sep 24, 2019 2:25 pm

Actually, there is already a pull up in the pad so you don't need to add one externally... If you want to enable device mode on the CMIO board then you should remove R12 rather than pull it up, mostly because I can never remember which supply it is pulled to (but think it is 1.8v)

Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

treefella
Posts: 16
Joined: Thu Mar 24, 2016 11:59 pm

Re: CM3 and usb gadgets (DWC2)

Wed Oct 09, 2019 4:44 am

Has anyone gotten CM3 working as a gadget?

I am similarly not able to get the ethernet gadget working with CM3 with the procedure that works with CM1/Zero as described above.
Ron Sardarian
instagram.com/teafela/
teafella.com

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1436
Joined: Sat Sep 10, 2011 11:43 am

Re: CM3 and usb gadgets (DWC2)

Wed Oct 09, 2019 9:36 am

Is this with a standard Raspbian build?
Have you removed R12?
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

treefella
Posts: 16
Joined: Thu Mar 24, 2016 11:59 pm

Re: CM3 and usb gadgets (DWC2)

Thu Oct 10, 2019 7:08 am

R12 is removed, image is latest Rasbian Buster Light (2019-09-26) on CM 3+

Forcing peripheral mode doesn't seem to work either, g_ether and dwc2 seem to start up and nothing looks out of the ordinary in dmesg

I have tried the same steps/image on pi zero and pi 4 and gadget mode works/I am able to ssh into the device.
Ron Sardarian
instagram.com/teafela/
teafella.com

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1436
Joined: Sat Sep 10, 2011 11:43 am

Re: CM3 and usb gadgets (DWC2)

Thu Oct 10, 2019 7:34 am

Have you tried plugging it into different host types? PC / Mac / Pi 4?
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

treefella
Posts: 16
Joined: Thu Mar 24, 2016 11:59 pm

Re: CM3 and usb gadgets (DWC2)

Thu Oct 10, 2019 6:09 pm

I have tried Mac and Pi 4 ( don't have Windows ) it appears in neither when checking with lsusb and I cannot ssh with either one.

This is dmesg output when booting sequence is complete and I ssh into the device via usb ethernet dongle (acting as host in this case obv): https://pastebin.com/JsxTeQAT
Ron Sardarian
instagram.com/teafela/
teafella.com

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1436
Joined: Sat Sep 10, 2011 11:43 am

Re: CM3 and usb gadgets (DWC2)

Fri Oct 11, 2019 8:04 am

So it doesn't look like a software issue, assuming you're using a CMIO3 board, there is a USB switch on the hardware which switches the USB connections between J14 (host) and J15 (device). It would be useful to make sure you are plugged into the right USB connector and that the USB VBUS on that connector is being driven by the host (on J15)

Then probe PP11 to make sure the switch is being told to switch to J15 (it should be 0 when the host is plugged into the board)


Another thing to try is to remove the SD card from the CMIO board (assuming it is a CM3 lite) and then plug into the Mac / Pi, does it then appear?

Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

treefella
Posts: 16
Joined: Thu Mar 24, 2016 11:59 pm

Re: CM3 and usb gadgets (DWC2)

Sat Oct 12, 2019 6:08 pm

When I plug in (or leave everything unplugged) J14 PP11 is at 3.3V

When J15 is plugged in and VBUS is 5V is supplied from my laptop; PP11 becomes 0V

Is this the correct voltages @gsh?

The module is a 3+ with builtin eMMC so I'm not sure by the SD card part.

BTW, I also have a custom board where there is only one port and OTG_ID is wired directly to the port and this doesn't work as gadget either.

Thanks for your help,
Ronald
Ron Sardarian
instagram.com/teafela/
teafella.com

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1436
Joined: Sat Sep 10, 2011 11:43 am

Re: CM3 and usb gadgets (DWC2)

Sun Oct 13, 2019 7:33 pm

OK, so with an eMMC you should be able to program the eMMC using rpiboot, does this work fine on this board?
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

treefella
Posts: 16
Joined: Thu Mar 24, 2016 11:59 pm

Re: CM3 and usb gadgets (DWC2)

Sun Oct 13, 2019 11:13 pm

Yep, rpiboot works fine, this is how I got the firmware on my compute in the first place.
Ron Sardarian
instagram.com/teafela/
teafella.com

Return to “Compute Module”