Ultralite AVB

Talk about your MIDI interfaces, microphones, keyboards...

Moderators: MattKingUSA, khz

nandoll
Established Member
Posts: 17
Joined: Mon Jul 29, 2019 10:29 pm

Re: Ultralite AVB

Post by nandoll »

nandoll wrote: Mon Apr 26, 2021 10:43 pm
Drumfix wrote: Mon Apr 26, 2021 6:45 am As mentioned earlier in this thread i use my own driver based on the ua101 driver.
...
Currently additionally proprietary mode must be activated by the curl command. Now that i know how to communicate with the device over USB i will add the related command to the driver soon.
Ah, I had been using the patch that adds the extra quirk (in the old quirks file). I think I tried your ua101 driver at some point (maybe last September) and it had problems, but regretfully I do not remember exactly what happened, sorry about that. I went back to the old one because it was mostly working.
I just tried the ua101.c again (8M with latest firmware):

== 5.11.8 + rt11 + ua101 driver: both vendor=0 and vendor=1 seem to work fine (very short tests).

Regretfully in both cases the video performance (Intel CoffeeLake-U GT3u video on an i7-8559U processor) is very choppy. I am running my software on SuperCollider + the QT gui and smooth movements in the gui are freezing for maybe one second randomly. This can also be seen if I drag a window around on the desktop. Not very usable.

This is what was happening to me when I briefly tried this a while back (now I remember). This was on an older kernel so this is not just this particular kernel release that has this problem.

== 5.9.1 + rt19 + old quirks and patches: 64 channels, mostly stable and what I have been using, no video problems.

== 5.11.15 plain fedora kernel: can be made to work in class compliant mode (but there is channel hopping) and video works fine as well.

So this only seems to happen to me with the ua101 driver...

kernel parameters: threadirqs, nowatchdog, acpi_irqnobalance, intel_idle.max_cstate=1
motu usb irq tasklet running with high SCHED_FIFO priority (higher than jackd)
hyperthreading disabled in the BIOS
all processors set to max speed, turbo disabled (through the intel_pstate driver)

Anything I could try to help debug this?
I could potentially build a plain fedora kernel with the ua101 patch (to get the rt patch out of the equation although I doubt that is the problem)...
Drumfix
Established Member
Posts: 299
Joined: Mon Jan 26, 2009 5:15 pm
Been thanked: 11 times

Re: Ultralite AVB

Post by Drumfix »

My advice is to run a low-latency kernel with irqthreads disabled instead of a rt-kernel and set the irq affinities so that the USB interrupt has its own core.
Also, you don't necessarily disable hyperthreading.
The driver does 8000 interrupts/sec, so the rt-kernel does 16000 task switches/per seconds while with the low-latency kernel there is no task switch. Instead the interupt and tasklets run in hard/soft interrupt context.
nandoll
Established Member
Posts: 17
Joined: Mon Jul 29, 2019 10:29 pm

Re: Ultralite AVB

Post by nandoll »

Drumfix wrote: Tue Apr 27, 2021 6:55 am My advice is to run a low-latency kernel with irqthreads disabled instead of a rt-kernel and set the irq affinities so that the USB interrupt has its own core.
Also, you don't necessarily disable hyperthreading.
The driver does 8000 interrupts/sec, so the rt-kernel does 16000 task switches/per seconds while with the low-latency kernel there is no task switch. Instead the interupt and tasklets run in hard/soft interrupt context.
Thanks! I will try this latter (I was wrong, the rt patch was to blame! :-)

What preemption options are you running with in your kernel? The vanilla fedora kernel configuration has this which seems relevant (doing a grep for PREEMPT):

CONFIG_PREEMPT_VOLUNTARY=y
but
# CONFIG_PREEMPT is not set
Drumfix
Established Member
Posts: 299
Joined: Mon Jan 26, 2009 5:15 pm
Been thanked: 11 times

Re: Ultralite AVB

Post by Drumfix »

I'm using CONFIG_PREEMPT=y (low-latency desktop)

If this doesn't help you maybe better off using the snd-usb-audio driver. For that to work in 64 channel mode on the brand new 5.12 kernel:

1. disable the duplicate endpont check in drivers/usb/core/config.c as described further up this thread
2. Add the 64 channel quirk to sound/usb/quirks-table.h (as you did before with older kernels)
3. Depending on whether the device you want to connect to USB has midi ports or not add either the line

Code: Select all

IMPLICIT_FB_FIXED_DEV(0x07fd, 0x0005, 0x87, 5), /* MOTU AVB (without midi version)*/
or

Code: Select all

IMPLICIT_FB_FIXED_DEV(0x07fd, 0x0005, 0x87, 7), /* MOTU AVB (with midi version)*/
right below the equivalent line for the Yamaha MODX in sound/usb/implicit.c
4. Configure/Build/Install the kernel (config CONFIG_PREEPT)
5. After the kernel has booted and the ethernet connection to the device is established, execute the good old curl command

Code: Select all

curl  --data 'json={"value":"USB2"}' <ip-address of device>/datastore/host/mode
Note: pulseaudio does not support more than 32 channels, so will not work in 64 channel mode.

Enjoy
nandoll
Established Member
Posts: 17
Joined: Mon Jul 29, 2019 10:29 pm

Re: Ultralite AVB

Post by nandoll »

Drumfix wrote: Tue Apr 27, 2021 7:12 pm I'm using CONFIG_PREEMPT=y (low-latency desktop)
...
Enjoy
I tried two options (as outlined above in the thread):

== 5.11.16 (fedora kernel) + ua101 driver & patches + CONFIG_PREEMPT (disabled threadirqs, I did not yet set affinity for interrupt handling or re-enabled hyperthreading)

Seems to work fine! No video problems and so far no weird audio behavior. This is with "vendor=1" and 48Khz (64 channels). Without further tuning I can run jackd at 128 fpp with some xruns - previously I was sort of limited to 256 fpp or higher, so it would seem that CONFIG_PREEMPT is good enough for what I am doing. More testing tomorrow.

I briefly tried "vendor=0" but got buzzy "tiny" sound and outputs 1-2 were actually coming from 9-10 (same thing happened in a test with the ua101 driver I did a few days ago, this is on the 8M). I did not test for long as I immediately tried "vendor=1" and the curl magic incantation (which I had been using before).

Any recommendation about trying different values for queue_length? (from the default of "21"?)

== 5.11.8 + rt11 (CONFIG_PREEMPT_RT) + standard usb driver with quirk & patches as outlined before: same problems with video so not much testing at all.

In both cases I did not try 5.12, I base my rpms on the Fedora ones and 5.12 is too new, in any case I don't think it is worth going down the PREEMPT_RT road in this system (NUC in an Akasa fanless case) given that the PREEMPT kernel is working.

Anyway, thanks much for the help and advice!

It looks like I have now a usable system (and some hope for when I need to upgrade the big systems I designed around multiple Motu audio interfaces before they changed the firmware....).
shellwalker
Established Member
Posts: 68
Joined: Sun Jan 03, 2021 1:54 pm
Has thanked: 21 times
Been thanked: 11 times

Re: Ultralite AVB

Post by shellwalker »

Drumfix wrote: Mon Apr 26, 2021 6:45 am As mentioned earlier in this thread i use my own driver based on the ua101 driver.
...

Currently additionally proprietary mode must be activated by the curl command. Now that i know how to communicate with the device over USB i will add the related command to the driver soon.
Great work Drumfix!
Sorry if this is a dumb question or already answered elsewhere: just to be sure I understood the picture here: your solution only works when using Ultralite in AVB mode (i.e. transmitting audio data over AVB/ethernet), right?
Or does it also work when _not_ using this as an AVB device i.e. when transmitting audio data only over USB?

MOTU 828mk3, MOTU 828ES, Cakewalk by Bandlab, Kubuntu 22.04.1 LTS, https://github.com/shellwalker-coder/motu_patch_testing

Drumfix
Established Member
Posts: 299
Joined: Mon Jan 26, 2009 5:15 pm
Been thanked: 11 times

Re: Ultralite AVB

Post by Drumfix »

Since page 40 we talk USB only. I have uploaded the driver code and some pseudo structs of the USB bulk messages (psseudo structs because the strings in there are of variable lemgth) on github https://github.com/Drumfix/motu-avb-usb. I have not yet implemented the protocol though.
So, for now, for the vendor mode to work the changes to the kernel from here viewtopic.php?p=132042#p132042 must be applied + the curl command executed.
shellwalker
Established Member
Posts: 68
Joined: Sun Jan 03, 2021 1:54 pm
Has thanked: 21 times
Been thanked: 11 times

Re: Ultralite AVB

Post by shellwalker »

Drumfix wrote: Sun May 09, 2021 9:36 pm Since page 40 we talk USB only. I have uploaded the driver code and some pseudo structs of the USB bulk messages (psseudo structs because the strings in there are of variable lemgth) on github https://github.com/Drumfix/motu-avb-usb. I have not yet implemented the protocol though.
So, for now, for the vendor mode to work the changes to the kernel from here viewtopic.php?p=132042#p132042 must be applied + the curl command executed.
Thanks for clarifying that Drumfix. That sounds like a break-through for practical usage. I'll give it a try once I get to it.

I've decided to create a wiki for documenting the various issues, solution and modes we've got. The idea is that in the wiki we can create a better structure for documenting substantial findings and solutions discussed within this thread. For now I've simply forked your Github repo and created a wiki in there.
See here: https://github.com/shellwalker-coder/motu-avb-usb/wiki
With time we could fill the wiki with guides and other helpful stuff.

What do you think of the wiki idea?

Another thought I've been pondering on is on how to follow-up on the class compliant mode of operation. As far as I can tell, there exists no definitive proof (yet) that the fault is really on MOTU side (my tests on my Macbook under Mac OS and linux seemed to speak against linux). So I see 2 possible approaches for gaining more certainty:
  1. Use usbmon/wireshark for analysing behavior on Linux side. I'm just not sure how reliable this approach would be, since usbmon is sniffing just above the HCD level and not at the actual "wire" level. So I don't know whether we could use usbmon to see things like timing correction (implicit feedback etc.). Maybe yes, maybe no. I'm a newbie on USB (I've been reading the USB 2.0 spec for a few days now...yeah that's right - MOTU has got me that far!!!)
  2. Use a hardware-based sniffer for analysis. The most affordable one I could find has a price tag of 239€.
    Who is willing to go down this road with me?

MOTU 828mk3, MOTU 828ES, Cakewalk by Bandlab, Kubuntu 22.04.1 LTS, https://github.com/shellwalker-coder/motu_patch_testing

User avatar
bluebell
Established Member
Posts: 1903
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 111 times
Been thanked: 114 times

Re: Ultralite AVB

Post by bluebell »

shellwalker wrote: Mon May 10, 2021 10:21 am
What do you think of the wiki idea?
Nice. But I don't have any issues in CC mode with Drumfix' ua101.c from 2020-08-30 and lowlatency-kernel 5.8.6.
I have the older UltraLite AVB without ESS chips and the most recent firmware.

Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/

shellwalker
Established Member
Posts: 68
Joined: Sun Jan 03, 2021 1:54 pm
Has thanked: 21 times
Been thanked: 11 times

Re: Ultralite AVB

Post by shellwalker »

bluebell wrote: Mon May 10, 2021 10:49 am
shellwalker wrote: Mon May 10, 2021 10:21 am
What do you think of the wiki idea?
Nice. But I don't have any issues in CC mode with Drumfix' ua101.c from 2020-08-30 and lowlatency-kernel 5.8.6.
I have the older UltraLite AVB without ESS chips and the most recent firmware.
ok. Good point to add to the wiki: distinguish b/w devices with or without ESS :)
In my case I'm using 828ES, which obviously has the ESS chips....

MOTU 828mk3, MOTU 828ES, Cakewalk by Bandlab, Kubuntu 22.04.1 LTS, https://github.com/shellwalker-coder/motu_patch_testing

martibs
Established Member
Posts: 123
Joined: Mon Oct 15, 2018 7:06 pm
Location: Oslo, Norway
Has thanked: 34 times
Been thanked: 15 times

Re: Ultralite AVB

Post by martibs »

shellwalker wrote: Mon May 10, 2021 10:21 am What do you think of the wiki idea?
I welcome this, as I'm considering acquiring the 828ES, and I'm finding it hard to keep up with the current working status by following this thread :)
User avatar
stean
Established Member
Posts: 5
Joined: Sat Jan 30, 2021 4:43 pm
Has thanked: 1 time

Re: Ultralite AVB

Post by stean »

Thanks shellwalker for the Wiki and drumfix for your work for the big step to solving the driver issues with ESS-based Motu Soudcards

Thanks reaper.fm (properity) Ardour , Alsa , Pulse, LV2 , Audacity, Jack-Audio and many, many more and specially thanks for linuxmusicians.com for believing in Linux as an (Pro)AudioworkstationOperatingSystem .

I wait of the day that many more Audiohardware & Audiosoftware & Audiobackends work together and stable.

The wiki and the drumfix driver status on git-hub ("it has been a subsidiary of Microsoft since 2018" :oops: ) have another public relation and a open door for developer and interesting peoples.

it's a shame that MOTU© doesn't take the chance to open up this market on Linux.
bluebell wrote: ↑Mon Apr 12, 2021 12:37 pm
What a tragedy. It runs Linux but works best with Windows and Mac.
At the moment, I'm too stupid to install the patch under openSUSE Tumbleweed, but i'm still hoping that it will work out of the box because of your help.

PS: excuses my knowledge of english :mrgreen:

Motu 896 HD Firewire, MOTU Ultralite AVB (ess), OS: Opensuse Tumbleweed,,
Desktop1: Ryzen 7 2700x, Desktop2: Minis Forum EM680, Desktop 3: Minis Forum UM730, Tablet: HP Elite X2 G4, TB3 /USB4,Caldigit TS3+ with i210

Musinux
Established Member
Posts: 59
Joined: Sun Jan 14, 2018 8:38 pm
Has thanked: 3 times
Been thanked: 3 times

Re: Ultralite AVB

Post by Musinux »

I've attached a PKGBUILD for linux-zen 5.12.3 with the changes to card.c/config.c required for vendor mode included (viewtopic.php?p=132042#p132042).
You still need to install the motu-avb module and run curl manually.
I don't really know how to include the module in the PKGBUILD, which would be even better, of course.

I'm testing it now, looks pretty good.
Running hwlatedetect still gives some plopping sounds while running, and for a short time there is output on the modulo8 channels visible in the web gui, but it gets stable after that (no permanent channel hopping).
Attachments
zen-motu.tar.gz
(61.14 KiB) Downloaded 83 times
shellwalker
Established Member
Posts: 68
Joined: Sun Jan 03, 2021 1:54 pm
Has thanked: 21 times
Been thanked: 11 times

Re: Ultralite AVB

Post by shellwalker »

I've just given the Drumfix approach a try (did I say "just"? - well it took me half a day to finally get a kernel configuration that would actually run on my machine before I could start applying the patches.... there must be a easier way to this. I'm all open for suggestions...).

Anyway, this is what I did:
1. Installed an Ubuntu lowlatency kernel. Booted it to see whether it runs. All ok-ish.
2. Plugged in 828ES, ran my Ardour test. Channel drifting occurs. So far things are as expected.
3. Downloaded the source for the installed kernel version. Configured the kernel (day-long task...). Applied kernel tweaks against duplicate endpoints stuff and also blacklisting 828ES in usb-audio driver. Finally had a build that would boot on my system. So far so good.
4. Plugged-in 828ES and ran the Ardour-test. Channel drifting oocurs as expected.
5. Downloaded driver from https://github.com/Drumfix/motu-avb-usb and built against running kernel.
[EDIT-ON]
5.b. Ran the curl command for switching the device to vendor mode ("curl --data 'json={"value":"USB2"}' <ip-address>/datastore/host/mode")
[EDIT-OFF]
6. loaded the built module.
7. Started Ardour, but the Motu device does not show up in the device list.
8. Checked dmesg and found this:

Code: Select all

Sa Mai 15 00:14:59 2021] usb 1-5: samplerate = 48000, queue_length = 21, midi = 1, vendor = 1
[Sa Mai 15 00:14:59 2021] usb 1-5: probing interface 1
[Sa Mai 15 00:14:59 2021] usb 1-5: probing interface 2
[Sa Mai 15 00:14:59 2021] usb 1-5: probing interface 5
[Sa Mai 15 00:14:59 2021] usb 1-5: probing interface 4
[Sa Mai 15 00:14:59 2021] usb 1-5: probing interface 6
[Sa Mai 15 00:14:59 2021] usb 1-5: probing interface 7
[Sa Mai 15 00:14:59 2021] usb 1-5: probing interface 3
[Sa Mai 15 00:14:59 2021] usb 1-5: probing interfaces sucessful
[Sa Mai 15 00:14:59 2021] usb 1-5: max packets capture endpoint 1800
[Sa Mai 15 00:14:59 2021] usb 1-5: max packets playback endpoint 1800
[Sa Mai 15 00:14:59 2021] usb 1-5: invalid quirk type 49238
Any idea what I'm doing wrong?


On another note: if I got it right between all the lines, then there are currently following possible approaches still alive in this thread:
1. Use AVB as based on Drumfix' driver:
2. Use Drumfix's USB driver for vendor (proprietary) mode from https://github.com/Drumfix/motu-avb-usb. And I understand that that one supersedes the ua101.c file that has been shared here for a while, right?
3. Use Drumfix's USB driver for USB2 class compliant mode from https://github.com/Drumfix/motu-avb-usb.
4. Use the kernels own USB2 class driver with just a few modifications as suggested in viewtopic.php?p=132128#p132128

Forgive me for being so pedantic and for asking things that may be obvious. I'd be grateful for help to sort out this stuff. :?
Last edited by shellwalker on Sat May 15, 2021 7:33 am, edited 1 time in total.

MOTU 828mk3, MOTU 828ES, Cakewalk by Bandlab, Kubuntu 22.04.1 LTS, https://github.com/shellwalker-coder/motu_patch_testing

Drumfix
Established Member
Posts: 299
Joined: Mon Jan 26, 2009 5:15 pm
Been thanked: 11 times

Re: Ultralite AVB

Post by Drumfix »

Thanks for the pointer. So the alsa devs change to formats inside usbaudio.h and midi.h whenever they want. It's a shame that these include files are not in the include directory (and therefor would be available in the kernel headers). So apparently we have to copy them over from the kernel we want to compile against <kernel.src>/sound/usb to our driver. :roll:

And if you want to use vendor mode, don't forget the curl command.
Post Reply