Raspberry Pi 5 losing PCIe link to NVMe SSD

I have a Raspberry Pi 5 in an Argon NEO 5 M.2 case with a Crucial P3 SSD. It’s been running fine for almost two years, but occasionally the PCIe connection to the SSD would get lost. Up until recently, this wasn’t a big deal as it would reset and come back within fractions of a second:

Mar 01 09:00:07 raspberrypi kernel: nvme nvme0: controller is down; will reset: CSTS=0xffffffff, PCI_STATUS=0x10
Mar 01 09:00:07 raspberrypi kernel: nvme nvme0: Does your device have a faulty power saving mode enabled?
Mar 01 09:00:07 raspberrypi kernel: nvme nvme0: Try "nvme_core.default_ps_max_latency_us=0 pcie_aspm=off" and report a bug
Mar 01 09:00:07 raspberrypi kernel: nvme 0000:01:00.0: enabling device (0000 -> 0002)
Mar 01 09:00:07 raspberrypi kernel: nvme nvme0: 4/0/0 default/read/poll queues
Mar 01 09:00:07 raspberrypi kernel: nvme nvme0: Ignoring bogus Namespace Identifiers

Then I did both a kernel update and a rpi-eeprom-update and suddenly it would fail to reset:

Mar 01 14:05:56 personalcloud kernel: nvme nvme0: controller is down; will reset: CSTS=0xffffffff, PCI_STATUS=0x10
Mar 01 14:05:56 personalcloud kernel: nvme nvme0: Does your device have a faulty power saving mode enabled?
Mar 01 14:05:56 personalcloud kernel: nvme nvme0: Try "nvme_core.default_ps_max_latency_us=0 pcie_aspm=off pcie_port_pm=off" and report a bug
Mar 01 14:05:56 personalcloud kernel: nvme 0001:01:00.0: enabling device (0000 -> 0002)
Mar 01 14:05:56 personalcloud kernel: nvme nvme0: Disabling device after reset failure: -19

Putting the suggested nvme_core.default_ps_max_latency_us=0 pcie_aspm=off pcie_port_pm=off into /boot/firmware/cmdline.txt and rebooting did not help. A lot of time the issue happened under I/O load, so power saving seemed an unlikely culprit.

What ended up solving the issue was putting

dtparam=pciex1
dtparam=pciex1_gen=1

at the end of /boot/firmware/config.txt and rebooting. This limits the Raspberry Pi to PCIe 1.0 with its lower transfer rate. You will thus see log entries like this one:

Mar 05 19:32:25 personalcloud kernel: brcm-pcie 1000110000.pcie: link up, 2.5 GT/s PCIe x1 (!SSC)
Mar 05 19:32:25 personalcloud kernel: pci 0001:01:00.0: 2.000 Gb/s available PCIe bandwidth, limited by 2.5 GT/s PCIe x1 link at 0001:00:00.0 (capable of 31.504 Gb/s with 8.0 GT/s PCIe x4 link)

The Raspberry Pi 5 is capable of PCIe 3.0. It defaults to 2.0 unless you specify pciex1_gen=3 because it lacks the certification for 3.0. I had actually tried pciex1_gen=3 in the past and found that it significantly increased the frequency of PCIe resets. But luckily, you can use the same flag to limit the device to PCIe 1.0. PCIe 1.0’s lower data rate corresponds a lower signal frequency, which reduces the requirements on the cable quality and the sensitivity to electromagnetic interference compared to PCIe 2.0 or even 3.0. The Argon’s cable that connects the M.2 riser to the Raspberry Pi’s PCIe port always looked a bit flimsy to me. How could it support the multi-GHz signal frequencies of PCIe without any extra shielding? My conclusion now is: it cannot. But that is not a big deal as most applications you could run on a Raspberry Pi won’t benefit from bandwidth higher than that of PCIe 1.0.

Siemens Simcenter STAR-CCM+ and AMD ROCm blog post

Some of you might know that I work at Siemens as a software developer on Simcenter STAR-CCM+. Our fluid dynamics simulation software can use Nvidia GPUs to accelerate its calculations, and earlier this year we also introduced support for AMD GPUs. AMD recently published a blog post to advertise their and our product, based on some questions they asked me and my product manager:

Siemens taps AMD Instinct GPUs to expand high-performance hardware options for Simcenter STAR-CCM+
May 16, 2024
https://rocm.blogs.amd.com/ecosystems-and-partners/Siemens/README.html

Emulating PPC64 inside Docker

PPC64, the architecture of the IBM POWER4 through POWER7, is big-endian. The POWER8 through POWER10 also have a little-endian mode, which is why PPC64LE is significantly more common nowadays, even though these newer processors can still switch to big-endian mode. I have a bit of manually-vectorized code that specifically supports POWER7 or newer POWERs running in big-endian mode, so to make sure that still works I occasionally need to emulate a PPC64 Linux. There are not many suitable distributions left — Debian dropped the architecture after Debian 8, Ubuntu after 16.04, Void Linux for PowerPC is discontinued, even Fedora dropped it after Fedora 28. Out of the big distributions, that only leaves CentOS 7, which is getting old and only has one year of support left. However, there is Adélie Linux, a relatively new distribution still in development, and Debian unstable still has a PPC64 port. Read on below for Dockerfiles that you can use to run the two inside Docker on amd64 via multiarch.

Continue reading

Running the MOTU M4 USB audio interface without bus power

The MOTU M4 is a high quality, yet relatively affordable USB audio interface with 2x XLR/TRS in, 2x TRS in, 2x TRS/RCA out, 2x TRS out, 1x headphone out, 1x MIDI in, 1x MIDI out. The M2 is very similar, just without the 2x TRS in and 2x TRS out. Judging by the firmware, I am tempted to claim that the M2 and M4 are technically identical, just with a different back panel with fewer connectors hooked up to the ADC/DAC.

Some high-end audio interfaces have a separate power input, but the M4 is exclusively bus-powered. In theory you only need the separate power supply when your computer does not supply enough power, but the M4 is well within the limits of what the specification guarantees. The M4 actually also has a standalone mode where you can use it as a mic preamp by connecting it to a USB power supply. However, like most audio interfaces, it has one power-related downside: it makes the speakers pop when it is turned off. Some people say it’s on the quieter end of the spectrum of audio interface popping, but I would rather have complete silence when I reboot or shut down my computer. Interestingly, MOTU managed to make it completely quiet when powering on. I tried a powered USB hub, but its power output is still controlled by the computer, so the interface loses power and the speakers pop when I reboot my computer.

There is a simple solution to this problem: the USB-C/PWR Splitter by 8086 Consultancy. You can use it to power the M4 from a USB power supply, but connect its data lines to your computer as usual. This solution may also work with some other USB interfaces, but it’s not guaranteed that the interface will keep its output powered when it loses the data connection to the computer.

There is also a significantly more expensive solution: the MOTU M6, which can optionally be powered by a separate but included power supply. You might also shop around for other audio interfaces with separate power connectors (Focusrite Scarlett 8i6 Gen3, Arturia MiniFuse 4, Universal Audio Volt 4), but it’s not guaranteed that all of them will keep running when they lose the data connection to the computer. I picked the MOTU M4 because its case and knobs are mostly metal. My previous audio interface had some parts made from soft-touch plastic, which after about a decade began getting stick and shedding drops of plasticizer, so I was not going to spend money again on soft-touch plastic like on the Arturia’s knobs.

Scientific Article: A thermalized electrokinetics model including stochastic reactions suitable for multiscale simulations of reaction-advection-diffusion systems

I co-authored a scientific article in Journal of Computational Science.

A thermalized electrokinetics model including stochastic reactions suitable for multiscale simulations of reaction–advection–diffusion systems
Ingo Tischler, Florian Weik, Robert Kaufmann, Michael Kuron, Rudolf Weeber, Christian Holm
J. Comp. Sci. 63, 101770 (2022)
DOI: 10.1016/j.jocs.2022.101770

The journal does not provide open access to the article, but you can download it for free from chemRxiv: 10.26434/chemrxiv-2021-39nhv-v3.

Dissertation: Lattice Boltzmann methods for microswimmers in complex environments

My dissertation has been published by the university:

Lattice Boltzmann methods for microswimmers in complex environments
Michael Kuron
PhD thesis, Universität Stuttgart
DOI: 10.18419/opus-11926

Printed copies are available at the university library and at the national library in Frankfurt and Leipzig. I also have a few spare ones, so if you think you really need one, let me know. The SHA1 hash of the PDF file I submitted to the library is 45f8b26dc10c04a5221d79fa3a2c42478a2b89b6, which matches the file available online as of today.

Abstract

This dissertation introduces, validates, and applies various models for the study of microswimmers, predominantly focusing on the development of lattice algorithms. The models are applicable to biological swimmers like bacteria, but also to artificial ones propelled via chemical reactions. The unifying theme is a complex fluidic environment, ranging from Newtonian single-component fluids, to electrolyte solutions, to viscoelastic media flowing through arbitrary geometries. A particular focus is placed on resolving each swimmer’s surface since the propulsion, or phoresis, originates from a small layer of fluid around it. Resolving the propulsion mechanism is necessary to accurately study hydrodynamic interactions with obstacles and other swimmers. It is also a prerequisite for the study of taxis, that is, alignment with an external field such as a nutrient gradient. Similarly, phoretic interactions can be investigated, like when a swimmer senses and avoids the trail where another swimmer has already depleted the fuel.

Update January 2024

Here is an updated PDF with all the preprint citations replaced with the published versions. This should make it easier to find all references via the DOI system.

Dell WD19TBS review

Four years ago, I reviewed the Dell WD15 USB-C docking station for use with a MacBook Pro. It worked reasonably well, but not all of the USB ports worked and high resolutions didn’t work over DisplayPort. Also, over time it has become a bit unstable for me, requiring the USB-C cable to occasionally be unplugged and replugged, or even requiring the dock to be power-cycled. The latter is also necessary when switching between a Dell and a MacBook, which can be a bit annoying. I also noticed that the WD15’s firmware cannot be upgraded unless you use a Dell laptop from around 2017 — newer ones will try and fail, while non-Dell laptops won’t even run the updater.

Dell’s current docking solution is the WD19. It is available in three variants: the WD19S connects via USB-C, the WD19TBS connects via Thunderbolt or USB-C, and the WD19DCS connects to certain high-end Dell laptops via two USB-C cables. Conveniently, the WD19TBS is certified for use with Macs too. The WD19/WD19TB/WD19DC (without the “S” at the end) are identical, but do not have an audio output.

This review is going to be really short. The WD19 eliminates all the WD15’s flaws that I complained about. Dell provides good documentation that tells you what works via USB-C and what requires Thunderbolt, which resolutions you can get on how many video outputs, etc., so I am not going to repeat that here (the executive summary is that there are no surprises here).

The WD19 has one downside though: it has a fan. Mine turns on and spins up to relatively loud levels every couple hours for a few minutes, which I find quite annoying. Another WD19 I have used never spins up. I don’t really think the fan is even needed for regular usage unless you have a laptop that draws more than 80W of power. So if you’re feeling adventurous and want to void the warranty, open up the WD19 and disconnect the fan. Dell laptops will occasionally display a BIOS warning about a failed fan, but other than that it works fine and completely silent.

Firmware updates no longer require Windows or even a Dell laptop. You can apply them via fwupd on Linux too.

Novation Launchkey 61 MK3 and MainStage 3.5

Santa got me a Novation Launchkey 61 MK3 this year. I learned playing piano as a kid on a Yamaha PSR-340 and have been wanting to get back into music for a while now. These days, good low-priced MIDI keyboards and great-sounding virtual instruments are available for low prices, so the up-front investment is much smaller than back then.

I wanted a MIDI keyboard with a display and a couple of buttons and faders so I could select and control virtual pianos, synths, and organs on my computer. I also wanted integration of the controls with Apple Logic Pro. Some older MIDI devices used binary plugins for this purpose (which get installed into /Library/Application Support/MIDI Device Plug-ins), but with Apple recently having switched from Intel to its own custom Arm processors and many manufacturers not providing updates in a timely manner, the better way going forward is using Lua scripts.

Browsing through the Thomann store, I found that my criteria are met by the Akai MPK 261, Nektar Panorama P6, Novation Launchkey 61 MK3, and Roland A-800 Pro. (The Nektar Panorama T6 might also be okay once the manufacturer delivers the update promised. Same might go for the Novation SL MKIII if it gets an update.) The Nektar Panorama P series only has a binary plugin for Logic Pro, but a Lua script for MainStage. The Novation MK3 has a downloadable Lua script for Logic. The Roland A-PRO series and Akai MPK series are apparently supported out of the box through Lua scripts. Finally, there is the Studiologic Mixface SL, which is a controller with faders, knobs and buttons that magnetically attached to the Studiologic SL series of MIDI keyboards and which has a Lua script for Logic. There is also the Roland Fantom 6, a high-end synthesizer, that has a binary plugin for Logic and a Lua script for MainStage.

When you are not recording, but just playing virtual instruments, a DAW like Logic Pro is overkill. That’s what Apple MainStage is for — it hosts Audio Units (virtual instruments and effects), but unlike a DAW it has no concept of recording or timeline. After seeing Roland’s and Nektar’s documentation on their support of MainStage (they display all the on-screen controls on the keyboard display and allow you to interact with them via the knobs, buttons and faders), I wanted to see how much I could do with the Launchkey. It has special MIDI messages for all kinds of things and should thus be able to do most of the same. The Lua scripts that configure MIDI devices are installed into ~/Music/Audio Music Apps/MIDI Device Scripts (for Logic) and ~/Music/Audio Music Apps/MainStage Devices (for MainStage). The Lua API is not documented publicly, but can easily be deduced by poking through Apple’s own scripts, which are in /Applications/MainStage 3.app/Contents/Frameworks/MACore.framework/Versions/A/Resources/MIDI Device Scripts. The basic API is identical between MainStage and Logic, but Logic uses a different parameter feedback mechanism and supports multiple layers (or “modes”), both of which are not used by any of Apple’s scripts.

I am happy to report that I managed to create a complete MainStage integration for the Launchkey that pretty much matches what Roland (Fantom) and Nektar managed to do. Of course, due to lack of a graphical display, it’s not as nice, but it only costs half as much as the Nektar and a tenth of the Roland Fantom. Automatic mapping of knobs, faders, buttons, and drum pads works perfectly. The LEDs of the buttons mirror the state of the UI. The display shows parameter feedback (name and value) when you move a knob or fader. This goes beyond what the Roland A-800 or Akai MPK261 do, which have a similar price as the Launchkey, but cannot display parameter information.

Note that MainStage’s automatic mapping of controls has a few bugs. My device script cannot work around these, but you can manually re-map these controls if you need them:

  • The Keyboard quick-start project does not map Smart Drawbars to MIDI faders. The Tonewheel organ project template does however. You can manually map the Smart Drawbar controls though.
  • Smart Faders are not mapped to MIDI faders. You can manually map the Smart Fader controls.
  • Instruments that have Smart Controls spread across multiple pages only have their first page’s controls mapped. You can manually map the Tab 2 Smart Knobs though.
  • Drumpads on the keyboard trigger notes in the C6-B7 range and are mapped to MainStage’s Drum Pad controls. However, the virtual instruments expect notes in the C1-B2 range. You can manually change the trigger notes on all 24 drum channels.

Check out https://github.com/mkuron/launchkey-mk3-mainstage if you want to use your own Launchkey MK3 with MainStage. The versions for the smaller (25-key, 37-key, 49-key) models are untested, but should work just as well.

Update February 2022: The Novation SL MKIII got its promised Logic Pro integration. MainStage integration could be done in a similar way as I did for the Launchkey MK3. The Novation SL MKIII seems quite comparable to the Nektar Panorama P6, but a bit more modern.

Update March 2022: I uploaded a video to YouTube and tweeted about this, hoping to get it out to more people. Novation even liked my tweet:

Update April 2022: Downloadable installer packages (.pkg files) are now available for release versions at https://github.com/mkuron/launchkey-mk3-mainstage/releases. You will need to right-click to install the package as it is not signed.

Update September 2022: The Novation SL61 MK3 is not currently supported as it has a completely different MIDI protocol is different from the Launchkey MK3. I would gladly add support for it, but don’t own this keyboard, so unless someone ships me one, it won’t happen. The SL61 would be perfect for MainStage with its little displays etc.

Update May 2023: The new Arturia KeyLab Essential 61 mk3 also fulfills my requirements and it has a Lua script for Logic. Writing one for MainStage should also be possible.

Update October 2024: The new Launchkey MK4 is not supported by my script. The protocol is somewhat similar to the MK3 so adapting it shouldn’t be too hard, but additional work will be required to adapt to the OLED display and some of the other new features.

Scientific Article: An extensible lattice Boltzmann method for viscoelastic flows: complex and moving boundaries in Oldroyd-B fluids

I’ve published a scientific article in the European Physical Journal E.

An extensible lattice Boltzmann method for viscoelastic flows: complex and moving boundaries in Oldroyd-B fluids
Michael Kuron, Cameron Stewart, Joost de Graaf, and Christian Holm
European Physical Journal E 44, 1 (2021)
DOI:
10.1140/epje/s10189-020-00005-6

The article is available as open-access from the publisher, thanks to Projekt DEAL. One of my pictures even made it onto the cover of the January 2021 issue:

Scientific Article: waLBerla: A block-structured high-performance framework for multiphysics simulations

I co-authored a scientific article in Computesr & Mathematics with Applications:

waLBerla: A block-structured high-performance framework for multiphysics simulations
Martin Bauer, Sebastian Eibl, Christian Godenschwager, Nils Kohl, Michael Kuron, Christoph Rettinger, Florian Schornbaum, Christoph Schwarzmeier, Dominik Thönnes, Harald Köstler, and Ulrich Rüde
Comp. Math. Appl. 81, 478 (2021)
DOI:
10.1016/j.camwa.2020.01.007

The journal does not provide open access to the article, but you can download it for free from arXiv: arXiv:1909.13772.