<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Problem with i2s driver and ALSA, underrun]]></title><description><![CDATA[<p dir="auto">My hardware i2s driver's params:<br />
static struct snd_pcm_hardware ralink_pcm_hardware = {<br />
.info = SNDRV_PCM_INFO_MMAP |<br />
SNDRV_PCM_INFO_MMAP_VALID |<br />
SNDRV_PCM_INFO_INTERLEAVED |<br />
SNDRV_PCM_INFO_BLOCK_TRANSFER,<br />
.formats = SNDRV_PCM_FMTBIT_S16_LE |<br />
SNDRV_PCM_FMTBIT_S24_LE,<br />
.channels_min		= 2,<br />
.channels_max		= 2,<br />
.period_bytes_min	= PAGE_SIZE, \ 512<br />
.period_bytes_max	= PAGE_SIZE * 2, <strong>actually not max, it can be PAGE_SIZE * 8</strong><br />
.periods_min		= 2, <strong>actually idk what this param means</strong><br />
.periods_max		= 128, <strong>should I enlarge it?</strong><br />
.buffer_bytes_max	= 128 * PAGE_SIZE * 2, <strong>should I enlarge it too?</strong><br />
.fifo_size		= RALINK_I2S_FIFO_SIZE, <strong>it's 32</strong><br />
}<br />
static const struct snd_dmaengine_pcm_config ralink_dmaengine_pcm_config = {<br />
.prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,<br />
.pcm_hardware = &amp;ralink_pcm_hardware,<br />
.prealloc_buffer_size = 256 * PAGE_SIZE, <strong>And enlarge it?</strong><br />
};</p>
<p dir="auto">I have underruns when just aplay 96/24 and 192/24 audio, it s clear with 48/24</p>
<p dir="auto">root@OpenWrt:~# aplay 24x192.wav -v<br />
Playing WAVE '24x192.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo<br />
Plug PCM: Linear conversion PCM (S24_LE)<br />
Its setup is:<br />
stream       : PLAYBACK<br />
access       : RW_INTERLEAVED<br />
format       : S24_3LE<br />
subformat    : STD<br />
channels     : 2<br />
rate         : 192000<br />
exact rate   : 192000 (192000/1)<br />
msbits       : 24<br />
buffer_size  : 96256<br />
period_size  : 1024<br />
period_time  : 5333<br />
tstamp_mode  : NONE<br />
tstamp_type  : MONOTONIC<br />
period_step  : 1<br />
avail_min    : 1024<br />
period_event : 0<br />
start_threshold  : 96256<br />
stop_threshold   : 96256<br />
silence_threshold: 0<br />
silence_size : 0<br />
boundary     : 1577058304<br />
Slave: Hardware PCM card 0 'ad1938' device 0 subdevice 0<br />
Its setup is:<br />
stream       : PLAYBACK<br />
access       : MMAP_INTERLEAVED<br />
format       : S24_LE<br />
subformat    : STD<br />
channels     : 2<br />
rate         : 192000<br />
exact rate   : 192000 (192000/1)<br />
msbits       : 32<br />
buffer_size  : 96256<br />
period_size  : 1024<br />
period_time  : 5333<br />
tstamp_mode  : NONE<br />
tstamp_type  : MONOTONIC<br />
period_step  : 1<br />
avail_min    : 1024<br />
period_event : 0<br />
start_threshold  : 96256<br />
stop_threshold   : 96256<br />
silence_threshold: 0<br />
silence_size : 0<br />
boundary     : 1577058304<br />
appl_ptr     : 0<br />
hw_ptr       : 0<br />
root@OpenWrt:~# cat /sys/kernel/debug/10000a00.i2s/stats<br />
tx stats<br />
below threshold 2276321<br />
under run       94<br />
over run        0<br />
dma fault       0</p>
<p dir="auto"><strong>Mb I need to change something in my hardware i2s driver?</strong></p>
]]></description><link>http://community.onion.io/topic/3662/problem-with-i2s-driver-and-alsa-underrun</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 18:16:29 GMT</lastBuildDate><atom:link href="http://community.onion.io/topic/3662.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 12 Jul 2019 12:38:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem with i2s driver and ALSA, underrun on Fri, 12 Jul 2019 12:59:05 GMT]]></title><description><![CDATA[<p dir="auto">My hardware i2s driver's params:<br />
static struct snd_pcm_hardware ralink_pcm_hardware = {<br />
.info = SNDRV_PCM_INFO_MMAP |<br />
SNDRV_PCM_INFO_MMAP_VALID |<br />
SNDRV_PCM_INFO_INTERLEAVED |<br />
SNDRV_PCM_INFO_BLOCK_TRANSFER,<br />
.formats = SNDRV_PCM_FMTBIT_S16_LE |<br />
SNDRV_PCM_FMTBIT_S24_LE,<br />
.channels_min		= 2,<br />
.channels_max		= 2,<br />
.period_bytes_min	= PAGE_SIZE, \ 512<br />
.period_bytes_max	= PAGE_SIZE * 2, <strong>actually not max, it can be PAGE_SIZE * 8</strong><br />
.periods_min		= 2, <strong>actually idk what this param means</strong><br />
.periods_max		= 128, <strong>should I enlarge it?</strong><br />
.buffer_bytes_max	= 128 * PAGE_SIZE * 2, <strong>should I enlarge it too?</strong><br />
.fifo_size		= RALINK_I2S_FIFO_SIZE, <strong>it's 32</strong><br />
}<br />
static const struct snd_dmaengine_pcm_config ralink_dmaengine_pcm_config = {<br />
.prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,<br />
.pcm_hardware = &amp;ralink_pcm_hardware,<br />
.prealloc_buffer_size = 256 * PAGE_SIZE, <strong>And enlarge it?</strong><br />
};</p>
<p dir="auto">I have underruns when just aplay 96/24 and 192/24 audio, it s clear with 48/24</p>
<p dir="auto">root@OpenWrt:~# aplay 24x192.wav -v<br />
Playing WAVE '24x192.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo<br />
Plug PCM: Linear conversion PCM (S24_LE)<br />
Its setup is:<br />
stream       : PLAYBACK<br />
access       : RW_INTERLEAVED<br />
format       : S24_3LE<br />
subformat    : STD<br />
channels     : 2<br />
rate         : 192000<br />
exact rate   : 192000 (192000/1)<br />
msbits       : 24<br />
buffer_size  : 96256<br />
period_size  : 1024<br />
period_time  : 5333<br />
tstamp_mode  : NONE<br />
tstamp_type  : MONOTONIC<br />
period_step  : 1<br />
avail_min    : 1024<br />
period_event : 0<br />
start_threshold  : 96256<br />
stop_threshold   : 96256<br />
silence_threshold: 0<br />
silence_size : 0<br />
boundary     : 1577058304<br />
Slave: Hardware PCM card 0 'ad1938' device 0 subdevice 0<br />
Its setup is:<br />
stream       : PLAYBACK<br />
access       : MMAP_INTERLEAVED<br />
format       : S24_LE<br />
subformat    : STD<br />
channels     : 2<br />
rate         : 192000<br />
exact rate   : 192000 (192000/1)<br />
msbits       : 32<br />
buffer_size  : 96256<br />
period_size  : 1024<br />
period_time  : 5333<br />
tstamp_mode  : NONE<br />
tstamp_type  : MONOTONIC<br />
period_step  : 1<br />
avail_min    : 1024<br />
period_event : 0<br />
start_threshold  : 96256<br />
stop_threshold   : 96256<br />
silence_threshold: 0<br />
silence_size : 0<br />
boundary     : 1577058304<br />
appl_ptr     : 0<br />
hw_ptr       : 0<br />
root@OpenWrt:~# cat /sys/kernel/debug/10000a00.i2s/stats<br />
tx stats<br />
below threshold 2276321<br />
under run       94<br />
over run        0<br />
dma fault       0</p>
<p dir="auto"><strong>Mb I need to change something in my hardware i2s driver?</strong></p>
]]></description><link>http://community.onion.io/post/19780</link><guid isPermaLink="true">http://community.onion.io/post/19780</guid><dc:creator><![CDATA[Mark Nagaev]]></dc:creator><pubDate>Fri, 12 Jul 2019 12:59:05 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with i2s driver and ALSA, underrun on Wed, 13 Nov 2019 11:58:05 GMT]]></title><description><![CDATA[<p dir="auto">Ok I add some fixes, now it works better, but not perfect on 192/24.</p>
<p dir="auto">First, I increased period_bytes_max, it can be 65535 bytes cause it limmited only by dma transfer.<br />
Second, buffer_bytes_max and prealloc_buffer_size, I increased them too, now it ~4MB.<br />
Third, dma_data-&gt;maxburst = 4, cause it can be transferred 16 bytes, after threshold reached.</p>
<p dir="auto">Now it's randomly can be ~100 underruns while playing, but most od the time it's clear</p>
<p dir="auto">root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav<br />
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo<br />
[ 3262.796745] underrun 4<br />
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav<br />
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo<br />
[ 3278.822202] underrun 69<br />
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav<br />
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo<br />
[ 3291.029872] underrun 19<br />
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav<br />
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo<br />
[ 3303.158453] underrun 3<br />
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav<br />
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo<br />
[ 3316.406874] underrun 1<br />
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav<br />
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo<br />
[ 3328.456432] underrun 1<br />
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav<br />
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo<br />
[ 3341.206080] underrun 100<br />
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav<br />
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo<br />
[ 3352.909575] underrun 1<br />
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav<br />
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo<br />
[ 3365.469447] underrun 0<br />
root@OpenWrt:/# aplay /root/1kHz(24x192)cut.wav<br />
Playing WAVE '/root/1kHz(24x192)cut.wav' : Signed 24 bit Little Endian in 3bytes, Rate 192000 Hz, Stereo<br />
[ 3388.133126] underrun 1</p>
]]></description><link>http://community.onion.io/post/20627</link><guid isPermaLink="true">http://community.onion.io/post/20627</guid><dc:creator><![CDATA[Mark Nagaev]]></dc:creator><pubDate>Wed, 13 Nov 2019 11:58:05 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with i2s driver and ALSA, underrun on Wed, 13 Nov 2019 12:03:38 GMT]]></title><description><![CDATA[<p dir="auto">Now I wanna pre-allocate contiguous block of memory for this DMA audio buffer, cause I think this random can be in slow buffer pushing. I think so, cause of it no underruns on ALSA level, I already debugged it.</p>
]]></description><link>http://community.onion.io/post/20628</link><guid isPermaLink="true">http://community.onion.io/post/20628</guid><dc:creator><![CDATA[Mark Nagaev]]></dc:creator><pubDate>Wed, 13 Nov 2019 12:03:38 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with i2s driver and ALSA, underrun on Sat, 23 Nov 2019 04:13:26 GMT]]></title><description><![CDATA[<p dir="auto">This can cause stale mixer devices to appear. With mplayer and 32kHz audio only occasional pops when changing tracks<a href="https://www.telldunkin.me" rel="nofollow">!</a></p>
]]></description><link>http://community.onion.io/post/20655</link><guid isPermaLink="true">http://community.onion.io/post/20655</guid><dc:creator><![CDATA[Anderson Jonas]]></dc:creator><pubDate>Sat, 23 Nov 2019 04:13:26 GMT</pubDate></item></channel></rss>