why ATAT RX clock invalid when run MIDI on xu224 board Topic is solved

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
susanyin0501
Member
Posts: 15
Joined: Thu Apr 20, 2017 9:00 am

why ATAT RX clock invalid when run MIDI on xu224 board  Topic is solved

Postby susanyin0501 » Fri Sep 08, 2017 11:58 am

Dear all,
we meet a issue that ATAT RX clock invalid when run MIDI on xu224 board, would you please help checking xn configuration and give some advices about clock configuration, thanks
configuration like : Tile0 USB, ADAT_RX SPDIF_RX
Tile1 audio SPDIF_RX, ATAD_TX
Tile2 mixer, now no use
Tile3 MIDI, just this function

Just MIDI run on Tile3, ATAT_RX clock will be invalid. why?
Attachments
XU224-1024-FB374-C40_net.xn
(5.13 KiB) Downloaded 25 times
XU224-1024-FB374-C40_net.xn
(5.13 KiB) Downloaded 25 times
Last edited by susanyin0501 on Wed Sep 13, 2017 1:26 am, edited 2 times in total.
View Solution
User avatar
infiniteimprobability
XCore Expert
Posts: 874
Joined: Thu May 27, 2010 10:08 am
Contact:

Postby infiniteimprobability » Mon Sep 11, 2017 2:24 pm

Hi, was ADAT RX working fine before? If so which configuration did you have?

The call to validSamples(adatCounters, CLOCK_ADAT_INDEX); checks number of samples received over a period (1/300th of a second) timed by an internal timer to see if it is within tolerance. It reports via setClockValidity() which sends an interrupt message to the host.

Does ADAT Rx work Ok (it should still work if clock is not valid but will just be noisy)?

Have you setup your tiles properly in customdefines.h?
User avatar
infiniteimprobability
XCore Expert
Posts: 874
Joined: Thu May 27, 2010 10:08 am
Contact:

Postby infiniteimprobability » Mon Sep 11, 2017 3:13 pm

Just spotted something - PORT_PLL_REF needs to be on the same tile as digital audio Rx...
susanyin0501
Member
Posts: 15
Joined: Thu Apr 20, 2017 9:00 am

Postby susanyin0501 » Tue Sep 12, 2017 11:45 am

Hi infiniteimprobability, thanks for your reply!
ADAT RX can work well before running MIDI, and also MIDI can work well if no receiving ADAT_RX.
yes, they (MIDI, SPDIF,ATAD and 8 analog in/out , all loopback with cables) still work if clock is not valid, but if you pull off usb cable, then insert it again, USB can't connect to PC for ever. you must power on board.
susanyin0501
Member
Posts: 15
Joined: Thu Apr 20, 2017 9:00 am

Postby susanyin0501 » Tue Sep 12, 2017 11:54 am

in my project, PORT_PLL_REF defines in Tile1, ADAT_RX and SPDIF_RX are in tile 0, but MIDI run in tile 3 ! is this reason?
Last edited by susanyin0501 on Wed Sep 13, 2017 1:21 am, edited 1 time in total.
susanyin0501
Member
Posts: 15
Joined: Thu Apr 20, 2017 9:00 am

Postby susanyin0501 » Tue Sep 12, 2017 11:57 am

this is my customdefines.h

#include "user_main.h"

/*
* Device configuration option defines to override default defines found devicedefines.h
*
* Build can be customised but changing and adding defines here
*
* Note, we check if they are already defined in Makefile
*/



/* Default to board version version 2.0 */
#ifndef XCORE_200_MC_AUDIO_HW_VERSION
#define XCORE_200_MC_AUDIO_HW_VERSION 2
#endif

/* Tile defines */
#define AUDIO_IO_TILE 1
#define XUD_TILE 0

/* SPDIF Tx i/o moved tile between board versions 1.0 -> 2.0 */
#if XCORE_200_MC_AUDIO_HW_VERSION < 2
#define SPDIF_TX_TILE 1
#endif



/* Mixer core enabled by default */
#ifndef MIXER
//#define MIXER 1
#endif

/* Mixing disabled by default */
#ifndef MAX_MIX_COUNT
#define MAX_MIX_COUNT 0
#endif

/* Board is self-powered i.e. not USB bus-powered */
#define SELF_POWERED 1

/* Enable/Disable MIDI - Default is MIDI off */
#ifndef MIDI
#define MIDI 1
#endif

/* Enable/Disable SPDIF output - Default is S/PDIF on */
#ifndef SPDIF_TX
#define SPDIF_TX 1
#endif

/* Defines relating to channel count and channel arrangement (Set to 0 for disable) */
//:audio_defs
/* Number of USB streaming channels - Default is 4 in 4 out */
#ifndef NUM_USB_CHAN_IN
#define NUM_USB_CHAN_IN (8) /* Device to Host */
#endif
#ifndef NUM_USB_CHAN_OUT
#define NUM_USB_CHAN_OUT (8) /* Host to Device */
#endif

/* Number of IS2 chans to DAC..*/
#ifndef I2S_CHANS_DAC
#define I2S_CHANS_DAC (8)
#endif

/* Number of I2S chans from ADC */
#ifndef I2S_CHANS_ADC
#define I2S_CHANS_ADC (8)
#endif

/* Channel index of SPDIF Rx channels (duplicated DAC channels 1/2 when index is 0) */
#define SPDIF_TX_INDEX (8)

/* Channel index of SPDIF Rx channels */
#define SPDIF_RX_INDEX (8)

/* Channel index of ADAT Tx channels */
#if defined(SPDIF_TX) && (SPDIF_TX==1)
#define ADAT_TX_INDEX (SPDIF_TX_INDEX + 2)
#else
#define ADAT_TX_INDEX (I2S_CHANS_DAC)
#endif

/* Channel index of ADAT Rx channels */
#if defined(SPDIF_RX) && (SPDIF_RX==1)
#define ADAT_RX_INDEX (SPDIF_RX_INDEX + 2)
#else
#define ADAT_RX_INDEX (I2S_CHANS_ADC)
#endif

/* Master clock defines (in Hz) */
#define MCLK_441 (512*44100) /* 44.1, 88.2 etc */
#define MCLK_48 (512*48000) /* 48, 96 etc */

/* Maximum frequency device runs at */
#ifndef MAX_FREQ
#define MAX_FREQ (192000)
#endif

#define UART_TILE 1
#define I2C_TILE 1
#define MIXER_TILE 2
#define REVERB_TILE 3
#define MIDI_TILE 3


#ifndef DFU
#define DFU 1
#endif
/* enable valid alternate settings control */
//#define ENABLE_VALID_ALTERNATE_CONTROL 0 //170727

/* filter valid alternate settings, remove redundant formats */
// #define FILTER_ALTERNATE_SETTINGS 1

/* report current I/O frequency */
#define REPORT_SPDIF_FREQ 1

#define INPUT_VOLUME_CONTROL 1

#define OUTPUT_VOLUME_CONTROL 0 //170727

// for default xmos ID

#define VENDOR_ID (0x20B1) /* XMOS VID */
#define PID_AUDIO_2 (0x0008) /* SKC_SU1 USB Audio Reference Design PID */
#define PID_AUDIO_1 (0x0009) /* SKC_SU1 Audio Reference Design PID */


/* FW Version ((BCD_DEVICE_J << 8) | ((BCD_DEVICE_M & 0xF) << 4) | (BCD_DEVICE_N & 0xF)) */

#define BCD_DEVICE_J 0x00

/**
* @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
*/
#define BCD_DEVICE_M 0x01

/**
* @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
*/
#define BCD_DEVICE_N 0x00


/* Enable/Disable example HID code */
#ifndef HID_CONTROLS
#define HID_CONTROLS 0
#endif

#endif
User avatar
infiniteimprobability
XCore Expert
Posts: 874
Joined: Thu May 27, 2010 10:08 am
Contact:

Postby infiniteimprobability » Wed Sep 13, 2017 4:02 pm

in my project, PORT_PLL_REF defines in Tile1, ADAT_RX and SPDIF_RX are in tile 0, but MIDI run in tile 3 ! is this reason?

Sorry I think this was a red herring actually. The clockgen process connects to adat rx over a channel so they can be on different tiles..

What you are doing should be fine. I think to progress this (mutual exclusivity of ADAT and MIDI) we need to get some debug visibility.

where is the processor (do xrun --dumpstate) when:

if you pull off usb cable, then insert it again, USB can't connect to PC for ever. you must power on board.


You say
ADAT RX can work well before running MIDI, and also MIDI can work well if no receiving ADAT_RX.
so can you provide a dumpstate of when midi and adat are running together?

You may also want to enable xscope (-fxscope -DXSCOPE=1 in makefile) and put a few short prints in the code (eg. clockgen case inuint_byref(c_adat_rx, tmp): ) to see if things are still streaming as expected.
User avatar
infiniteimprobability
XCore Expert
Posts: 874
Joined: Thu May 27, 2010 10:08 am
Contact:

Postby infiniteimprobability » Wed Sep 13, 2017 4:15 pm

I have had an idea. Your issue may be due to channel congestion. Quite a few of the channels (eg adat rx, spdif rx and MIDI as well as c_mix_out) are circuit switched. This means they keep the connection open in between data transfer.
The chip only has 4 switch paths between tiles as follows:


Image

I think enabling midi is block adat and vice versa, literally, by using all of the switch connections.
User avatar
infiniteimprobability
XCore Expert
Posts: 874
Joined: Thu May 27, 2010 10:08 am
Contact:

Postby infiniteimprobability » Thu Sep 14, 2017 8:18 am

Excuse the messy diagram, but here's a rough idea of what is happening. The channels labelled are all circuits for USB audio so I can see how you could exceed 4 switch paths.
By moving SPDIF/ADAT RX to either tile 1,2 or 3 you make things a lot eaiser. Then having MIDI on tile 0 will mean that c_midi doesn't take a switch path too. This means you will still have a spare switch path for other functions and/or xscope debugging too.

There are lots of options here but I think tile placement and resulting switch path usage is the heart of the issue you see.


Image
susanyin0501
Member
Posts: 15
Joined: Thu Apr 20, 2017 9:00 am

Postby susanyin0501 » Fri Sep 15, 2017 3:51 am

Thank a lot, infiniteimprobability
i tried the following two ways, Resolved this issue.
1, move ADAT RX from Tile 0( usb on this tile) to Tile3 ( just MIDI before, now ADTA_RX and MIDI together)
2, if I disabled SPDIF_RX on Tile 0 ( remain ADTA_RX), it can work well too
we use the first way, because SPDIF_RX is needed in my project.

Return to “Applications”

Who is online

Users browsing this forum: No registered users and 9 guests