This repo contains board specific hardware configuration code for various XMOS evaluation and development kits. By keeping the board-specific code in a dedicated repository various applications need not replicate commonly used code such as initialisation of on-board peripherals and in addition any updates or fixes can easily be rolled out to all dependent applications.
The following boards are supported in this repo with interfaces provided in the languages shown in the table below.
Board |
Supported Languages |
---|---|
XK_EVK_XU316 |
XC / C |
XK_AUDIO_316_MC_AB |
XC / C |
XK_AUDIO_216_MC_AB |
XC / C |
XK_EVK_XE216 |
XC |
XK_ETH_XU316_DUAL_100M |
XC |
Note
The XK_ETH_XU316_DUAL_100M board is currently unreleased and does not have official documentation. Please contact XMOS Support for futher information.
The following sections provide specific details of the features for each of the boards supported by this library.
The XMOS xcore.ai Multichannel Audio Board (XK-AUDIO-316-MC) is a complete hardware and software reference platform targeted at up to 32-channel USB audio applications, such as DJ decks, mixers and other musical instrument interfaces. The board can also be used to prototype products with reduced feature sets or HiFi style products.
The XK-AUDIO-316-MC is based around the XU316-1024-TQ128-C24 multicore microcontroller; a dual-tile xcore.ai device with an integrated High Speed USB 2.0 PHY and 16 logical cores delivering up to 2400MIPS of deterministic and responsive processing power.
Exploiting the flexible programmability of the xcore.ai architecture, the XK-AUDIO-316-MC supports a USB audio source, streaming 8 analogue input and 8 analogue output audio channels simultaneously - at up to 192kHz. It also supports digital input/output streams (S/PDIF and ADAT) and MIDI. Ideal for consumer and professional USB audio interfaces. The board can also be used for testing general purpose audio DSP activities - mixing, filtering, etc.
For full details regarding the hardware please refer to xcore.ai Multichannel Audio Platform Hardware Manual.
The location of the various features of the xcore.ai Multichannel Audio Board (XK-AUDIO-316-MC) is shown in Fig. 1.
xcore.ai Multichannel Audio Board hardware features
It includes the following features:
A: xcore.ai (XU316-1024-TQ128-C24) device
B: 8 line level analog inputs (3.5mm stereo jacks)
C: 8 line level analog outputs (3.5mm stereo jacks)
D: 384kHz 24 bit audio DACs
E: 192kHz 24 bit audio ADCs
F: Optical connections for digital interface (e.g. S/PDIF and ADAT)
G: Coaxial connections for digital interfaces (e.g. S/PDIF)
H: MIDI in and out connections
I: Flexible audio master clock generation
J: USB 2.0 micro-B jacks
L: 4 general purpose LEDs
M: 3 general purpose buttons
O: Flexible I²S/TDM input data routing
P: Flexible I²S/TDM output data routing
Q: Integrated power supply
R: Quad-SPI boot ROM
S: 24MHz Crystal
T: Integrated XTAG4 debugger
A total of eight single-ended analog input channels are provided via 3.5mm stereo jacks. These inputs feed into a pair of quad-channel PCM1865 ADCs from Texas Instruments.
A total of eight single-ended analog output channels are provided. These are fed from four PCM5122 stereo DAC’s from Texas instruments.
All ADC’s and DAC’s are configured via an I²C bus. Due to an clash of device addresses a I²C multiplexor is used.
The four digital I²S/TDM input and output channels are mapped to the xCORE input/outputs through a header array. These jumpers allow channel selection when the ADCs/DACs are used in TDM mode.
Optical and coaxial digital audio transmitters are used to provide digital audio input output in formats such as IEC60958 consumer mode (S/PDIF) and ADAT. The output data streams from the xcore are re-clocked using the external master clock to synchronise the data into the audio clock domain. This is achieved using simple external D-type flip-flops.
MIDI input and output is provided on the board via standard 5-pin DIN connectors compliant to the MIDI specification. The signals are buffered using 5V line drivers and are then connected ports on the xCORE, via a 5V to 3.3V buffer. A 1-bit port is used for receive and a 4-bit port is used for transmit. A pull-up resistor on the MIDI output ensures there is no MIDI output when the xcore device is not actively driving the output.
In order to accommodate a multitude of clocking options a flexible clocking scheme is provided for the audio subsystem.
Three methods of generating an audio master clock are provided on the board:
A Cirrus Logic CS2100-CP PLL device. The CS2100 features both a clock generator and clock multiplier/jitter reduced clock frequency synthesizer (clean up) and can generate a low jitter audio clock based on a synchronisation signal provided by the xcore
A Skyworks Si5351B PLL device. The Si5351 is an I²C configurable clock generator that is suited for replacing crystals, crystal oscillators, VCXOs, phase-locked loops (PLLs), and fanout buffers.
xcore.ai devices are equipped with a secondary (or application) PLL which can be used to generate audio clocks.
Selecting between these methods is done via writing to bits 6 and 7 of PORT 8D on tile[0]. See Control I/O.
Note
lib_board_support
currently only supports the xcore.ai secondary PLL and CS2100 device
4 bits of PORT 8C are used to control external hardware on the board. This is described in PORT 8C functionality.
Bit(s) |
Functionality |
0 |
1 |
---|---|---|---|
[0:3] |
Unused |
||
4 |
Enable 3v3 power for digital (inverted) |
Enabled |
Disabled |
5 |
Enable 3v3 power for analogue |
Disabled |
Enabled |
6 |
PLL Select |
CS2100 |
Si5351B |
7 |
Master clock direction |
Output |
Input |
Note
To use the xcore application PLL bit 7 should be set to 0. To use one of the external PLL’s bit 7 should be set to 1.
The board is capable of acting as a USB2.0 self or bus powered device. If bus powered, the board takes
power from the USB DEVICE
connector (micro-B receptacle). If self powered, board takes power
from EXTERNAL POWER
input (micro-B receptacle).
A power source select jumper (marked PWR SRC
) is used to select between bus and self-powered configuration.
Note
To remain USB compliant the software should be properly configured for bus vs self powered operation
For convenience the board includes an on-board xTAG4 for debugging via JTAG/xSCOPE.
This is accessed via the USB (micro-B) receptacle marked DEBUG
.
The XMOS xcore-200 Multi-channel Audio board (XK-AUDIO-216-MC) is a complete hardware and reference software platform targeted at up to 32-channel USB and networked audio applications, such as DJ decks and mixers.
The XK-AUDIO-216-MC is based around the XE216-512-TQ128 multicore microcontroller; an dual-tile xcore-200 device with an integrated High Speed USB 2.0 PHY, RGMII (Gigabit Ethernet) interface and 16 logical cores delivering up to 2000MIPS of deterministic and responsive processing power.
Exploiting the flexible programmability of the xcore-200 architecture, the XK-AUDIO-216-MC supports either USB or network audio source, streaming 8 analogue input and 8 analogue output audio channels simultaneously - at up to 192kHz.
For full details regarding the hardware please refer to xcore-200 Multichannel Audio Platform Hardware Manual.
A total of eight single-ended analog input channels are provided via 3.5mm stereo jacks. Each is fed into a CirrusLogic CS5368 ADC. Similarly a total of eight single-ended analog output channels are provided. Each is fed into a CirrusLogic CS4384 DAC.
The four digital I²S/TDM input and output channels are mapped to the xcore input/outputs through a header array. This jumper allows channel selection when the ADC/DAC is used in TDM mode
Optical and coaxial digital audio transmitters are used to provide digital audio input output in formats such as IEC60958 consumer mode (S/PDIF) and ADAT. The output data streams from the xcore-200 are re-clocked using the external master clock to synchronise the data into the audio clock domain. This is achieved using simple external D-type flip-flops.
MIDI I/O is provided on the board via standard 5-pin DIN connectors. The signals are buffered using 5V line drivers and are then connected to 1-bit ports on the xcore-200, via a 5V to 3.3V buffer.
A flexible clocking scheme is provided for both audio and other system services. In order to accommodate a multitude of clocking options, the low-jitter master clock is generated locally using a frequency multiplier PLL chip. The chip used is a Phaselink PL611-01, which is pre-programmed to provide a 24MHz clock from its CLK0 output, and either 24.576 MHz or 22.5792MHz from its CLK1 output.
The 24MHz fixed output is provided to the xcore-200 device as the main processor clock. It also provides the reference clock to a Cirrus Logic CS2100, which provides a very low jitter audio clock from a synchronisation signal provided from the xcore-200.
Either the locally generated clock (from the PL611) or the recovered low jitter clock (from the CS2100) may be selected to clock the audio stages; the xcore-200, the ADC/DAC and Digital output stages. Selection is controlled via an additional I/O, bit 5 of PORT 8C.
The XMOS xcore.ai Evaluation Kit (XK-EVK-XU316) is an evaluation board for the xcore.ai multi-core microcontroller from XMOS.
xcore.ai Evaluation Kit
The XK-EVK-XU316 allows testing in multiple application scenarios and provides a good general software development board for simple tests and demos. The XK-EVK-XU316 comprises an xcore.ai processor with a set of I/O devices and connectors arranged around it, as shown in Fig. 3.
xcore.ai Evaluation Kit block diagram
External hardware features board include, four general purpose LEDs, two general purpose push-button switches, a PDM microphone connector, audio codec with line-in and line-out jack, QSPI flash memory, LPDDR1 external memory 58 GPIO connections from tile 0 and 1, micro USB for power and host connection, MIPI connector for a MIPI camera, integrated xTAG debug adapter and a reset switch with LED to indicate running.
For full details regarding the hardware please refer to XK-EVK-XU316 xcore.ai Evaluation Kit Manual.
Warning
The xcore.ai Evaluation Kit is a general purpose evaluation platform and should be considered an “example” rather than a fully fledged reference design.
A stereo CODEC (TLV320AIC3204), connected to the xcore.ai device via an I²S interface, provides analogue input/output functionality at line level.
The audio CODEC is are configured by the xcore.ai device via an I²C bus.
xcore.ai devices are equipped with a secondary (or application) PLL which is used to generate the audio clocks for the CODEC.
The XK-EVK-XU316 requires a 5V power source that is normally provided through the micro-USB cable J3. The voltage is converted by on-board regulators to the 0V9, 1V8 and 3V3 supplies used by the components.
The board should therefore be configured to present itself as a bus powered device when connected to an active USB host.
For convenience the board includes an on-board xTAG4 for debugging via JTAG/xSCOPE.
This is accessed via the USB (micro-B) receptacle marked DEBUG
.
The XCORE-200 Evaluation Kit features the XE216-512-TQ128 device with sixteen logical cores delivering up to 2000MIPS deterministically. The high-speed USB interface, 10/100/1000 Mbps Ethernet interface and 53 high-performance GPIO make it ideal for a wide range of applications, including networking and digital audio. The board also includes six servo interfaces for rapid prototyping of motor and motion control projects.
The kit also contains an XTAG debug adapter and is fully supported by the XTC Tools development environment.
For further information and detailed documentation please follow this link XK-EVK-XE216
This repo supports the XMOS build system; XCommon CMake. To use the library add lib_board_support
to an applications CMakeLists.txt file using the APP_DEPENDENT_MODULES entry. The application
must provide a relevant xn
file, although example xn
files are provided in alongside this
library (see xn_files directory).
The application must use the APIs for the specific board that it is using.
To ensure that only the correct sources for the board in use get compiled in, it is necessary to
set the preprocessor value BOARD_SUPPORT_BOARD
in the project to one of the available boards
listed in api/boards/boards_utils.h. This can be done in the app with the following snippet of
cmake:
set(APP_COMPILER_FLAGS
-DBOARD_SUPPORT_BOARD=XK_AUDIO_316_MC_AB # Change value to select board, see api/boards/boards_utils.h for available boards
)
From the application where board initialisation of configuration is done it is necessary to include the relevant header file. For example:
#include "xk_audio_316_mc_ab/board.h"
From then onwards the code may call the relevant API functions to setup and configure the board hardware. Examples are provided in the examples directory of this repo.
Note that in some cases, the xcore tile that calls the configuration function (usually from I²S initialisation) is different from the tile where I²C master is placed. Since I²C master is required by most audio CODECs for configuration and xcore tiles can only communicate with each other via channels, a remote server is needed to provide the I²C setup. This usually takes the form of a task which is run on a thread placed on the I²C tile and is controlled via a channel from the other tile where I²S resides. The cross-tile channel must be declared at the top-level XC main function. The included examples provide a reference for this using both XC and C.
Note
Sample XN files (hardware description for compiler) are provided in /xn_files
in the cases
where the compiler doesn’t support the platform directly. These can be copied into your
application directory where needed. See /examples
for usage.
This section contains the details of the API support by lib_board_support. The API is broken down into 2 sections:
Boards: This includes subdirectories for each supported board which need to be included in your application.
Drivers: This includes sources for configuring peripheral devices which may be on one or more of the supported boards.
This section contains the list of supported boards, one of which needs to be globally defined as
BOARD_SUPPORT_BOARD
in the project.
Define representing Null board i.e. no board in use
Define representing XK-AUDIO-216-MC Board
Define representing XK-AUDIO-316-MC Board
Define representing XK-EVK-XU316 board
Define representing XK-EVK-XU216 board
Define representing XK-ETH-XU316-DUAL-100M board
Total number of boards supported by the library
Define that should be set to the current board type in use
Default value: NULL_BOARD
Configuration struct type for setting the hardware profile.
Public Members
See xk_audio_316_mc_ab_mclk_modes_t for available clock mode options.
Boolean setting for whether the DAC or the xcore.ai is I2S clock master. Set to 0 to make the xcore.ai master.
Nominal clock frequency in MHz. Standard rates are supported between 11.2896 MHz and 49.152 MHz.
When the CLK_CS2100 is used, this defines the nominal reference clock frequency for multiplication by the PLL. This value is ignored when the CS2100 is not used.
See xk_audio_316_mc_ab_pcm_format_t for available data frame options.
Number of bits per data frame in I2S.
This defines the number of audio channels per frame (a frame is a complete cycle of FSYNC or LRCLK).
Type of clock to be instantiated. This may be a fixed clock using the application PLL, an adjustable clock using the CS2100 external PLL or an adjustable or fixed clock using the on-chip application PLL.
Values:
Formats supported by the DAC and ADC. Either I2S using multiple data lines or TDM supporting multi-channel using a single data line.
Values:
I2C interface ports
Starts an I2C master task. Must be started from tile[0] after xk_audio_316_mc_ab_board_setup() and before and tile[1] HW calls.
i2c – client side of I2C master interface connection.
Performs the required port operations to enable and the audio hardware on the platform. Must be called from tile[0] and before xk_audio_316_mc_ab_AudioHwInit() is called.
config – Reference to the xk_audio_316_mc_ab_config_t configuration struct.
Initialises the audio hardware ready for a configuration. Must be called once after xk_audio_316_mc_ab_board_setup().
i2c – Client side of I2C master interface connection.
config – Reference to the xk_audio_316_mc_ab_config_t hardware configuration struct.
Configures the audio hardware following initialisation. This is typically called each time a sample rate or stream format change occurs.
i2c – Client side of I2C master interface connection.
config – Reference to the xk_audio_316_mc_ab_config_t hardware configuration struct.
samFreq – The sample rate in Hertz.
mClk – The master clock rate in Hertz.
dsdMode – Controls whether the DAC is to be set into DSD mode (1) or PCM mode (0).
sampRes_DAC – The sample resolution of the DAC output in bits. Typically 16, 24 or 32.
sampRes_ADC – The sample resolution of the ADC input in bits. Typically 16, 24 or 32.
Causes the tile[0] to exit, freeing up a thread. Must be called from tile[1]. Once called, HW config calls from tile[1] will block forever. It is possible to re-start xk_audio_316_mc_ab_i2c_master() on tile[0] if needed to re-enable this service.
i2c – Client side of I2C master interface connection.
Configuration struct type for setting the hardware profile.
Public Members
See xk_audio_216_mc_ab_clk_mode_t for clock mode available options.
Boolean setting for whether the DAC or the xcore-200 is I2S clock master. Set to 0 to make the xcore-200 master.
USB port slection - see xk_audio_216_mc_ab_usb_sel_t for options.
See xk_audio_216_mc_ab_pcm_format_t for available pmc_format options.
When the external PLL is used, this defines the nominal reference clock frequency for multiplication by the PLL.
Type of clock to be instantiated. This may be a fixed clock using an external generator or an adjustable clock using an external PLL (CS2100) in either digital Rx clock recovery or USB clock recovery using synchronous mode.
Values:
Formats supported by the DAC and ADC. Either I2S using multiple data lines or TDM supporting multi-channel using a single data line.
Values:
Selects which USB port to use - either type A or type B.
Values:
Initialises the audio hardware ready for a configuration. Must be called once after xk_audio_316_mc_ab_board_setup().
config – Reference to the xk_audio_216_mc_ab_config_t hardware configuration struct.
Configures the audio hardware following initialisation. This is typically called each time a sample rate or stream format change occurs.
config – Reference to the xk_audio_216_mc_ab_config_t hardware configuration struct.
samFreq – The sample rate in Hertz.
mClk – The master clock rate in Hertz.
dsdMode – Controls whether the DAC is to be set into DSD mode (1) or PCM mode (0).
sampRes_DAC – The sample resolution of the DAC output in bits. Typically 16, 24 or 32.
sampRes_ADC – The sample resolution of the ADC input in bits. Typically 16, 24 or 32.
Configuration struct type for setting the hardware profile.
Public Members
xk_audio_316_mc_ab_config_t::clk_mode See xk_audio_316_mc_ab_mclk_modes_t for available clock mode options.
Command enumeration for channel based commands to I2C master server on other tile.
Values:
Starts an I2C master server task. Must be started before the tile[1] xk_evk_xu316_AudioHwInit calls. In the background this also starts a combinable channel to interface translation task so the API may be used over a channel end however it still only occupies one thread. May be exited after config by sending AUDIOHW_CMD_EXIT if dynamic configuration is not required.
c – Server side of channel connecting I2C master server and HW config functions.
Initialises the client side channel for remote communications with I2C. Must be called on tile[1] before xk_evk_xu316_AudioHwInit().
c – Client side of channel connecting I2C master server and HW config functions.
Initialises the audio hardware ready for a configuration. Must be called once after xk_evk_xu316_AudioHwRemote() and xk_evk_xu316_AudioHwChanInit().
config – Reference to the xk_audio_316_mc_ab_config_t hardware configuration struct.
Configures the audio hardware following initialisation. This is typically called each time a sample rate or stream format change occurs.
samFreq – The sample rate in Hertz.
mClk – The master clock rate in Hertz.
dsdMode – Controls whether the DAC is to be set into DSD mode (1) or PCM mode (0).
sampRes_DAC – The sample resolution of the DAC output in bits. Typically 16, 24 or 32.
sampRes_ADC – The sample resolution of the ADC input in bits. Typically 16, 24 or 32.
Task that connects to the SMI master and MAC to configure the ar8035 PHY and monitor the link status. Note this task is combinable (typically with SMI) and therefore does not need to take a whole thread. This task must be run from tile[1].
i_smi – Client register read/write interface
i_eth – Client MAC configuration interface
Task that connects to the SMI master and MAC to configure the DP83826E PHYs and monitor the link status. Note this task is combinable (typically with SMI) and therefore does not need to take a whole thread.
Note it may be necessary to modify R3 and R23 according to which PHY is used. Populate R23 and remove R3 for PHY_0 only populated otherwise populate R3 and remove R23 for all other settings.
i_smi – Client register read/write interface
i_eth_phy_0 – Client MAC configuration interface for PHY_0. Set to NULL if unused.
i_eth_phy_1 – Client MAC configuration interface for PHY_1. Set to NULL if unused.
Sends hard reset to both PHYs. Both PHYs will be ready for SMI communication once this function has returned. This function must be called from Tile[1].
Returns a timing struct tuned to the xk_eth_xu316_dual_100m hardware. This struct should be passed to the call to rmii_ethernet_rt_mac() and will ensure setup and hold times are maximised at the pin level of the PHY connection. rmii_port_timing_t is defined in lib_ethernet.
phy_idx – The index of the PHY to get timing data about (0 or 1).
The timing struct to be passed to the PHY.
Some simple example applications are provided in order to show how to use lib_board_support.
The applications app_evk_316_simple_c and app_xk_audio_316_mc_simple_c provide a bare-bones application where the hardware setup is called from C.
These applications run on the XK-EVK-XU316 and XK-AUDIO-316-MC boards respectively.
They show how to use the cross-tile communications in conjunction with the I²C master server. The applications only setup the hardware and then exit the I²C server.
The application app_xk_audio_316_mc_simple_xc demonstrates calling the hardware setup API from C. It runs on the XK-AUDIO-316-MC board.
To build and run an example, run the following from an XTC tools terminal to configure the build:
cd examples/<app_name>
cmake -G "Unix Makefiles" -B build
Any missing dependencies will be downloaded by the build system at this point.
The application binaries can be built using xmake
:
xmake -C build
To run the application use the following command:
xrun --io bin/<app_name>.xe
For example:
cd examples/app_xk_audio_316_mc_simple_xc
cmake -G "Unix Makefiles" -B build
xmake -C build
xrun --io bin/app_xk_audio_316_mc_simple_xc.xe