I managed to create a USB gadget (g_multi: Ethernet and Mass Storage) on my Raspberry Pi Zero W. The only problem I have now is disk space. From what I know Raspberry Pi supports memory cards up to 32 GB. The only USB port is unavailable because of g_multi. Is there any other way to connect a flash drive or additional SD card?
1 Answer
Not for the Pi Zero (W). The reason is that there is only a single USB port, and only this allows the controller to be put either into USB slave mode (gadget mode) or USB host mode (on-the-go or OTG mode on a micro USB port), using the "fifth pin". OTG cables have this pin connected (imho they ground them, but I may be mistaken), while USB A-to-micro B cables have only four wires.
Attaching a hub will switch into OTG/host mode, so you cannot use gadget mode. That's the reason why the larger Pis don't support slave/gadget mode: there's a built-in hub between the single controller port and the four USB A host ports.
Edit: the Raspberry Pis actually have on-board hardware support for a secondary mSD card via SDIO, but unfortunately this isn't easily deployed at the moment. This comprehensive blog post http://ralimtek.com/Raspberry_Pi_Secondary_SD_Card/ shows how to add a secondary SD card, explicitly mentioning also the Pi Zero. Performance seems not to be as good as with the first mSD, only 1bit mode at 4MB/s.