XR-AVB-LC-BRD 48kHz sampling to 96kHz

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
Post Reply
norman
Active Member
Posts: 55
Joined: Wed Jan 11, 2012 2:27 pm

XR-AVB-LC-BRD 48kHz sampling to 96kHz

Post by norman »

By default, the source code provided on githhub avb software stack (5.1.2) is for 24bits 48kHz audio sampling. I'm trying to change the code for a 24bits 96kHz sampling. Of course, i'm facing difficulties :
some jitter and console error
"Media output n (any channel) locked: x (from -100 et +100) samples shorter
Media output n lost lock"
Sound like part of good sample between jitter and freeze. Should start checking the output buffer. The audio output is better and seems to get stability after 1 min.


the modification for now :

xr_avb_demo.xc

Code: Select all

// this is the sample rate, the frequency of the word clock
#define SAMPLE_RATE 96000 //48000

// This is the number of master clocks in a word clock
#define MASTER_TO_WORDCLOCK_RATIO 256 //512
media_input_fifo.h

Code: Select all

#ifndef AVB_MAX_AUDIO_SAMPLE_RATE
#define AVB_MAX_AUDIO_SAMPLE_RATE (96000)	//48000
#endif

#ifndef MEDIA_INPUT_FIFO_SAMPLE_FIFO_SIZE
#define GET_SIZE(x) (x == 44100 || x == 96000) ? 64 : 256
//#define GET_SIZE(x) (x == 44100 || x == 48000) ? 64 : 128
#define MEDIA_INPUT_FIFO_SAMPLE_FIFO_SIZE (GET_SIZE(AVB_MAX_AUDIO_SAMPLE_RATE))
#endif
media_output_fifo.h

Code: Select all

#ifndef AVB_MAX_AUDIO_SAMPLE_RATE
#define AVB_MAX_AUDIO_SAMPLE_RATE (96000) 	//48000
#endif
media_clock_support.c

Code: Select all

#ifndef AVB_MAX_AUDIO_SAMPLE_RATE
#define AVB_MAX_AUDIO_SAMPLE_RATE 96000		//48000
#endif
avb_1722_def.h

Code: Select all

#define AVB1722_DEFAULT_FDF                    (4) //2

// The rate of 1722 packets (8kHz) -> 16kHz
#define AVB1722_PACKET_RATE (16000)
I'm starting to use card/ide/tools so it is like jumping up the cliff... It is so much possible that i'm wrong. I have still source code to study but some external advice will be great.
Last edited by norman on Thu Apr 19, 2012 8:16 am, edited 1 time in total.


norman
Active Member
Posts: 55
Joined: Wed Jan 11, 2012 2:27 pm

Post by norman »

(update ! :) )
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Post by Andy »

Hi norman,

#define AVB1722_PACKET_RATE should not be set to 16000. The audio locking process has been tuned to work at 8000 Hz and it is perfectly valid and normal for 96 kHz to use the 8 kHz Qav shaped rate.
norman
Active Member
Posts: 55
Joined: Wed Jan 11, 2012 2:27 pm

Post by norman »

Hi,

Thanks for the advice, i still have problems with it but will look forward. With 8kHz, i get 12 samples by ethernet frame (and 6 with 16kHz). I'm wondering if it is all right...
i try lot of test, you see, by chance to have some clue but i'm very confused. It is lot of code and parameters to handle for a start.
And i haven't success to use the real time or offline scope to help (will probably ask in another thread). But the chip look powerful (use to work with freescale 8 bit... that's a jump.), that's great.
norman
Active Member
Posts: 55
Joined: Wed Jan 11, 2012 2:27 pm

Post by norman »

Can't do better for now... Because i've still have console error
"Media output n lost lock
Media output x locked: -149 samples shorter" (with always around 150 samples shorter)

i focus my search on it and try different simple_printf (can't do safe debug search with memory/expressions/variables :? have trouble with always zero, can't display...)
To get think simple (maybe not), I'm only using the ptp grand master card for input and ptp slave card for audio output.

In media_clock_server.xc, with 48kHz, i can get something like :
"sample_diff 0 diff -337 wordLength 136533332 presentation_timestamp 11000360 ptp_outgoing_actual 11000023 "
from a sample to another, values are stable and audio is ok

with 96kHz, i get
"sample_diff -149 diff -1553114 wordLength 68266666 presentation_timestamp 449172372 ptp_outgoing_actual 447619258
sample_diff -149 diff -1557204 wordLength 68266666 presentation_timestamp 460280652 ptp_outgoing_actual 458723448
sample_diff -149 diff -1560923 wordLength 68266666 presentation_timestamp 471388592 ptp_outgoing_actual 469827669 "

Should meaning that the local ptp clock is much too different from the ptp master clock and no matter the wordlength, the diff is too high to keep the lock. It's supposition of course... But cannot understand why.
norman
Active Member
Posts: 55
Joined: Wed Jan 11, 2012 2:27 pm

Post by norman »

too simple to be true (?)
as the amos avb design guide says : with 96kHz, you can have only 4 in and 4 audio out (instead of 8 / 8 for 48kHz)

in avb_conf.h :

Code: Select all

#define AVB_NUM_MEDIA_OUTPUTS 4    //8
#define AVB_NUM_MEDIA_INPUTS 4        //8
no console error and audio seems ok. I will do more tests for validation.
Last edited by norman on Wed Apr 25, 2012 1:29 pm, edited 2 times in total.
norman
Active Member
Posts: 55
Joined: Wed Jan 11, 2012 2:27 pm

Post by norman »

So can we expect that the new L2 chip can handle 8 IN/OUT with the new spec ? (1000 MIPS 16 threads... instead of 500 MIPS) 8-)
Post Reply