Page 2 of 2

Re: Using AVB library at speed != 48kHz

Posted: Fri Jul 13, 2018 1:42 pm
by akp
I didn't have to reorder the talker channel map I don't think. I pretty much have the FSYNC set up with a -1 offset like in I2S, I don't use MSB framing. But it shouldn't really matter.

Re: Using AVB library at speed != 48kHz

Posted: Fri Jul 13, 2018 2:09 pm
by azs
Okay thanks !
Dig...dig...dig !

Re: Using AVB library at speed != 48kHz

Posted: Mon Jul 16, 2018 10:43 am
by azs
Well, it seem's that I have a 1-BCLK shift on my samples but.... not all the times ! I can have ~5 to ~30 samples that are corrects, then the next one is shifted by one BCLK, making an audio error ! This is random, absolutely not cyclic.
Is it a "real-time" issue on the TDM interface ? Maybe does it wait for an other interface for some data that arrives too late ?

"Where" to look for this issue in the code ? :-s

PS : I tried the "set_core_high_priority_on()" on the tdm_master core, and also stops all other un-necessary interfaces, but not better.....

Re: Using AVB library at speed != 48kHz

Posted: Mon Jul 16, 2018 1:58 pm
by azs
Correction : this is not a clock shift of 1-bit, this is the MSbit that is missing (i.e. the LSBit still ends at the correct position, this is not shifted).
Test method : I send a -144dBFs signal, i.e. there is only 3 values that are output : 0x000000, 0x000001, 0xFFFFFF (i.e. 0, +1 and -1 respectively).
Sometimes (scope on the TDM bus with persistance infinite), I can read the value 0x7FFFFF, meaning that the MSBit of 0xFFFFFF was corrupted. This lead to the maximum value in positiv phase, instead of "-1".

Re: Using AVB library at speed != 48kHz

Posted: Mon Jul 16, 2018 2:02 pm
by akp
is this output from the XMOS to your FPGA or vice versa?

Re: Using AVB library at speed != 48kHz

Posted: Mon Jul 16, 2018 2:06 pm
by azs
Output from the XMOS (XMOS TDM out) that is scoped

Re: Using AVB library at speed != 48kHz

Posted: Mon Jul 16, 2018 2:14 pm
by akp
Sorry can't help you there as I don't do output from the XMOS at present.

Re: Using AVB library at speed != 48kHz

Posted: Tue Jul 17, 2018 10:03 am
by azs
Thanks akp. But debug continues an have some news. Here is my audio flow :

ASIO Sender -> FPGA device 1 --(TDM1)--> XMOS device 1 --------------------> AVB Network --------------------> XMOS device 2 --(TDM2)--> FPGA device 2 -> ASIO receiver

I send a -144dBFS on ASIO sender to see the -1 / 0 / +1 values (see post above).
When probing the TDM 1, everything was good, i.e. FPGA do the job as expected.
When probing TDM 2, I can see b23 of my audio word that is sometimes corrupted. That's why I was focusing on the TDM output.

But I tried something else : instead of sending audio from ASIO, I modified XMOS device 1 firmware to not use its TDM input as audio source, but directly use static value of 0xFFFFFF00 to send to AVB buffer.
Then still scope-out the TDM2. Now, I cannot see any TDM bit error !
This mean that my issue is not on TDM out part, but TDM in ! (I will try with others static values like 0x5555... and 0xAAA..... to be sure)

Conclusion : FPGA does output correct TDM words, but XMOS seems to miss some bits when sampling in ! So maybe simply a timing issue ?

Re: Using AVB library at speed != 48kHz

Posted: Tue Jul 17, 2018 11:29 am
by azs
Well, alright ! Now my AVB system is working @ 96kHz.
I changed the FPGA TDM data out clock edge, to "win" half period time, then add 8ns delay on XMOS TDM input pins with set_pad_delay() in order to have a good setup and hold time (estimated with scope on TDM bus).
Now I have good audio signal !

So it was just poor timing that was not highlighted @ 48k but critical @ 96k.

Thanks akp for your support.

Now still remains the "how to" change sample rate at runtime, but at least now I have a functional solution, this is a good starting point.

Happy, I am ;-)

Re: Using AVB library at speed != 48kHz

Posted: Tue Jul 17, 2018 12:56 pm
by akp
Glad to hear of your success! IO timing was for sure my first thought and the place it makes most sense is master TDM in rather than master TDM out since that is the interface most likely to show timing errors. Good luck!