Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement USB Mass Storage for SDCard #105

Open
ZavenArra opened this issue Oct 21, 2022 · 0 comments
Open

Implement USB Mass Storage for SDCard #105

ZavenArra opened this issue Oct 21, 2022 · 0 comments
Labels

Comments

@ZavenArra
Copy link
Contributor

ZavenArra commented Oct 21, 2022

We want to plug the WaterBear into a computer over USB, and see the SDCard mount as a filesystem drive.

To achieve this in USB, it is necessary to implement the USB Mass Storage protocol. Our MCU, the STM32F103RB, has an on-chip USB controller, and the core we are using (https://github.com/rogerclarkmelbourne/Arduino_STM32/) includes a USB library, called USBComposite which has a device defined for implementing USB Mass Storage (https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/master/STM32F1/libraries/USBComposite - see the README on this page for details)

The is an example code:
https://github.com/rogerclarkmelbourne/Arduino_STM32/tree/master/STM32F1/libraries/USBComposite/examples/mass
Which has been experimented with:
https://github.com/ZavenArra/rriv/tree/usb_attempt

However, it is not fully functional.

First, the USB Mass Storage device does not completely mount. Probing with CLI commands like lsusb, usb-devices, lsblk, and dmesg | grep -i USB shows that the USB Mass Storage device is present, but the driver is not found in linux. It is unclear if this is a device side error (incomplete identification to the computer), or if there is a driver missing on the computer. Testing on different computers may help address this issue, or further profiling of the issue may be necessary.

https://forum.manjaro.org/t/external-usb-drives-not-an-mtp-device/74781
https://superuser.com/questions/1206664/disable-mtp-udev-rules-for-specific-device-so-it-can-be-mount-as-a-usb-mass-stor

Second, the mass storage device example is just implemented for access to in memory data. The bindings to the SDFat library need to be implemented in order to expose the SDCard as a block device when mounted over USB as a USB Mass Storage device.

@ZavenArra ZavenArra added the usb label Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant