Using XUD USB pins as GPIOs Topic is solved

Technical discussions around xCORE processors (e.g. xcore-200 & xcore.ai).
Post Reply
BenTh.WS
Junior Member
Posts: 4
Joined: Tue Sep 03, 2019 1:18 pm

Using XUD USB pins as GPIOs

Post by BenTh.WS »

Hi,

We have a platform loosely based on the XK-AUDIO-216-MC-AB, so using the XE216-512-TQ128, and we'd like to use port 8A on tile 1 as 8 output pins to drive PWM signals on LEDs. The issue is that, using the USB Audio 2.0 software 6.15.2, adding the following line:

Code: Select all

out port p_gpio_pwm_leds = on tile[1] : XS1_PORT_8A;
causes the following error:
xmap: Error: Symbol p_gpio_pwm_leds is a duplicate port declaration.
xmap: Error:   previously declared as p_usb_txd.

And, indeed, in XUD_Ports.xc in module_xud:

Code: Select all

out buffered port:32 p_usb_txd = PORT_USB_TXD;

According to the documentation of the XUD library:
The U-Series of devices have an integrated USB transceiver. Some ports are used to communicate with the USB transceiver inside the U-Series packages. These ports/pins should not be used when USB functionality is enabled.
This document does not mention the X200 series, but the code of the XUD library is clearly based on this rule. However, the XK-AUDIO-216-MC-AB board uses some of the corresponding pins, as well as other pins reserved by the XUD library, but through smaller ports:
  • not wired to a package pin, or undocumented pin connection: PORT_USB_TX_READYIN on port 1H
  • not wired to a package pin, or undocumented pin connection: PORT_USB_CLK on port 1J
  • not wired to a package pin, or undocumented pin connection: PORT_USB_TX_READYOUT on port 1K
  • not wired to a package pin, or undocumented pin connection: PORT_USB_RX_READY on port 1I
  • not wired to a package pin, or undocumented pin connection: PORT_USB_FLAG0 on port 1E
  • not wired to a package pin, or undocumented pin connection: PORT_USB_FLAG1 on port 1F
  • not wired to a package pin, or undocumented pin connection: PORT_USB_FLAG2 on port 1G
  • pins X1D02 to X1D09: PORT_USB_TXD on port 8A shared with ETH_RST and INT, unused by the software, and BUTTON_[1..3] and SWITCH_1, used as GPIO inputs by hidbuttons.xc and ea_protocol_demo.xc through port 4B
  • pins X1D14 to X1D21: PORT_USB_RXD on port 8B shared with LED_{ROW,COL}_[0..3] used as GPIO outputs by ea_protocol_demo.xc through ports 4C and 4D

All this is contradictory and confusing. Could someone clearly say if and how these pins can be safely used as GPIOs with the USB functionality enabled? Is it not at all, or only through ports of different sizes, or in some other way? Can the ports reserved by the XUD library be freed, or can other ports be used instead?

Thanks in advance.


View Solution
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Post by mon2 »

Hi. The observation is correct for the raised port width of P8A or even P8B on Tile[1]. This topic has been discussed a few times in detail on this forum. Please search for the related posts for more details.

The summary is to review:

a) XCORE-200 Port map from here:

https://www.xmos.com/file/xcore-200-devices-portmap/

b) Then review the feature you wish to enable - for you it is USB PHY on Tile[1]

c) Based on the above enabled feature, the ports with a colored background are NOT available for your use as they will be mapped internally in the CPU for the USB PHY (for your case). However, the same physical port pins WILL be able to use the port widths with the WHITE background. So specifically, you will be fine to use P4A & P4B on Tile[1] for your PWM functions AND still have the USB PHY enabled.

Any port with a WHITE background in the spreadsheet is available for your use on the same port pins even if you enable the extra CPU features like the USB PHY.


So do try:

Code: Select all

out port p_gpio_pwm_leds_1 = on tile[1] : XS1_PORT_4A;
out port p_gpio_pwm_leds_2 = on tile[1] : XS1_PORT_4B;

Hope this helps.
BenTh.WS
Junior Member
Posts: 4
Joined: Tue Sep 03, 2019 1:18 pm

Post by BenTh.WS »

Thanks. This is very helpful.
Post Reply