Combinations of IO operations can cause "DMA transaction timed out" on Pi 5

Open
#5,865 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
c, linux, raspberry-pi

Research direction

Start by reproducing the failure with the listed spi-pipe and speaker-test commands on a Raspberry Pi 5, while monitoring dmesg. Investigate the interaction between SPI and I2S DMA transfers; done means concurrent traffic no longer produces DMA transaction timeouts or SPI transfer failures.

Written by the indexing model from the issue text.

Description

Describe the bug

This Issues is currently a placeholder while the details are being investigated, but some combination of SPI, I2C and I2S traffic can lead to kernel messages from spidev saying "DMA transaction timed out", and "SPI transfer failed: -110". So far it appears that a reboot is necessary to clear the condition.

Steps to reproduce the behaviour

With an I2S-based soundcard attached, and with other audio outputs disabled so that the I2S card is the default, running these commands seems to be sufficient.

$ sudo apt install spi-tools
$ sudo dtparam spi=on # or put "dtparam=spi=on" in config.txt
$ dmesg -W & # So you know when it's failed
$ while true; do cat /boot/firmware/config.txt | spi-pipe -b 500 -d /dev/spidev0.0; done &
$ speaker-test -c 2 > /dev/null

It dies soon after speaker-test is started.

Observations:

  • Running spi-pipe with small byte counts (e.g. -b 10) doesn't trigger the problem - presumably because DMA is not invoked for transfers below the SPI FIFO size (64 bytes).
  • I2S is another DMA user, so the problem may be due to simultaneous DMA usage.
Device (s)

Raspberry Pi 5

System

It's a Pi5 running a current Bookworm release and a self-built kernel (probably not required).

Logs

No response

Additional context

No response

Dominant language
C
Stars
13.2k
Forks
5.5k
Avg merge
2d 21h
Merged PRs (30d)
21

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/linux

All issues in raspberrypi/linux

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.