Problems using reference apps

New to XMOS and XCore? Get started here.
dweeb4
Active Member
Posts: 45
Joined: Mon Jan 19, 2015 12:47 pm

Problems using reference apps

Postby dweeb4 » Wed Feb 08, 2017 2:42 pm

I'm trying to build firmware for a board with XUF216-512-TQ128-C20 XMOS chip on board
I'm trying to use the reference software app_usb_aud_xk_216_mc as the basis for this build

When trying to use installed target XUF216-512-TQ128-C20 I got error messages about missing port definitions
Ony by reading the thread her "bug in USB" did I come across the realisation that the port definitions are incomplete in its xn file
I created a new xn file for XUF216-512-TQ128-C20 with the port definitions implemented & used the "install new hardware" option to install this xn target

I now get the build error message "xcc: error: unknown target `XUF216-512-TQ128-C20'"

Is there something I'm missing?

My xn file contents are as follows

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>XU216-512-TQ128-C20 Device</Name>

  <Declarations>
    <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]">
            <Port Location="XS1_PORT_1B" Name="PORT_SQI_CS"/>
            <Port Location="XS1_PORT_1C" Name="PORT_SQI_SCLK"/>
            <Port Location="XS1_PORT_4B" Name="PORT_SQI_SIO"/>
       
            <!-- Audio Ports -->         
            <Port Location="XS1_PORT_1A"  Name="PORT_PLL_REF"/>
            <Port Location="XS1_PORT_1F"  Name="PORT_MCLK_IN"/>
            <Port Location="XS1_PORT_1G"  Name="PORT_I2S_LRCLK"/>
            <Port Location="XS1_PORT_1H"  Name="PORT_I2S_BCLK"/>
            <Port Location="XS1_PORT_1M"  Name="PORT_I2S_DAC0"/>
            <port Location="XS1_PORT_1N"  Name="PORT_I2S_DAC1"/>
            <port Location="XS1_PORT_1O"  Name="PORT_I2S_DAC2"/>
            <port Location="XS1_PORT_1P"  Name="PORT_I2S_DAC3"/>
            <Port Location="XS1_PORT_1I"  Name="PORT_I2S_ADC0"/>
            <Port Location="XS1_PORT_1J"  Name="PORT_I2S_ADC1"/>
            <Port Location="XS1_PORT_1K"  Name="PORT_I2S_ADC2"/>
            <Port Location="XS1_PORT_1L"  Name="PORT_I2S_ADC3"/>
            <Port Location="XS1_PORT_4A"  Name="PORT_I2C"/>
            <Port Location="XS1_PORT_1M"  Name="PORT_DSD_DAC0"/>
            <port Location="XS1_PORT_1N"  Name="PORT_DSD_DAC1"/>
            <Port Location="XS1_PORT_1G"  Name="PORT_DSD_CLK"/>
            <Port Location="XS1_PORT_1E"  Name="PORT_ADAT_OUT"/>-->  <!-- D: COAX E: OPT -->
            <Port Location="XS1_PORT_1D"  Name="PORT_SPDIF_OUT"/>--> <!-- D: COAX E: OPT -->
          </Tile>
          <Tile Number="1" Reference="tile[1]">
            <Port Location="XS1_PORT_1H"  Name="PORT_USB_TX_READYIN"/>
            <Port Location="XS1_PORT_1J"  Name="PORT_USB_CLK"/>
            <Port Location="XS1_PORT_1K"  Name="PORT_USB_TX_READYOUT"/>
            <Port Location="XS1_PORT_1I"  Name="PORT_USB_RX_READY"/>
            <Port Location="XS1_PORT_1E"  Name="PORT_USB_FLAG0"/>
            <Port Location="XS1_PORT_1F"  Name="PORT_USB_FLAG1"/>
            <Port Location="XS1_PORT_1G"  Name="PORT_USB_FLAG2"/>
            <Port Location="XS1_PORT_8A"  Name="PORT_USB_TXD"/>
            <Port Location="XS1_PORT_8B"  Name="PORT_USB_RXD"/>
           
            <!-- Audio Ports -->
            <Port Location="XS1_PORT_16B" Name="PORT_MCLK_COUNT"/>             
            <Port Location="XS1_PORT_1L"  Name="PORT_MCLK_IN2"/>
            <Port Location="XS1_PORT_1M"  Name="PORT_MIDI_IN"/>
            <Port Location="XS1_PORT_1N"  Name="PORT_MIDI_OUT"/>
            <Port Location="XS1_PORT_1O"  Name="PORT_ADAT_IN"/>-->  <!-- P: COAX O: OPT -->
            <Port Location="XS1_PORT_1P"  Name="PORT_SPDIF_IN"/>--> <!-- P: COAX O: OPT -->
          </Tile>
        </Node>
        <Node Id="1" InPackageId="1" Type="periph:XS1-SU" Reference="usb_tile">
        </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>
mon2
XCore Expert
Posts: 604
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Postby mon2 » Wed Feb 08, 2017 5:41 pm

Howdy! Believe the reply from Choughtosh will help:

viewtopic.php?f=47&t=4073&view=next

Good morning,

For the xFlash to be able to work, it needs to know what flash device is attached to the xCORE-200. This is specified in an .XN file. When you set the target in the makefile to a specific device like XU216-512-TQ128-C20, the .xn file which is used (which can be found in [XMOS_INSTALL_DIR]/targets) does not contain any information regarding the flash devices.

To provide the appropriate information to xFlash you need to specify the target in the makefile to point to the .xn file which describes your board. In the case of the Multichannel Audio board the appropriate XN file can be found in the USB Audio Reference design. Copy the .xn file from the app_usb_aud_xk_216_mc\src\core directory and reference as the target in the make file (as per the make file for the app_usb_aud_xk_216_mc application.


also see here for the specific XN file for the CPU with internal flash:

viewtopic.php?f=3&t=4785

I used the example code provided in Xmos webiste (USB Audio 2.0 Device Software - source code) compiled using the mic_array_ref.xn file instead of XUF216-512-TQ128-C20.xn. I am currently streaming through USB the waveform of the 7 microphones and capturing the data through LabView platform using the Thesycon drivers.

Best regards,

Juan Luis
dweeb4
Active Member
Posts: 45
Joined: Mon Jan 19, 2015 12:47 pm

Postby dweeb4 » Wed Feb 08, 2017 6:52 pm

Hi again mon2 & again appreciation for your patience & time

So I should forget about the xn file for XUF216-512-TQ128-C20 & use the xk-aud-216-mc.xn file that comes in the app_usb_aud_xk_216_mc?

All mighty confusing - so the ports are named XS1_xxxxx ( which I presumed referred to the XS1_xxx chips & not XUF_xxx chips?)
For instance the 216-mc.xn file has <Package id="0" Type="XS2-UnA-512-FB236"> - is this still correct?
It has Type="XS2-L16A-512"??

I suspect all these names are kept as XS1_xx because that's how thet are referenced in the mc-aud app software & we are basically hijacking the softwar ebuilt for the MC XMOS board to work with this custom board? So we need to stick with these unique names?

It has this flash declaration which doesn't specify internal flash,does it?

Code: Select all

<Boot>
            <Source Location="SPI:bootFlash"/>
          </Boot>

And then goes on to declare prts for SQI flash?
But I don't know what the correct declaration for internal flash is - I've looked at the XMOS doc "XN Specification" but am none the wiser. Looking at the settings in XUF216-512-TQ128-C20.xn is of no value as there i sno boot decalaration there.

Does the xn file have the full settings for the chip I'm using i.e internal flash, etc or do I need to change things other than port mappings?

For instance, I will not be using a PLL for MCLK but have two separate audio clocks on the board & I need an enable signal (1 port) for each clock
Clock enable 22.5792Mhz Pin 8C3 (XOD29)
Clock enable 24.576Mhz Pin 8C7 (XOD33)
Which clock that is enabled will be based on logic in the main.c program which has to detect the samplerate of the audio file being transmitted via USB & depending on which speed family (44.1, or 48KHz) it belongs to enable the appropriate clock.

Sorry for all the quesions but as you can see I am just starting & know very little - just enough to be dangerous :)


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" ManuallySpecifiedRouting="true">
  <Type>Board</Type>
  <Name>XS2 MC Audio</Name>
  <Declarations>
    <Declaration>tileref tile[2]</Declaration>
    <Declaration>tileref usb_tile</Declaration>
  </Declarations>
  <Packages>
    <Package id="0" Type="XS2-UnA-512-FB236">
      <Nodes>
        <Node Id="0" InPackageId="0" Type="XS2-L16A-512" Oscillator="24MHz" SystemFrequency="500MHz" referencefrequency="100MHz">
          <Boot>
            <Source Location="SPI:bootFlash"/>
          </Boot>
          <Tile Number="0" Reference="tile[0]">
            <Port Location="XS1_PORT_1B" Name="PORT_SQI_CS"/>
            <Port Location="XS1_PORT_1C" Name="PORT_SQI_SCLK"/>
            <Port Location="XS1_PORT_4B" Name="PORT_SQI_SIO"/>
       
            <!-- Audio Ports -->         
            <Port Location="XS1_PORT_1A"  Name="PORT_PLL_REF"/>
            <Port Location="XS1_PORT_1F"  Name="PORT_MCLK_IN"/>
            <Port Location="XS1_PORT_1G"  Name="PORT_I2S_LRCLK"/>
            <Port Location="XS1_PORT_1H"  Name="PORT_I2S_BCLK"/>
            <Port Location="XS1_PORT_1M"  Name="PORT_I2S_DAC0"/>
            <port Location="XS1_PORT_1N"  Name="PORT_I2S_DAC1"/>
            <port Location="XS1_PORT_1O"  Name="PORT_I2S_DAC2"/>
            <port Location="XS1_PORT_1P"  Name="PORT_I2S_DAC3"/>
            <Port Location="XS1_PORT_1I"  Name="PORT_I2S_ADC0"/>
            <Port Location="XS1_PORT_1J"  Name="PORT_I2S_ADC1"/>
            <Port Location="XS1_PORT_1K"  Name="PORT_I2S_ADC2"/>
            <Port Location="XS1_PORT_1L"  Name="PORT_I2S_ADC3"/>
            <Port Location="XS1_PORT_4A"  Name="PORT_I2C"/>
            <Port Location="XS1_PORT_1M"  Name="PORT_DSD_DAC0"/>
            <port Location="XS1_PORT_1N"  Name="PORT_DSD_DAC1"/>
            <Port Location="XS1_PORT_1G"  Name="PORT_DSD_CLK"/>
            <Port Location="XS1_PORT_1E"  Name="PORT_ADAT_OUT"/>-->  <!-- D: COAX E: OPT -->
            <Port Location="XS1_PORT_1D"  Name="PORT_SPDIF_OUT"/>--> <!-- D: COAX E: OPT -->
          </Tile>
          <Tile Number="1" Reference="tile[1]">
            <Port Location="XS1_PORT_1H"  Name="PORT_USB_TX_READYIN"/>
            <Port Location="XS1_PORT_1J"  Name="PORT_USB_CLK"/>
            <Port Location="XS1_PORT_1K"  Name="PORT_USB_TX_READYOUT"/>
            <Port Location="XS1_PORT_1I"  Name="PORT_USB_RX_READY"/>
            <Port Location="XS1_PORT_1E"  Name="PORT_USB_FLAG0"/>
            <Port Location="XS1_PORT_1F"  Name="PORT_USB_FLAG1"/>
            <Port Location="XS1_PORT_1G"  Name="PORT_USB_FLAG2"/>
            <Port Location="XS1_PORT_8A"  Name="PORT_USB_TXD"/>
            <Port Location="XS1_PORT_8B"  Name="PORT_USB_RXD"/>
           
            <!-- Audio Ports -->
            <Port Location="XS1_PORT_16B" Name="PORT_MCLK_COUNT"/>             
            <Port Location="XS1_PORT_1L"  Name="PORT_MCLK_IN2"/>
            <Port Location="XS1_PORT_1M"  Name="PORT_MIDI_IN"/>
            <Port Location="XS1_PORT_1N"  Name="PORT_MIDI_OUT"/>
            <Port Location="XS1_PORT_1O"  Name="PORT_ADAT_IN"/>-->  <!-- P: COAX O: OPT -->
            <Port Location="XS1_PORT_1P"  Name="PORT_SPDIF_IN"/>--> <!-- P: COAX O: OPT -->
          </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>
  <Nodes>
    <Node Id="2" Type="device:" RoutingId="0x8000">
      <Service Id="0" Proto="xscope_host_data(chanend c);">
        <Chanend Identifier="c" end="3"/>
      </Service>
    </Node>
  </Nodes>
  <Links>
    <Link Encoding="2wire" Delays="4,4" Flags="XSCOPE">
      <LinkEndpoint NodeId="0" Link="XL0"/>
      <LinkEndpoint NodeId="2" Chanend="1"/>
    </Link>
  </Links>
  <ExternalDevices>
    <Device NodeId="0" Tile="0" Class="SQIFlash" Name="bootFlash" Type="S25FL116K">
      <Attribute Name="PORT_SQI_CS" Value="PORT_SQI_CS"/>
      <Attribute Name="PORT_SQI_SCLK"   Value="PORT_SQI_SCLK"/>
      <Attribute Name="PORT_SQI_SIO"  Value="PORT_SQI_SIO"/>
    </Device>
  </ExternalDevices>
  <JTAGChain>
    <JTAGDevice NodeId="0"/>
    <JTAGDevice NodeId="1"/>
  </JTAGChain>
</Network>
dweeb4
Active Member
Posts: 45
Joined: Mon Jan 19, 2015 12:47 pm

Postby dweeb4 » Wed Feb 08, 2017 9:23 pm

OK, at least that now compiles without error.
Now, where is the main.xc source - the main control logic - I can't find it anywhere in the app_usb_aud_xk_216_mc structure?

Edit: OK, found main.xc in module_USB_aud
Right, I can jump in here & try to make my way through the logic

Return to “Getting started”

Who is online

Users browsing this forum: No registered users and 2 guests