We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Showing results for 
Search instead for 
Did you mean: 
Observer kabba
Registered: ‎12-02-2014

Zynq Ultrascale+ MPSoC USB CDC Device, help & information.

Hi All


I am fairly new to the software side of things, I am a VHDL Firmware & electronic designer who is trying to get back up to speed with software to be better equipped to complete designs on the Zynq US+ architecture.


I have been tasked with trying to configure the Zynq US+ USB Driver (PS Side) to act as a CDC device to a Windows PC for standalone and usable with FreeRTOS. I want to use this as main comms to my system as the UARTs 0 and 1 will be used for other comms. We want R5 processor to be the main comms handler.


I went through the basics of the USB protocol and have been looking at 



as an example in setting up such a device.


I see that our ZCU106 eval kit only instantiates the XUsbPsu Driver on the SDK with board file defaults. Am I right in assuming that this is the only driver I have access to because of the USB3.0 functionality added and that the XUsbPs driver is only for the Zynq7000 devices?


The Driver API Documentation usually located at:

<Install Dir>/SDK/2018.2/data/embeddedsw/XilinxProcessorIPLib/drivers/usbpsu_v1_4/doc/html/api/

I am finding very sparse in terms of explaining the functionionality and makes me feel like I am missing quite some beforehand knowledge of the Driver API.


I have found quite a few differences between the Z7000 tech tips example code and what I can find in the Xusbpsu driver code xusbpsu.h, xusbpsu_hw.h , ect.


In short my questions would be:


What are the differences between the xusbps and xusbpsu drivers? Is it worth while to try and port the example to be compatible with the xusbpsu driver, or are the differences too great?


Is there any documentation that I might be missing to help me understand how to implement the CDC class USB device via Xilinx Drivers on the SDK for standalone use? Maybe Docs that Describe the use of the API to setup the Descriptors and endpoints for different types of uses (such as CDC, HID, ect).


Apologies if I am going about this the wrong way, but any help and suggestions will be greatly appreciated. :)


Thank you in advance

Christo Steyn



0 Kudos
7 Replies
Newbie aresis
Registered: ‎06-14-2018

Re: Zynq Ultrascale+ MPSoC USB CDC Device, help & information.

Hi All,

I have exactly the same wish: USB CDC device bare metal (or FreeRTOS) driver and example for ZynqMP.

There is USB CDC device driver for Linux on the net but nothing for bare metal or RTOS. At least I was not able to find any.

Does anybody know if there is one somewhere?

Were it possible that Xilinx adds CDC example in the next release of SDK? I think that would be greatly appreciated by many developers.

Thank you,

Igor Poberaj


0 Kudos
Observer kabba
Registered: ‎12-02-2014

Re: Zynq Ultrascale+ MPSoC USB CDC Device, help & information.

Hi aresis

I have not had much luck asof yet to find a Zynq Ultrascale+ MPSoC USB3.0 example to use easily. I did find a standalone example for Zynq7000 here:


I am currently trying to work from the XUSBPSU driver's storage device example and modify it to what I see happening in the techtip's source code.

The issue is mostly that there is quite a difference between the two device's drivers. So I've gotten it to the point that windows at least sees that it is trying to be a Serialport but no functionality works thus far.

Hopefully this helps you in any way. I think we are stuck to such attempts until Xilinx does us a solid and adds a similar example for the Ultrascale+ Zynq devices.

Good luck!

0 Kudos
Observer sabinoxilinx1
Registered: ‎01-23-2019

Re: Zynq Ultrascale+ MPSoC USB CDC Device, help & information.

Hi Kabba

do you have solved the problem? I'm developping the cdc communication driver for the Ultra96 Board on ArmR5. I have started to change the mass storage example and now Windows10 is able to see the CDC Device and configuring it as a ComPort16. I have setted this endpoint 

+++++++ Into the Main ++++++++++

/* Assign the data to usb driver */
Set_DrvData(UsbInstance.PrivateData, &storage_data);

EpConfigure(UsbInstance.PrivateData, 0, USB_EP_DIR_OUT, USB_EP_TYPE_CONTROL);
EpConfigure(UsbInstance.PrivateData, 0, USB_EP_DIR_IN, USB_EP_TYPE_CONTROL);

EpConfigure(UsbInstance.PrivateData, 1, USB_EP_DIR_OUT, USB_EP_TYPE_INTERRUPT);
EpConfigure(UsbInstance.PrivateData, 1, USB_EP_DIR_IN, USB_EP_TYPE_INTERRUPT);

EpConfigure(UsbInstance.PrivateData, 2, USB_EP_DIR_OUT, USB_EP_TYPE_BULK);
EpConfigure(UsbInstance.PrivateData, 2, USB_EP_DIR_IN, USB_EP_TYPE_BULK);

Status = ConfigureDevice(UsbInstance.PrivateData, &Buffer[0], MEMORY_SIZE);
if (XST_SUCCESS != Status) {

* set endpoint handlers
* BulkOutHandler - to be called when data is received
* BulkInHandler - to be called when data is sent
SetEpHandler(UsbInstance.PrivateData, 0, USB_EP_DIR_OUT, EpCtrlHandler);
SetEpHandler(UsbInstance.PrivateData, 0, USB_EP_DIR_IN, EpCtrlHandler);

SetEpHandler(UsbInstance.PrivateData, 1, USB_EP_DIR_OUT, EpIntrInHandler);
SetEpHandler(UsbInstance.PrivateData, 1, USB_EP_DIR_IN, EpIntrInHandler);

SetEpHandler(UsbInstance.PrivateData, 2, USB_EP_DIR_OUT, BulkOutHandler);
SetEpHandler(UsbInstance.PrivateData, 2, USB_EP_DIR_IN, BulkInHandler);


+++++++ End Main ++++++++++

###### Endpoint function ####

void EpCtrlHandler(void *CallBackRef, u32 RequestedBytes, u32 BytesTxed)

void EpIntrInHandler(void *CallBackRef, u32 RequestedBytes, u32 BytesTxed)


When I start the code the EpCtrlHandler is called 10 times ( is see the printed string) and if I try to connect with realterm it's going in error. ( the device is not functioning )

Did you find a solution?


0 Kudos
Observer kabba
Registered: ‎12-02-2014

Re: Zynq Ultrascale+ MPSoC USB CDC Device, help & information.

Hi sabinoxilinx1

If you can get it recognised as a serial device and it gets a comport assigned I am then assuming that your descriptors are correctly setup.

If your terminal program hangs and crashes upon selecting the com port 16 I also had this problem. My problem was within the class request handling. The CDC device basicly requires you to handle three class requests. Namely:

- CDC Request Line coding (SetupData->bRequest = 0x21). 

Here the device sends 7 bytes communicating to the host it's baud rate, stop bits and so on. the Baud rate itself is irrelevant it just has to be handled upon connecting the terminal program when it sends the class requests. 
Mine was setup as 

u8 xusb_cdc_line_coding[7] = {0x00, 0xc2, 0x01, 0x00, 0x00, 0x00, 0x08};

and sent by

EpBufferSend(InstancePtr->PrivateData, 0, xusb_cdc_line_coding, 7);

This communicates a 115200 Baudrate, parity none, 1 stop bit and 8 data bits.


- CDC Request Set line coding (SetupData->bRequest = 0x20)

Here you have to receive the coding bytes from the PC with

EpBufferRecv(InstancePtr->PrivateData, 0, buffer, SetupData->wLength);

and you can copy into your byte array storing the coding with

memcpy(xusb_cdc_line_coding, buffer, 7);

So that it gets reported as changed if the Host asks again.

Also remember to send a zero length acknowledge packet to acknowledge that you received the new line coding data with

EpBufferSend(InstancePtr->PrivateData, 0, NULL, 0);

- CDC Request Set Carrier (SetupData->bRequest = 0x22)

Nothing needs to be handled here, just ensure to send a zero length packet again to acknowledge again.


I hope this helps! I was developing this for the Zynq US+ MPSoC device. But the core idea is the same. When you connect the terminal program the CDC driver will send these class requests and if it is not acknowledged and handled the terminal sits waiting, hence the non responsive state it goes in before crashing. I use it with both TeraTerm and Termite programs but not realterm.


Lastly and extra note is that when I got this working I struggledd to get the data received handler to call. This in the Zynq MPSoC device USB driver meant that I first had to at least call the EpRecBuffer function once for at least one byte before data would be received and the handler called. But this is specific to the device and it's own USB driver code that you are using. For example the Zynq7000 device had a EpPrime function that served this purpose apart from it's own Receive function.


Best of luck!

Good day

Observer sabinoxilinx1
Registered: ‎01-23-2019

Re: Zynq Ultrascale+ MPSoC USB CDC Device, help & information.

Hi Kabba

thank you for your answer. I have worked on your suggestion and after fixing the configuration now I have a working connection.
I'm abble to connect/disconnect multiple time on the Com17 without problem. One strange thing is that the exchange of this commands 

- CDC Request Line coding (SetupData->bRequest = 0x21).      ( 2x befor the connection to the com17 and 28 after )
- CDC Request Set line coding (SetupData->bRequest = 0x20)  ( 1x before conn and 8x after )
- CDC Request Set Carrier (SetupData->bRequest = 0x22)         ( 2x before conn and 10x after )

are done several time, is it normal?

Now I'm trying to send/receive 1byte on the com17 without success.With the USB Monitoring tool ( see fig1) I have seen 3 open pipe and I think that the com port should work.(1 Endpoint Interrupt and 2 Endpoint IN+OUT). I have tested your last solution to start the communication but the only handler that I have triggered is the send Handler without seeing data on the serial terminal. I think that the above multiple request are not ok, but I'll continue to analize.

Thank you 

0 Kudos
Observer sabinoxilinx1
Registered: ‎01-23-2019

Re: Zynq Ultrascale+ MPSoC USB CDC Device, help & information.

Hi Kabba

Just started again to work with the Ultra96 and finally the communication is working :-) 
In attached there is the code with the CDC ACM configuration. 

It was not working because into the previouse configuration the address of the EndPoint OUT Bulk 2 was wrong. 

Here are two good sources to study


Ciao and thank you again


0 Kudos
Visitor broermank
Registered: ‎08-28-2018

Re: Zynq Ultrascale+ MPSoC USB CDC Device, help & information.


I am in the same boat as you, looking for bare-metal USB-CDC device class example code for the Ultrascale.  (similar to that provided by   https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841624/Zynq-7000+AP+SoC+USB+CDC+Device+Class+Design+Example+Techtip)

Has anyone solved this problem, or have code they can share?




0 Kudos