Page 11 of 60

Re: Ultralite AVB

Posted: Sun Jan 27, 2019 10:44 am
by Drumfix
The patches can only prevent the channel flipping due to the alsa xrun recovery, not if the interrupt handling is delayed by other means.
For the device to work properly with USB following RT priorities is necessary:

Highest priority: the IRQ thread of the USB ehci host controller
Second highest: the ksoftirqd process that runs on the same perocessor core as the IRQ thread
Third highest: The audio process of the application

This works best if all three components are pinned to the same processor core and all other IRQs removed from the core.
Note, that renoise uses an exceptionally high RT priority (95) for its realtime threads, so i recommend to set a RT priority of 98 for the USB IRQ and 97 for the ksoftirqd

As for the state of AVB driver.
Currently it only provides 1 input stream and 1 output stream with 8 channels each that autoconnect to the Motu with hardcoded samplerate, stream id and destination MAC address. So not intended yet for the casual user. Operation though so far is flawless.

Achievable roundtrip latencies can be calculated by following formulas (verified using the Windows tool "RTL Utility" running with Wine/Wineasio):

Digital latency (A), ie AVB input and output streams directly connected in the Motu routing matrix:

At 44100, 48000: 10 samples
At 88200, 96000: 20 samples
At 176400, 192000: 40 samples

Analog Latency (B), i.e. latency added to the digital latency when going through analog out and back in through analog in (= DA to AD latency):

At 44100, 88200, 176400 : 50 samples
at 48000, 96000, 192000 : 51 samples

Buffersize (C)
Samplerate (D)

The total roundtrip latency in samples (X):

X = A + B + 2 * C

The total roundtrip latency in ms (M):

M = 1000 * X / D

Example: samplerate 44100, buffersize = 64:

X = 10 + 50 + 2 * 64 = 188
M = 1000 * 188 / 44100 = 4.263 ms

Lowest possible buffersize due to AVB packet format is
6 samples at 44100, 48000
12 samples at 88200, 96000
24 samples at 176400, 192000

Overall lowest possible roundtrip latency:

24 samples at 192000:

X = 40 + 51 + 2 * 24 = 139 samples
M = 1000 * 139 / 192000 = 0.724 ms

Re: Ultralite AVB

Posted: Mon Jan 28, 2019 1:55 pm
by pemberley
Drumfix, thanks for the advice about thread priority! I've made my audio output apparently stable by just reducing the realtime priority of the host thread. I think the priority of those other threads was set properly (thankfully, as I'm not sure how to change it), and I just needed to decrease the priority value at the application level.

For some reason, though, audio is still playing out of the wrong channel. The routing is wrong, but seems to be static; that is, audio sent to channel 1 will always come out channel 17. I can deal with this, of course, by just using a routing matrix that inverts this odd behavior, but it might be worth noting at least. Any idea why this could happen? Oddly, the inputs seem mapped fine, but the outputs have this issue.

Thanks again for all your help!

Re: Ultralite AVB

Posted: Wed Jan 30, 2019 1:02 pm
by pemberley
After trying it again last night, the channel jumping has returned. I thought it was an issue of the priority value on my DAW being set too high, since lowering it appeared to fix the issue earlier. Not sure what changed since then.

I'm afraid I'm a little new to this; how do I query or modify the priority values for the two other threads mentioned by Drumfix? How do I pin them to the same processor?

Re: Ultralite AVB

Posted: Wed Jan 30, 2019 9:08 pm
by murray
pemberley wrote: I'm afraid I'm a little new to this; how do I query or modify the priority values for the two other threads mentioned by Drumfix? How do I pin them to the same processor?
Ensure that you're running a real-time kernel and then install rtirq. There's a rather detailed Reddit post detailing the process here https://www.google.com/amp/s/amp.reddit ... =undefined

Re: Ultralite AVB

Posted: Wed Jan 30, 2019 9:54 pm
by Drumfix
The command

Code: Select all

chrt
is used to change the RT priority of a process.
Just use the attached script.

First make the script executable:

Code: Select all

chmod +x motu.txt
Then execute it with

Code: Select all

sudo ./motu.txt
Make sure you set 3 buffers in the audio configuration when using the Motu.

Re: Ultralite AVB

Posted: Thu Feb 07, 2019 3:24 am
by pemberley
Unfortunately, it's still not working. I've compiled my realtime kernel with the patches (formerly it wasn't a realtime kernel, but I've figured that out!) I've opened my MOTU interface with 3 periods, and a realtime priority of 0 or 40, and your script doesn't seem to fix the channel hopping. I've attached the full output of your script on my machine, but the most alarming part is "line 29: /proc/irq//smp_affinity: No such file or directory"

Again, I really appreciate your help on this matter. Any idea what could be going on with my system?

Re: Ultralite AVB

Posted: Thu Feb 07, 2019 7:35 pm
by stanlea
Pemberley, is the channel problem the only problem you have ? How about the stuttering bug ?

Re: Ultralite AVB

Posted: Thu Feb 07, 2019 7:43 pm
by pemberley
Stanlea, the channel hopping seems to be the only issue. Audio plays cleanly through some channel for some time (sometimes seconds, sometimes minutes), and then hops over to a different one. Sometimes that hopping takes a few seconds, during which audio fades crunchily on the channel it's leaving, but I think that the channel hopping is the only thing wrong. It's always the same channels too. 1 and 2 jump over to 17 and 18, then 11 and 12 (I think).

I'm a bit stuck; I thought switching to the patched realtime kernel and running that script to enforce proper thread priorities would fix this.

Re: Ultralite AVB

Posted: Thu Feb 07, 2019 8:26 pm
by Drumfix
Ah, looks like you have a single xhci (USB3) controller only, no ehci (USB2) controllers.

Then you need to change the line

Code: Select all

IRQ=`cat /proc/interrupts | grep hcd:usb${USB_BUS} | awk '{print $1}' | tr -d ':' | tr -d ' '`
to

Code: Select all

IRQ=`cat /proc/interrupts | grep xhci | awk '{print $1}' | tr -d ':' | tr -d ' '`
In your case the 3. line of output then should be:

Irq of related USB host controller is 123

Note: As you see the normal interrupt rt priority of your interrupts is 50, so you should set the rt priorirty of your daw (or jack if you use that) to 60.

PS: You seem to have 2 network cards with multiple rx/tx queues. If these are intel i210 or i211 you are a candidate for testing my AVB ethernet driver. :)

Re: Ultralite AVB

Posted: Fri Feb 08, 2019 2:30 am
by pemberley
I do indeed get

Code: Select all

Irq of related USB host controller is 123
now! However, there are a couple other issues that seem to be preventing this from working (I added two lines to the script to comment out the original USB2 stuff):

Code: Select all

./motu.txt: line 25: echo: write error: Input/output error
...

Code: Select all

chrt: failed to get pid 97's policy: No such process
Any chance the priority values and pids are getting switched here? That's right where you try to set a priority to 97.

Again, here's the full output from your script. And I look forward to trying out your AVB driver! I was hoping my hardware might be compatible.

Re: Ultralite AVB

Posted: Fri Feb 08, 2019 10:33 am
by stanlea
pemberley wrote:Stanlea, the channel hopping seems to be the only issue. Audio plays cleanly through some channel for some time (sometimes seconds, sometimes minutes), and then hops over to a different one. Sometimes that hopping takes a few seconds, during which audio fades crunchily on the channel it's leaving, but I think that the channel hopping is the only thing wrong. It's always the same channels too. 1 and 2 jump over to 17 and 18, then 11 and 12 (I think).

I'm a bit stuck; I thought switching to the patched realtime kernel and running that script to enforce proper thread priorities would fix this.
Thanks pemberley, I was asking because there are a lot of topics in one, and this thread is more now about the MOTU AVB range than just the Ultralite AVB. On my side (and this explains a little more my questions) I have just bought a 828ES, and was crossing fingers about the stutter bug. And I had it. :(
But flashing the bios of the unit with the very first version the firmware solved it. :D At least until now, I need to make some more tests in order to be sure about the performance of the card. Actually I have no channel hopping. Are you using Jack 1 or Jack 2 and what are your settings (channels numbers, frames,...)

Re: Ultralite AVB

Posted: Fri Feb 08, 2019 6:01 pm
by Drumfix
No need to care about the i/o error.

But i forgot:

Change also

Code: Select all

TID_IRQ=`ps -eTo tid,comm | grep "irq/${IRQ}" | grep _hcd | awk '{print $1}'`
to

Code: Select all

TID_IRQ=`ps -eTo tid,comm | grep "irq/${IRQ}" | grep xhci | awk '{print $1}'`

Re: Ultralite AVB

Posted: Fri Feb 08, 2019 6:18 pm
by jmccoy555
Well after a week or so playing around with v1.2.9+1280 it isn't stable for me, even with no USB plugged in! I keep getting UI lock-ups, both the web and the unit itself although the audio continues to work fine...... back on the latest update now which 'was' fine.

edit: so this was a complete lie..... this was a network issue, more specifically a VLAN tagging issue. Back on v1.2.9+1280 now and all is stable. So the network interface is just as sensitive as the USB interface :roll:

Big hands up for testing the AVB ethernet driver whenever its ready :D

Re: Ultralite AVB

Posted: Sat Feb 09, 2019 1:39 am
by pemberley
That's dealt with the error in the script, but unfortunately audio is still bouncing around between channels. I've attached the updated output of your motu.txt script. I've set the sample rate to 96k, 24 bits, priority value of 60 selected in Reaper. I've tried buffer sizes of 256 and 1024 samples, and periods of 2 and 3. It doesn't seem to care whether I use JACK or not; usually I've been testing right on top of ALSA. Also, I tried using one of the USB 2 only ports on my computer, just in case that happened to change anything.

Any ideas? Again, thanks for all your help so far.

Re: Ultralite AVB

Posted: Sat Feb 09, 2019 7:15 am
by stanlea
How many audio channels do you see in jack ?