This Page is under construction
Document History
Rutuja Chavan & Rajesh Gugulothu
Initial version
02/15/2017
1.1
Rutuja Chavan
Updated to 2016.4 version
Summary
The Zynq® UltraScale+™ MPSoC USB 3.0 controller consists of two independent dual-role device (DRD) controllers. Both can be individually configured to work as host or device at any given time.The USB 3.0 DRD controller provides an eXtensible host controller interface (xHCI) to the system software through the advanced eXtensible interface (AXI) slave interface. An internal DMA engine is present in the controller and it utilizes the AXI master interface to transfer data. There are four primary types of communication defined by the USB protocol, based on which any required application can be built without changing the firmware or underlying hardware for different applications. These transfer types are Control Transfer, Bulk Transfer, Isochronous transfer and Interrupt transfer. Zynq® UltraScale+™ MPSoC USB3.0 controller supports all four types of transfers.This Tech Tip explains how to enable all the configuration options, step by step procedure to use the Zynq® UltraScale+™ MPSoC USB 3.0 controller in device mode and make use of bulk transfer type for a serial communication device abstraction using the USB 3.0. The CDC (ACM) class in the USB Component is used for data communication. You can typically use it in applications like serial COM or UART communicationThis design covers:
USB 3.0 Controller
Boards/Tools
ZCU102 Rev1.0 board,
ZCU102 Rev C/ RevB/C/ D board
Xilinx Tools Version
Xilinx SDK 2016.3,2016.4, Petalinux 2016.32016.4
Other Details
--
The gadget serial driver is a Linux USB gadget driver, a USB device side driver. It runs on a Linux system that has USB device side hardware; for example, a PDA, an embedded Linux system, or a PC with a USB development card. The gadget serial driver talks over USB to either a CDC ACM driver or a generic USB serial driver running on a host PC. On the device-side Linux system, the gadget serial driver looks like a serial device. On the host-side system, the gadget serial device looks like a CDC ACM compliant class device or a simple vendor specific device with bulk in and bulk out endpoints, and it is treated similarly to other serial devices.The host side driver can potentially be any ACM compliant driver or any driver that can talk to a device with a simple bulk in/out interface. With the gadget serial driver and the host side ACM or generic serial driver running, you should be able to communicate between the host and the gadget side systems as if they were connected by a serial cable.Configuring and building the Linux Operating System for Zynq Ultrascale + MPSoC
Follow the PetaLinux SDK installation user guide in this document. Execute the steps till the PetaLinux Working Environment Setup section for installing PetaLinux SDK to your Linux machine.
PetaLinux version 2016.3.2016.4. It recommendis recommended to download installer version 2016.32016.4 from Xilinx website. This example uses the ZCU102 PetaLinux BSP to create a PetaLinux project. Ensure that you have downloaded the ZCU102 BSP for PetaLinux as per requirement.
After installing PetaLinux SDK create a project in the PetaLinux installed directory by executing $ petalinux-create –t project –n <project_name> command
Above command will create a project with the user provided name under the PetaLinux installed directory. Change the directory to project directory which is created above. $ cd <project_name>
{filesystem_configuratioj.png} Figure 4: Linux kernel configuration for Userspace-driven configuration filesystem
Ensure that parameters shown in the below figure are selected in the kernel source tree and save & exit the configuration file.
device mode. Change the USB device treeAdd below mentioned node property “dr_mode“ in the device tree source code as “peripheral" which controls the modeat end of the device driver. The respective device treesystem-top.dts file named as pcw.dtsi can be found under the path “<petalinux_installed_path>/<project_name>/subsystems/linux/configs/device-tree” as shown in figure below.
{device_tree_configuration.jpg} Figure 5: Device tree modification for USB 3.0 device modepresent at "<project_name>/project-spec/meta-user/recipes-dt/device-tree/files/"
&dwc3_0 {
dr_mode = "peripheral";
status = "okay";
};
With the in kernel configuration,configuration and device tree, build petalinux
Create BOOT.BIN using petalinux SDK tool, change to images/linux (cd images/linux) directory and run below command
$ petalinux-package --boot --fsbl zynqmp_fsbl.elf --u-boot. This will create BOOT.BIN under images/linux
copy the following files into the SD card
BOOT.BIN which is created in the above section.
following path “<petalinux_installed_directory>/<project_name>/build/linux/kernel/xlnx-4.6/drivers/usb/gadget/”.“<project_name>/build/tmp/work/plnx_aarch64-xilinx-linux/petalinux-user-image/1.0-r0/rootfs/lib/modules/4.6.0-xilinx/kernel/drivers/usb/gadget/”
u_serial.ko file following path “<petalinux_installed_directory>/<project_name>/build/linux/kernel/xlnx-4.6/drivers/usb/gadget/function".“<project_name>/build/tmp/work/plnx_aarch64-xilinx-linux/petalinux-user-image/1.0-r0/rootfs/lib/modules/4.6.0-xilinx/kernel/drivers/usb/gadget/function"
usb_f_serial.ko from following path “<petalinux_installed_directory>/<project_name>/build/linux/kernel/xlnx-4.6/drivers/usb/gadget/function".“<project_name>/build/tmp/work/plnx_aarch64-xilinx-linux/petalinux-user-image/1.0-r0/rootfs/lib/modules/4.6.0-xilinx/kenel/drivers/usb/gadget/function"
usb_f_acm.ko from following path “<petalinux_installed_directory>/<project_name>/build/linux/kernel/xlnx-4.6/drivers/usb/gadget/function".“<project_name>/build/tmp/work/plnx_aarch64-xilinx-linux/petalinux-user-image/1.0-r0/rootfs/lib/modules/4.6.0-xilinx/kernel/drivers/usb/gadget/function"
g_serial.ko from following path “<petalinux_installed_directory>/<project_name>/build/linux/kernel/xlnx-4.6/drivers/usb/gadget/legacy".“<project_name>/build/tmp/work/plnx_aarch64-xilinx-linux/petalinux-user-image/1.0-r0/rootfs/lib/modules/4.6.0-xilinx/kernel/drivers/usb/gadget/legacy"
Image.ub from “<petalinux_installed_directory>/<project_name>/images/linux”.“<project_name>/images/linux”
Note: For user convenience SD card images are provided along with this Tech Tip. Download the design files archive released with this Tech Tip and extract it under the convenient location of host machine. Find the SD card images for Linux under the path Design_files/pre_built_images/ of your extracted directory. User can use these images for quick test.
ZCU102 Board Setup:
Zynqmp_CDC_Design_files.zip
Design_files
BOOT.BINBOOT_rev1.0.BIN
BOOT_revBCD.BIN
image.ub
Various kernel modules listed below