1.1
Rutuja Chavan
Updated1. Updated to 2016.4 tool version
2. Designed for ZCU102 Rev1.0 and RevB/C/D Boards
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:
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.
boards, download ZCU102 BSP from xilinx
After installing PetaLinux SDK create a project in the PetaLinux installed directory by executing $ petalinux-create –t project –n <project_name> -s <path-to-bsp> 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>
Configure the Linux source to support communication device class driver by executing PetaLinux command $ petalinux-config -c kernel
Go to Device Drivers -->
Support -->
USB Gadget Support -->
USB Peripheral Controller -->enable NetChip 228x / PLX USB338x as shown in figure below and make sure that Xilinx USB driver is enabled.
{usb_peripheral_controller_config.jpg} Figure 2: Linux kernel configuration enable USB peripheral controller
Also enable required
{usb_kernel_config.jpg} Figure 3: Linux kernel configuration withUSB 3.0 device mode CDC ACM support
Go to File Systems -->
{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.
at "<project_name>/project-spec/meta-user/recipes-dt/device-tree/files/"
&dwc3_0 {
dr_mode = "peripheral";
g_serial.ko from following path “<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 “<project_name>/images/linux”
card images for Linux under the extracted directory. User canFor Rev1.0 board copy BOOT_rev1.0.bin into SD card and for Rev B/C/D boards, copy BOOT_revBCD.bin file into SD card and use these imagesother prebuilt modules. Refer to appendix A for quick test.more information about design file.
ZCU102 Board Setup:
Connect the power supply to the ZCU102 board. Do not switch the power on.
Connect the Micro USB cable into the ZCU102 Board Micro USB port J83, and the other end into an open USB port on the host Machine as shown in figure below.
{zcu102_board_setup_device_mode.png} Figure 6: ZCU102 board setup for Communication device class
in figure below7(ZCU102 Rev B/C/D) and figure 8(ZCU102 Rev1.0), which allows for ZCU102 Rev B/C/D Board {zcu102_rev1_sd_boot_mode.png} Figure 8: SD boot mode switch settings for ZCU102 Rev1.0 board
To operate board in device mode, OFF J7 jumper as shown in board figure 6 (ZCU102 board setup in device mode).
Testing Linux Zynq® UltraScale+™ MPSoC USB 3.0 communication device class functionality on Windows host PC:
insmod g_serial.ko
Now the Zynq® UltraScale+™ MPSoC USB 3.0 gadget serial device is ready.
{kernel_modules_image.jpg}{zynqmp_cdc_console_2016_4.png} Figure 8: ZynqMP9: Zynqmp linux console successful installation
Now connect USB 3.0 cable between board and host machine. Conenct type A male side end to host machine USB3.0 port and Micro B male side end of cable to USB3.0 connector (J96) on ZCU102 board as shown in figure 6 ZCU102 board setup.
Host PC tries to enumerate the Zynq® UltraScale+™ MPSoC USB 3.0 as a communication class device and try to install the appropriate windows driver from network.
In the windows host machine, click on the start button and Search for Device Manager and click on it to select.
This will open Device manager wizard window. Check for other devices. Right click on Gadget Serial v2.4 and click to Update Driver Software as shown in figure below. Make sure that host machine is connected over network.
{gadget_driver_installation.jpg} Figure 9: Device manager wizard
After installing the driver software successfully the Zynq® UltraScale+™ MPSoC USB 3.0 device is detected as a virtual communication port (PI USB to Serial Port) at the host PC side and on the other side i.e. target side. USB serial gadget driver is registered as /dev/ttyGS0.
{pl_usb_com_driver.jpg} Figure 10: Gadget driver after successful installation>
$ echo Hello >/dev/ttyGS0
After that you should see the Hello on the virtual communication port (ex: COM58) as shown below figure.
{usb_windows_1st_op.jpg}{windows_cdc_2016_4_result1.png} Figure 11:12: Serial terminal host machine
In
n the similar figure below
{usb_windows_2nd_op.jpg.png}
{windows_cdc_2016_4_result2.png} Figure 12:
Testing Linux Zynq® UltraScale+™ MPSoC USB 3.0 communication device class functionality on Linux host PC:
The CDC ACM only driver that comes with the Linux kernel is supported on Linux host PC.
The serial communication port get registered as 'ttyACM0' meaning it will show up as '/dev/ttyACM0'.
In order to send data from the target device we need to use the USB serial gadget driver device file '/dev/ttyGS0'. We can echo command to send data from the device to the Linux host computer.
{usb_linux_target_side.png}{linux_cdc_2016_4_result1_new.png} Figure 14: 3.0 ttyGS0
Use
se the following
{usb_linux_2nd_host_op.png} Figure 15: Reading data on ttyACM0
In the similar way if we want to send data from the host computer to the device we should first send the data from host by running following command
{usb_linux_3rd_host_side_ip.png}{linux_cdc_2016_4_result2.png} Figure 16:
Read it on the device using "$cat /dev/ttyGS0" command.
{usb_linux_target_4th_side.png}{linux_cdc_2016_4_result3.png} Figure 17: target at ttyGS0AppendixttyGS0
Appendix A: If
Zynqmp_CDC_Design_files.zip
Design_files