DrathianGull
Posts: 3
Joined: Thu Sep 23, 2021 6:08 pm

CM4 - OTG Mass Storage Help

Thu Sep 23, 2021 6:22 pm

Hello,

I've been trying to set up OTG Mass Storage with access from the USB Slave, but when I plug it into my Windows 10 machine it comes up as a USB Serial Device instead.

I already enabled the USB by setting the overlay and mode in /boot/config.txt as

Code: Select all

dtoverlay=dwc2,dr_mode=peripheral
I also added dwc2 to the end of /etc/modules.

I also added this to the /boot/cmdline.txt

Code: Select all

fixrtc modules-load=dwc2,g_ether
Any help would be appreciated.

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

Re: CM4 - OTG Mass Storage Help

Thu Sep 23, 2021 7:52 pm

What exactly are you trying to achieve? To use the CM4 storage as a USB MSD from Windows?

DrathianGull
Posts: 3
Joined: Thu Sep 23, 2021 6:08 pm

Re: CM4 - OTG Mass Storage Help

Thu Sep 23, 2021 8:09 pm

We are trying to set it up so that a computer can just plug in and use it like a flashdrive for when the main program is not running

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

Re: CM4 - OTG Mass Storage Help

Thu Sep 23, 2021 8:18 pm

The g_ether module is to create a network link between the guest and the CM4, so you probably don't need that.

Unfortunately Linux doesn't allow direct access to the main filling system in that way - imagine the problems that could arise if two hosts were trying to use the same EMMC device. Instead you have to run a special image on the CM4 that is downloaded by the usbboot/rpiboot utility, after which the CM4 behaves like an MSD until it is reset or power cycled.

DrathianGull
Posts: 3
Joined: Thu Sep 23, 2021 6:08 pm

Re: CM4 - OTG Mass Storage Help

Thu Sep 23, 2021 8:33 pm

Understood. In that case I assume I can just create a separate partition and lock it in there that would just hold files and on startup the main partition could just grab the files before they can be accessed and make a copy of them inside if any changes had been made.

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

Re: CM4 - OTG Mass Storage Help

Thu Sep 23, 2021 8:47 pm

You would need to use the mass storage gadget driver - there's a guide here (the first hit from Google): https://linuxlink.timesys.com/docs/wiki ... le_Storage

incognitum
Posts: 1434
Joined: Tue Oct 30, 2018 3:34 pm

Re: CM4 - OTG Mass Storage Help

Thu Sep 23, 2021 9:31 pm

PhilE wrote:
Thu Sep 23, 2021 8:18 pm
Unfortunately Linux doesn't allow direct access to the main filling system in that way - imagine the problems that could arise if two hosts were trying to use the same EMMC device.
But indirect access to individual files do is possible. As in: do not focus too much on playing mass storage device, but consider speaking the MTP protocol mobile phones use to let you download your photos instead.

Need to run a daemon in userspace for that, like: https://github.com/viveris/uMTP-Responder

Return to “Compute Module”