PiSupply / JustBoom

Resources for JustBoom range
https://JustBoom.co
15 stars 5 forks source link

out123_open () of the mpg123 lib switches off the DAC HAT #12

Closed JacekRuzyczka closed 6 years ago

JacekRuzyczka commented 6 years ago

Hi folks,

I've got the following reproducible issue: Then calling out123_open () of the mpg123 library from within C++ client code, I always get a strange phenomenon: The power LED of the JustBoom DAC HAT on Raspi 3B dies, and no sound is played despite the fact that I always get OUT123_OK as a return value! It seems as if the code calling ALSA routines switches off the sound device 'cause I get some strange message when setting verbosity to 3. See the second last line:

Trying output module: alsa, device: Module dir search relative to: /usr/bin Looking for module dir: /usr/bin/../lib/mpg123 Module dir: /usr/bin/../lib/mpg123 Module path: /usr/bin/../lib/mpg123/output_alsa.so Note: alsa is the last output option... showing you any error messages now. [src/libout123/modules/alsa.c:173] debug: open_alsa with (nil) [src/libout123/modules/alsa.c:270] debug: close_alsa with 0x126f918 Chosen output module: alsa

dmesg gives me these messages:

[ 375.696492] pcm512x 1-004d: No SCLK, using BCLK: -2 [ 375.701500] pcm512x 1-004d: Failed to request power down: -5

The consequence: I have to reboot the Pi in order to bring the sound card back to life.

So far, nobody could help me with this issue. What I do know, though, is that calling mpg123 does work fine, and the line containing close_alsa () does not appear in the debug outputs. Does anybody know what's wrong here? Thank you for any useful hints!

JacekRuzyczka commented 6 years ago

OK, I could pinpoint the source of the problem: the I²C pins of the Raspi! In fact, the JustBoom card does work without I²C control, but I used the I²C pins as GPIO pins for another app, and the sound card thought I was issuing I²C commands, which, of course, were invalid. This is why using the mpg123 command-line app and even the example program at https://www.mpg123.de/api/mpg123__to__out123_8c.shtml did work flawlessly, whereas my app did not.