usb_tile communication over xlinks

New to XMOS and XCore? Get started here.
Post Reply
User avatar
aneves
Experienced Member
Posts: 93
Joined: Wed Sep 16, 2015 2:38 pm

usb_tile communication over xlinks

Post by aneves »

Hi Everyone,

I have a xCORE-200 Multichannel Audio Platform that I have been experimenting with. I am progressively building USB demos targeting different hardware by modifying the XUE216-512-TQ128-C20.xn file (since this board is based on the XE216-512-TQ128) to meet my needs. I can get these demos to compile and run, which is fine. However, I am still struggling to understand the concept of how xConnect and xLinks work both in general and when it comes to communicating to the USB PHY.

Here is my current XN:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<Network xmlns="http://www.xmos.com"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.xmos.com http://www.xmos.com">
  <Type>Device</Type>
  <Name>XUE216-512-TQ128-C20 Device</Name>

  <Declarations>
    <!-- <Declaration>tileref tile[2]</Declaration>
    <Declaration>tileref usb_tile</Declaration> -->
    
    <Declaration>tileref tile[2]</Declaration>
    <Declaration>tileref usb_tile</Declaration>
    
  </Declarations>

  <Packages>
    <Package id="0" Type="XS2-UnA-512-TQ128">
      <Nodes>
      <!--
        <Node Id="0" InPackageId="0" Type="XS2-L16A-512" SystemFrequency="500MHz" OscillatorSrc="1">
          <Tile Number="0" Reference="tile[0]"/>
          <Tile Number="1" Reference="tile[1]"/>
        </Node>
        <Node Id="1" InPackageId="1" Type="periph:XS1-SU" Reference="usb_tile">
        </Node> -->
        
        <Node Id="0" InPackageId="0" Type="XS2-L16A-512">
          <Tile Number="0" Reference="tile[0]"></Tile>
          <Tile Number="1" Reference="tile[1]">
          
          	<!--
          	<Port Location="XS1_PORT_4B" Name="PORT_BUTTONS"></Port>
          	<Port Location="XS1_PORT_4C" Name="LED_ROWS"></Port>
          	<Port Location="XS1_PORT_4D" Name="LED_COLUMNS"></Port>
          	-->
          	
          </Tile>
          </Node>
          
          <Node Id="1" InPackageId="1" Type="periph:XS1-SU" Reference="usb_tile" Oscillator="24MHz"></Node>
        
      </Nodes>
      
     
      <Links>
        <Link Encoding="5wire">
          <LinkEndpoint NodeId="0" Link="8" Delays="52clk,52clk"/>
          <LinkEndpoint NodeId="1" Link="XL0" Delays="1clk,1clk"/>
        </Link>
      </Links>
	      
      
      
    </Package>
  </Packages>
  <JTAGChain>
    <JTAGDevice NodeId="0"/>
  </JTAGChain>

</Network>
You'll notice some things that have been commented out due to my experimentation but as it stands now, the AN00124_CDC_VCOM_class example will compile and run OK with this XN.

If I comment out this section:

Code: Select all

<Links>
        <Link Encoding="5wire">
          <LinkEndpoint NodeId="0" Link="8" Delays="52clk,52clk"/>
          <LinkEndpoint NodeId="1" Link="XL0" Delays="1clk,1clk"/>
        </Link>
      </Links>
I'll get the following build error:
..\.\XUE216-512-TQ128-C20.xn: Error: XN11188 Network is not fully connected (no route from node "0" to node "1")
OK, makes sense. If I have more than one Node, I need to specify a link to route data between them.

Now, if I additionally comment out this section of the XN:

Code: Select all

<Node Id="1" InPackageId="1" Type="periph:XS1-SU" Reference="usb_tile" Oscillator="24MHz"></Node>
The project will build and run, but the device will not enumerate properly under Windows as a USB device. Also makes sense to me since it looks like I just disabled the USB tile altogether.

So this experimentation shows me that the USB tile is to be treated as a separate, isolated tile under its own Node. In order to use it, we must establish an xLink between the Nodes (general purpose tiles <---> usb_tile). So I went and read several XMOS documents (xConnect Architecture, XS-1 System Specification, XN Specification, xTIMEcomposer User Guide, the datasheet for this chip, the hardware manual for this platform, and lots more) and while I understand the concept of xConnect and xLinks, I just cant grasp how they are actually implemented and used.

For this specific application, the links defined by the XN connect the USB PHY to the 2 general purpose tiles:

Code: Select all

Links>
        <Link Encoding="5wire">
          <LinkEndpoint NodeId="0" Link="8" Delays="52clk,52clk"/>
          <LinkEndpoint NodeId="1" Link="XL0" Delays="1clk,1clk"/>
        </Link>
      </Links>
Where are these links? According to the supporting documentation, XL0 is a 2 wire link yet here it is configured to be used in a 5 wire link. Also, I don't know what Link="8" is referring to. XL8?

I read that there are internal xLinks which can be used for communication within a chip and external xLinks that have external pins that can be used to talk to other xCore chips and/or devices. Are the links in this XN internal xLinks?

I searched throughout the source code of the project and XUD library to see if there were any referenced to these xLinks and how the pass data to each other but couldn't find anything helpful.

Any guidance will be very much appreciated!!


will1979
Member
Posts: 12
Joined: Mon Oct 26, 2015 11:06 am

Post by will1979 »

The link itself will be somewhere in the package I guess; connecting the USB PHY and the digital tiles. Not sure if you can see that without an electron-microscope.

You will not see those links anywhere in the source code - links are never visible as all communication takes place over channels, or by writing and reading into remote control registers. You may find references to "usb_tile"; traffic to that tile will go over the link that you isolated.
User avatar
aneves
Experienced Member
Posts: 93
Joined: Wed Sep 16, 2015 2:38 pm

Post by aneves »

will1979 wrote:The link itself will be somewhere in the package I guess; connecting the USB PHY and the digital tiles. Not sure if you can see that without an electron-microscope.

You will not see those links anywhere in the source code - links are never visible as all communication takes place over channels, or by writing and reading into remote control registers. You may find references to "usb_tile"; traffic to that tile will go over the link that you isolated.
OK, cool. Thanks for the reply!!

So, when an xlink is defined in the XN file, it is implicitly used when you use channels to share data between those Nodes/Tiles?

So I could define any 2 LinkEndpoints to connect these 2 Nodes and the tools will auto-magically figure out the gory details when I use channels in XC to communicate back and forth?
will1979
Member
Posts: 12
Joined: Mon Oct 26, 2015 11:06 am

Post by will1979 »

Yes - that is right,

All the things you saw in the XN file enable the tools to work out how to set up the XCONNECT logic. When that is completed, all tasks can communicate with each using channels; whether they reside next to each other or on different chips. All traffic between chips is routed over the links.

There is a document on XCONNECT on the XMOS website.
User avatar
aneves
Experienced Member
Posts: 93
Joined: Wed Sep 16, 2015 2:38 pm

Post by aneves »

will1979 wrote:Yes - that is right,

All the things you saw in the XN file enable the tools to work out how to set up the XCONNECT logic. When that is completed, all tasks can communicate with each using channels; whether they reside next to each other or on different chips. All traffic between chips is routed over the links.

There is a document on XCONNECT on the XMOS website.
will1979 - thanks for replying! I really appreciate it.

I've read that doc several times. It certainly explains the concept well enough, just not some of the details I think are taken for granted.

For instance, if I change the Link number for Node 0 (general purpose tiles) to anything other than the original value (which was 8) and try to debug my program, I get the following error for xTime:

Code: Select all

First stage multi-node boot failed, please check XN file and Xmos link connectivity
Why is that?

Looking at the data sheet for this chip that is on my board, there are only a total of 4 xlinks which are bonded to pins on the package. I would expect this error on a few of the xlinks, but not all but the last.

If I only change the Link number for Node 1 (the usb tile) then I can build and run the project, but the USB device will not enumerate.

Does the USB PHY only have 1 xlink?

Thanks for your help!
will1979
Member
Posts: 12
Joined: Mon Oct 26, 2015 11:06 am

Post by will1979 »

The links are physical wires on a PCB (or a cable, or maybe inside a package), so unless you change the cabling, you cannot change any link number and expect it to work. The other way around, the XN file is a description of the cabling; if the description does not match the physical wires, the tools will make something that ought to work, but cannot work because the wires are in the wrong place.

In the hardware link "8" on nodeId "0" must be connected to link "XL0" on nodeId "1" (whatever that means); otherwise your original XN file cannot work. If you change that to something else, say "7" on nodeId "0", then the tools will build something that won't work, hence the system produces an error when it is trying to run it. Not sure what happens when you change the other one; it seems to fail in a different way, but still fail.
User avatar
aneves
Experienced Member
Posts: 93
Joined: Wed Sep 16, 2015 2:38 pm

Post by aneves »

I guess that's my point. Since the usb tile is internal on the chip and so are the general purpose tiles, why wouldn't changing the link numbers work? At the very least, I would expect it to work with xlink IDs which are not bonded out to external pins. Every xLink is at minimum internal, right? There is no "cabling" that can be changed. I thought all tiles were wired to the same switch.

Seems like there is some simple detail I'm still missing.
will1979
Member
Posts: 12
Joined: Mon Oct 26, 2015 11:06 am

Post by will1979 »

Even though they are internal, there is still a set of cables between them, and that set of cables is connected to endpoint 8 on one side, and endpoint XL0 on the other; if you change the '8' to '5', you tell the system "If you enabled link end point 5, then you will find a USB tile on the other side"; the system will enable '5', send a message to the USB tile, and nothing happens; because '5' is not connected to anything.

It will only ever work if the XN file describes the system accurately. The XN file is not a design, plan, or wish; it is an accurate description of the physical design. So if the XN file is wrong, then the program won't work, because it doesn't match reality.

Ie, you design a piece of hardware, then you create an XN file that tells the tools what the hardware looks like, and now you can use the hardware.
User avatar
aneves
Experienced Member
Posts: 93
Joined: Wed Sep 16, 2015 2:38 pm

Post by aneves »

Light Bulb

OK OK OK, I see what you're saying now.

Last thing (maybe), is it accurate to say that any xlinks not bonded out to external pins are reserved purely for internal channel use in XC? That is, you should never have to define Links in an XN file for internal links because those are created on the fly when you use channels to communicate between threads?

THANKS!!
will1979
Member
Posts: 12
Joined: Mon Oct 26, 2015 11:06 am

Post by will1979 »

It is true to say that you never have to define links for communication inside the node. Communication inside a tile is performed directly by the processor. Communication between two tiles inside a node is goes through the switch but not through any links. Links are just the physical entity for communicating between nodes.
Post Reply