Bug 15729 - sudden volume increase crashed the unit
: sudden volume increase crashed the unit
Status: RESOLVED FIXED
Product: SB Radio
Classification: Unclassified
Component: Power Management
: Include FW version in comment
: PC Windows XP
: P1 normal with 2 votes (vote)
: 7.6.0
Assigned To: Bradley D. Wall
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-02-18 09:56 UTC by Ryan
Modified: 2011-07-29 13:25 UTC (History)
4 users (show)

See Also:
Category: ---


Attachments
MP3 file that could reset the Baby. (469.41 KB, audio/mp3)
2011-04-19 16:05 UTC, Vahid Fereydouny
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan 2010-02-18 09:56:17 UTC
fw 7915

overly loud audio through speaker crashes the unit apparently due to power starving. Sometimes the unit will be mute after reboot requiring another power cycle to return to normal operation.
Comment 1 Ryan 2010-02-18 17:00:50 UTC
mp3 or wav files 20-3khz 0db sweep do not trigger the overload however a sweep with intermittent full amplitude bursts from -6 to 0db repeatably cause the shutdown to occur.
Comment 2 Chris Owens 2010-03-04 16:34:21 UTC
Maurice if you want to put it in an earlier release please let me know which one.
Comment 3 Vahid Fereydouny 2011-01-18 16:23:05 UTC
Could you please try this with the latest build.
Comment 4 Ryan 2011-01-19 09:01:04 UTC
This still happens with the 9262 FW.

I find it easy to reproduce.

play internet Radio KGO news talk at full volume. NO Battery installed.

Wait unit will shutdown.
Comment 5 Mickey Gee 2011-02-07 13:33:24 UTC
It's KG0 810 AM in San Francisco. go to Internet Radio->Search to find if you're not from SF Bay Area.
Comment 6 Ryan 2011-02-15 08:54:47 UTC
This came from a RightNow call


If I crank the volume all the way up while listening radio, it restarts. This happens always only when the volume increase occurs suddenly. There must be something wrong w/ its operating system, unless something wrong w/ the hardware.
Comment 7 Mickey Gee 2011-02-28 11:27:06 UTC
Reported by factory as failure with 7.5.3 r9283. From e-mail:

"...Yes, it is caused by the adapter can not offer enough power when playing music at max volume, we did see the current (of Radio) was about 1.2A-1.3A(we measure it with HP6612 power supplier) while the fixed current of adapter is only 1A."

Raising priority to P1.
Comment 8 Mickey Gee 2011-02-28 11:37:13 UTC
The goal would be to modify firmware (MSP?) to somehow prevent the shutdown by limiting the gain when this happens. That would not mean simply just limiting the current to 1A max because it would introduce audible and unacceptable distorted audio. The goal would be to limit the current intelligently so that the audio peaks just before it hits 1 amp.

Here's a discussion about this topic via this link:

http://www.dsprelated.com/showmessage/21943/1.php

Good luck!
Comment 9 Vahid Fereydouny 2011-04-11 16:43:03 UTC
Analyzing the format of the streaming data to understand what causes this situation. There are two conditions that triggers this bug:
 1. Go to radio sites like KGO 810 and keep the volume to 100. Ultimately the Baby reboots
 2. Sudden increase the volume from 0 to 100 and wait for 5 seconds. At times this bug happens.

 Inside the Playback.lua we have a mapping of the volume to gains. This eventually is multiplied by each PCM to generate the output buffer.
Comment 10 Vahid Fereydouny 2011-04-12 23:44:13 UTC
The PCM is getting multiplied by the lgain and rgain, which are calculated based on a mapping of volume ( from 0 to 100 ) to Gains(from 16 to 65536).
Playing Radio KGO 810 on volume 90 for a while causes the Baby to reset as well. It seems that there are patterns that are capable of putting a lot of load on the Baby.
Comment 11 Maurice Alou 2011-04-13 10:59:17 UTC
We need some signal processing to keep the amplitude of the woofer under control to avoid exceeding 1A (we probably don't need to worry too much about the tweeter as the impedance is higher).
The MX25 knows the gain of the codec, so it could compute the current flowing in the woofer assuming a constant 4ohm impedance. If the current exceeds 1A, the MX25 will clip the signal going to the codec. This method is a little bit crude and may clip the signal even when it is not needed (around the resonance frequency). 
A better approach is to use a more accurate model for the impedance of the woofer that takes into account the resonance frequency but that requires more complex signal processing as the impedance depends on the frequency. Audio BU should be able to provide an algorithm to know when we exceed 1A knowing the characteristics of the woofer.
I would put a current probe on the 18V and monitor the shape of the peaks before and after processing.
Comment 12 Vahid Fereydouny 2011-04-19 16:05:03 UTC
Created attachment 7238 [details]
MP3 file that could reset the Baby.

This file can reproduce the problem in a very short period of time. Thanks to Ryan.
Comment 13 Vahid Fereydouny 2011-04-19 19:57:12 UTC
There are several layers that are involved in playing audio. Here is my preliminary understanding of the big picture:
 1. Receiving the commands to play the music and increase/decrease the volume:
        Typically the lua files. The volume is transformed in Playback.lua from [0-100] to gains. Start from luaopen_decode and "luaL_Reg decode_f" definition in trunk/squeezeplay/src/squeezeplay/src/audio/decode/decode.c
 2. The decoding of music happens based on the type of the audio file. Check out the squeezeplay/src/squeezeplay/src/audio/decode/decode.c
        Here are some examples:
struct decode_module decode_mad = {
        'm',
        "mp3",
        decode_mad_start,
        decode_mad_stop,
        decode_mad_samples,
        decode_mad_callback,
};
struct decode_module decode_pcm = {
        'p',
        "aif,pcm",
        decode_pcm_start,
        decode_pcm_stop,
        decode_pcm_samples,
        decode_pcm_callback,
};

 3. After the music stream is received and decoded based on its type the output buffer is transferred to alsa layer.
   Check out squeezeplay/src/audio/decode/decode_alsa_backend.c and playback_callback function. The gains are integrated into the output buffer by:
        *(output_ptr++) = fixed_mul(decode_audio->lgain, *(decode_ptr++)) >> 16;
   The snd_ functions are used to transfer the data kernel by using alsa library. Here are some examples:
        snd_pcm_open
        snd_pcm_mmap_commit
        snd_pcm_hw_params_any
 4. alsa-lib defines the snd_ routines. Here is the path: trunk/squeezeos/poky/build/tmp-baby/work/armv5te-none-linux-gnueabi/alsa-lib-1.0.18-3/alsa-lib-1.0.18
 5. The kernel drivers and related functions could be found at:
linux-2.6.26/sound/soc/imx/baby-tlv320aic3104.c
linux-2.6.26/sound/soc/imx/imx_pcm.c
linux-2.6.26/sound/soc/imx/imx-ssi.c
linux-2.6.26/sound/core/pcm_lib.c
linux-2.6.26/sound/soc/oc-dapm.c // ALSA SoC Dynamic Audio Power Management
linux-2.6.26/sound/soc/codecs/tlv320aic3104.c
linux-2.6.26/sound/core/control.c

I will update this as I have a better understanding of the whole stack.
Comment 15 Mickey Gee 2011-06-06 09:46:17 UTC
Mickey to take a look for more info. Felix to code review first, and then PQA to test special build before rolling it into regular build.
Comment 16 Mickey Gee 2011-06-07 08:40:49 UTC
Custom test firmware built based upon 7.5.4_r9441 version. Change affects the audio path only and does not impact any other software components.

Will put custom firmware into Google Docs.
Comment 17 Felix Mueller 2011-06-07 10:11:13 UTC
I found this email from Vahid. He sent it on June 7 2011.


Hello,
By changing the POWER_LIMIT in the babydsp_pcm.c we can prevent this
bug from happening. I have been running extensive testing with the
value 18500 and the problem does not happen(I am testing with
different values and also trying to have a better understanding of the
code).
However I am not sure how much impact this will have on the loudest
music we can play(or on the quality of music). Honestly I cannot say
the difference with my ears.
Does anyone have a good suggestion of how we can test the impact of
this change.
Regards,
--Vahid
Here are the instruction to fetch and make the changes:
#bitbake squeezeos-dsp -c compile -f
Here is the path to the file:
squeezeos_dsp/src/babydsp_pcm.c
If you build this the result will be under the .libs/ directory and by
copying the shared library to your Baby you will have the changes:
/usr/lib/alsa-lib/libasound_module_pcm_babydsp.so
Comment 18 Felix Mueller 2011-06-07 10:15:55 UTC
I've checked svn 7.5 and 7.6 for changes to the file (babydsp_pcm.c) Vahid is mentioning and the proposed change has not yet been commited.

This is what 'svn blame babydsp_pcm.c' (for 7.5 and 7.6) is reporting:

  6401     ccrome //#define POWER_LIMIT 18500
  6404     ccrome #define POWER_LIMIT 25500
  6382     ccrome //#define POWER_LIMIT 160
  6270    richard /* output count has to be a multiple of 5 */
  6280    richard #define OUTPUT_COUNT 250
 
Caleb seems to have increased the power in r6404. Not sure why though.
Comment 19 Mickey Gee 2011-06-07 12:15:25 UTC
Handing over to Felix to review the change.
Comment 20 Mogens Kjær (Aka Muele) 2011-06-07 12:33:32 UTC
Forumthread about the problem:
http://forums.slimdevices.com/showthread.php?p=635261#post635261
Comment 21 copperstate 2011-06-07 14:20:05 UTC
I am having the very same problem with one of my Radios. It consistently crashes when specific, rather bass-heavy music plays at full (usually 90+) volume.
Comment 22 copperstate 2011-06-07 14:27:11 UTC
Also I have seen the current drop (even below 15V sometimes) just before rebooting.
Comment 23 SVN Bot 2011-06-09 08:54:55 UTC
 == Auto-comment from SVN commit #8475 to the player repo by fmueller ==
 == http://svn.slimdevices.com/player?view=revision&revision=8475 ==

Bug: 15729 
Description: Lower POWER_LIMIT to 18500 (was 25500) to prevent SB Radio from rebooting when music with heavy low frequency is played at loud volume (max).
Comment 24 Mickey Gee 2011-06-16 16:14:15 UTC
I do not see this change in a build yet ....
Comment 25 Ben Klaas 2011-06-16 17:41:11 UTC
can you explain what you mean by "see" this in a build?

The change should be in r9447, and 7.6.0 is pushing r9449 currently...
Comment 26 Jim McAtee 2011-07-01 15:57:00 UTC
Has anyone tested this lately using the most recent firmware?
Comment 27 Jim McAtee 2011-07-24 20:24:39 UTC
So is this fixed or not? Anybody???
Comment 28 copperstate 2011-07-25 12:59:03 UTC
(In reply to comment #27)
> So is this fixed or not? Anybody???

I am able to use my Radio at full volume, so it seems to be fixed. :)
Comment 29 Jim McAtee 2011-07-29 13:12:24 UTC
Someone please close this unless there are still issues.