Is it possible to use the BB as Mass Storage Device?
I want it to be connected to an audio player that can read files from USB connectivity (such as USB flash drive) and act as data storage device containing one specific folder (and its sub-folders) from the file system (if possible, on a flash drive connected to the board.).
As the device specs says, it has connectivity of:
USB client for power & communications
USB host
Operating system will probably be Ubuntu but can be changed.
What drivers or configurations needs to be done in order to achieve this?
The latest images have already the mass storage usb gadget active, so a mass storage peripheral should be recognized by your system upon connection.
A quick google search reveals this discussion about a user trying to disable the USB MS gadget:
From the discussion, the files where the magic happens are:
Debian: /opt/scripts/boot/am335x_evm.sh
Ubuntu: /opt/scripts/boot/am335*
Armstrong: /usr/bin/g-ether-load.sh
In my Debian image the line you want to modify is:
modprobe g_multi file=${gadget_partition} cdrom=0 stall=0 removable=1 nofua=1 iSerialNumber=${SERIAL_NUMBER} iManufacturer=Circuitco iProduct=BeagleBone${BLACK} host_addr=${cpsw_1_mac}
and the corresponding $gadget_partition variable that is set just before that in order to customize the folder you want to expose.
Note that the g_multi gadget in its standard configuration presents 3 different devices: an ethernet interface, a mass storage peripheral and a serial interface. If you want to customize the parameters you can refer to the g_multi documentation (kernel.org)
Related
I am looking for a command line tool for flashing my NUCLEO card in ubuntu. I want this tools for flash my NUCLEO remotely with node.js. I already try st-flash and stm32flash but these tools don't work properly. My programs are generated by mbed online tool.
Do you have any suggestions ?
Thanks for your answers
You can update Nucleo boards simply by copying the mbed image to the mass storage device presented when you connect to the composite USB interface.
The image file is automatically written to the microcontroller flash by the integrated STLink device when the file is placed on the USB drive. This is a "write-only" device; the written file cannot be read back - if you interrogate the drive it always appears empty.
In Ubuntu you may have to explicitly mount the device. If it mounts automatically it will appear under /mnt (I guess).
Since it is a standard USB mass storage interface, you should not need any Nucleo or ST specific driver or software. It is a "drag & drop" programming interface.
If your board does not appear as a mass storage device, you may need to update the integrated STLink firmware as described at https://os.mbed.com/teams/ST-Americas-mbed-Team/wiki/Preparing-the-STM32-Nucleo-Board
I want to use alsa on a Beaglebone Black to send audio through usb audio out and receive it on my computer.
I have seen that there are some gadgets in a legacy folder in the kernel, and seen some tutorials on how to set up mass storage and network gadgets, but I am confused about what the state of audio gadgets is and what to compile and configure for this.
Can you explain the various components and configurations that need to go into place to make this happen, covering which kernel modules, drivers, kinds of scripts, and configurations that might be needed to do this?
You need to enable USB gadget subsystem in your Linux kernel for Beaglebone Black. Assuming of course that you have USB device controller and USB device connector on your Beaglebone. Here there are more information:
https://www.lynxbee.com/usb-audio-gadget-driver/
USB devices contains so called USB descriptors which tells USB host (PC) as a what device type it works. Audio gadget is one of the type of that descriptor that tells that this device (in this case BeagleBone) should be working as a audio device.
We need to be able to change the mass storage function in a Linux composite USB gadget (to change the mounted directory). Currently the scripts teardown the UDC and restart it with the changed mount point.
The problem with this is that it disconnects the ACM device providing the command/control serial connection with a Windows PC.
Is there a way to just takedown/restart the mass storage portion of the composite device without stopping the entire UDC?
This is with kernel 4.1.9.
I am new to working on virtual USB device simulation in Linux. So far I have installed the virtual host control (vhci) libraries as per this tutorial (http://sourceforge.net/p/usb-vhci/wiki/Home/) and can see a virtual USB device being created which has some typical specifications that the library implements (Bus 05 in the image with the vendor and product IDs being "dead" and "beef" respectively).
However I want the created virtual device to have the specifications of a real device I have at hand (a mouse, for example).
So how to enumerate and initialize a virtual USB device with the same credentials as another device?
The kernel module (vhci-hcd) is only a (virtual) host controller that you can attach virtual devices to.
If you want to emulate eg a mouse you should get the libusb_vhci from the same source, and look into the examples. These are bare minimum starting points that does nothing except for the basic usb device handling. You'll have to extend this with all descriptors and protocol handling for a USB HID mouse or whatever you want to emulate.
http://www.usbmadesimple.co.uk/ums_5.htm should be a good starting point.
you can use lsusb and in particular lsusb -D to dump the descriptors of devices you have connected.
Is it possible to get a list of files from an SD card when it is connected as a USB Mass Storage device?
UMS provides the contents of the SD card as a raw storage device, much the same as a hard drive or CD driver. As such, it is up to the operating system's VFS to make sense of the partitioning, formatting, and directory structure contained on it.