...
USB 2.0 (High Speed)467.2 Mbits/sec
USB ATTACHED SCSI PROTOCOL(UASP)
LIMITATION:
TCM MODULE USED FOR UASP does not support ATA_12 commands. so user needs to change VID and PID in file drivers/usb/gadget/legacy/tcm_usb_gadget.c as below
#define UAS_VENDOR_ID 0x0bc2
#define UAS_PRODUCT_ID 0xa013
Kernel Configuration Options
Device Drivers --->
<*> Generic Target Core Mod (TCM) and ConfigFS Infrastructure --->
--- Generic Target Core Mod (TCM) and ConfigFS Infrastructure
<*> TCM/IBLOCK Subsystem Plugin for Linux/BLOCK
<*> TCM/FILEIO Subsystem Plugin for Linux/VFS
<*> TCM/pSCSI Subsystem Plugin for Linux/SCSI
<*> TCM/USER Subsystem Plugin for Linux
<*> TCM Virtual SAS target and Linux/SCSI LDD fabric loopback module
<*> Linux-iSCSI.org iSCSI Target Mode Stack
[*] USB support --->
<*> USB Gadget Support
<*> USB functions configurable through configfs
[*] USB Gadget Target Fabric
<M> USB Gadget Target Fabric Module
KCONFIG OPTIONS for UASP profile:
CONFIG_USB_DWC3 = y
CONFIG_USB_DWC3_DUAL_ROLE = y
CONFIG_USB_SUPPORT=y
CONFIG_USB_COMMON=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_PLATFORM=y
CONFIG_CONFIGFS_FS=m
CONFIG_USB_GADGET=y
CONFIG_USB_LIBCOMPOSITE=m
CONFIG_USB_CONFIGFS=m
CONFIG_BLK_DEV_INTEGRITY=y
CONFIG_TARGET_CORE=y
CONFIG_TCM_IBLOCK=y
CONFIG_TCM_FILEIO=y
CONFIG_TCM_PSCSI=y
CONFIG_TCM_USER2=y
CONFIG_LOOPBACK_TARGET=y
CONFIG_ISCSI_TARGET=y
CONFIG_USB_F_TCM=y
CONFIG_USB_CONFIGFS_F_TCM=y
CONFIG_USB_GADGET_TARGET=m
CONFIG_CRC_T10DIF=y
Device tree node details:
Example Device tree node:
&dwc3_0 {
status = "okay";
dr_mode = "peripheral";
}
Please find the required .ko files in the below mentioned paths:
linux-xlnx/fs/configfs/configfs.ko
linux-xlnx/drivers/usb/gadget/libcomposite.ko
linux-xlnx/drivers/usb/gadget/legacy/gadgetfs.ko
linux-xlnx/drivers/usb/gadget/legacy/tcm_usb_gadget.ko
Test procedure:
Connect the USB 3.0 cable to linux PC and perform the steps given below on the device side
### To Install module ###
modprobe tcm_usb_gadget
### To mount the configfs ###
mount a -t configfs /sys/kernel/config
### To create a memory that will be assigned to gadget (here creating memory of 750MB) ###
mkdir /root
dd if=/dev/zero of=/root/file.bin bs=10M count=75
### To format the memory that just has been created ###
mkdosfs -v /root/file.bin -n ramfs
### To assign memory to gadget module ###
mkdir -p /sys/kernel/config/target/core/fileio_0/fileio
echo "fd_dev_name=/root/file.bin,fd_dev_size=734003200" > /sys/kernel/config/target/core/fileio_0/fileio/control
echo 1 > /sys/kernel/config/target/core/fileio_0/fileio/enable
mkdir -p /sys/kernel/config/target/usb_gadget/naa.6001405c3214b06a/tpgt_1
mkdir /sys/kernel/config/target/usb_gadget/naa.6001405c3214b06a/tpgt_1/lun/lun_0
echo naa.6001405c3214b06a > /sys/kernel/config/target/usb_gadget/naa.6001405c3214b06a/tpgt_1/nexus
ln -s /sys/kernel/config/target/core/fileio_0/fileio /sys/kernel/config/target/usb_gadget/naa.6001405c3214b06a/tpgt_1/lun/lun_0/virtual_scsi_port
#### To Change max busrt to get maximum performance ####
echo 15 > /sys/kernel/config/target/usb_gadget/naa.6001405c3214b06a/tpgt_1/maxburst
#### To connect device to Host ####
echo 1 > /sys/kernel/config/target/usb_gadget/naa.6001405c3214b06a/tpgt_1/enable
UBUNTU:
On performing the steps given above, below prints should be shown on host side on typing "dmesg"
{img4.PNG}
Do data transfer on HOST(UBUNTU) side
{img5.PNG}
WINDOWS(UASP supported on windows 8):
On windows need to follow below steps in order to mount device1. open manage by right click on Desktop (screen shot as below)
{img6.PNG}
2. open disk management and format the device (screen shot as below)
{img7.PNG}
3. It will mount the device as drive
4. Do data transfer
OTG MODE
Using the correct cables is the key to OTG operation. Testing was done using two cables joined together to create an OTG cable. An OTG cable has a micro A connector on one end and a micro B connector on the other end. The micro A connector is the host side of the cable and the micro B connector is the device side by default.