I tried to set a RPI 4 in OTG device mode

  • I added dtoverlay=dwc2 to config.txt
  • I modified the cmdline.txt so it launches wc2 & g_midi
  • I tried ,dr_mode=peripheral too
  • I just tried replacing Raspbian by raspbery pi os, same problem

it works on a pi zero, I see the device under windows 7

on RPI4 I get "Unknown Device" in windows 7 & 10

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

I checked the module is correctly loaded

pi@raspberrypi:~ $ lsmod | grep midi
snd_seq_midi           16384  0
snd_seq_midi_event     16384  1 snd_seq_midi
snd_seq                69632  2 snd_seq_midi_event,snd_seq_midi
usb_f_midi             20480  3
snd_rawmidi            32768  2 snd_seq_midi,usb_f_midi
snd_seq_device         16384  3 snd_seq,snd_rawmidi,snd_seq_midi
snd                    73728  17 snd_compress,snd_seq,snd_timer,snd_rawmidi,snd_seq_device,snd_bcm2835,snd_soc_core,usb_f_midi,snd_pcm
g_midi                 16384  0
libcomposite           53248  4 g_mass_storage,g_midi,usb_f_mass_storage,usb_f_midi
udc_core               57344  4 usb_f_mass_storage,dwc2,libcomposite,usb_f_midi
pi@raspberrypi:~ $ aplaymidi -l
 Port    Client name                      Port name
 14:0    Midi Through                     Midi Through Port-0
 16:0    f_midi                           f_midi
pi@raspberrypi:~ $ arecordmidi -l
 Port    Client name                      Port name
 14:0    Midi Through                     Midi Through Port-0
 16:0    f_midi                           f_midi

when I plug the device looking at dmesg -w, I get

[  263.141426] dwc2 fe980000.usb: new device is full-speed
[  263.421383] dwc2 fe980000.usb: new device is full-speed
[  263.601365] dwc2 fe980000.usb: new device is full-speed

something is not quite right

Note: I made the Y USB-C cable myself I guess it's working fine since Windows is seeing a usb device

thanks for the time you'll spend on this one

diy usb-c Y cable schema

  • I've not studied your question in detail, but I believe this (or something like it) has been done before. I've not tried it myself (yet), but a few questions re OTG have been asked & answered here - they might have some useful information. This answer has links in it to a couple of resources that might be helpful. Take a look at that & let us know how you get on. – Seamus Aug 4 at 19:10
  • I should have mentioned I already parsed a lot of other people questions an based my project on the many examples and doc I happened to find on the web, but thanks :-) – phil123456 Aug 4 at 20:27
  • Perhaps it's because green is D- and white is D+ in many of the cable images I've seen - though, it does seem to be fairly split between the two - which pin of the USB-A connector is green, which is white? – Jaromanda X Aug 5 at 5:12
  • I tried reversing green and white, even reversing the USB-C just in case, nothing works, it's not even detected in windows anymore – phil123456 Aug 5 at 12:21
  • Have you also noticed the answer to How to make a splitter cable for the USB2 OTG port on the RPi 4B?? – Ingo Aug 8 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.