0

MP3 shield hangs up
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MP3 shield hangs up

by ganderson on Sat Oct 12, 2019 12:00 am

I've got a weird issue with an Adafruit MP3 shield running off an Arduino Uno. The shield will play various sound files without issue in the main loop function, but the shield will randomly hang up on me when I trigger sounds via I2C. Only one other I2C slave on the bus, runs endlessly without interruptions or hang ups. Sounds are triggered to play when receiving an I2C event, and it plays sound files nicely for a random number of times, until it hangs, usually between 5 and 15 audio plays. The Arduino I2C slave doesn't hang and continues to receive I2C events, logging them in the serial console, but the shield becomes unresponsive and won't play audio anymore unless the Arduino is reset. I disable the main void loop audio playback when using I2C event playback. Any ideas why the shield would play audio on a loop endlessly but randomly hang when playing files with I2C events?
Attachments
R2D2-AudioController-ArduinoUno_20190918.ino
(6.14 KiB) Downloaded 18 times

ganderson
 
Posts: 6
Joined: Wed Aug 14, 2019 7:55 pm

Re: MP3 shield hangs up

by adafruit_support_bill on Sat Oct 12, 2019 6:34 am

The Arduino Wire library does have a tendency to hang if there are problems on the i2c bus. Marginal connections, interference or too much capacitance on the bus can cause the state machine to lock up.

What are you using for a bus master? What is the total length of the bus?

Some photos of your setup might be helpful.

adafruit_support_bill
 
Posts: 77422
Joined: Sat Feb 07, 2009 10:11 am

Re: MP3 shield hangs up

by ganderson on Sat Oct 12, 2019 12:45 pm

Bus Master is an Arduino Mega, using 4.7K resistors for SDA and SCL lines. Total bus length is hard to measure given the project is a mess of wires inside a hard-to-reach enclosure, but its definitely less than 6ft. I found another thread that solved my issue, didn't find it initially since the spelling was not standard english (music maker vs musik maker). As a I wondered, it was a software issue in how the music files were being played - needed a stop call, then a softreset call before playing next I2C trigger event inside the audio function, along with a small delay after each play, and now it plays brilliantly with no interruptions, playing file after file (30 successive attempts with no problems). Good to go.

https://forum.arduino.cc/index.php?topic=324827.0

20191012.jpg
20191012.jpg (125.45 KiB) Viewed 198 times

ganderson
 
Posts: 6
Joined: Wed Aug 14, 2019 7:55 pm

Re: MP3 shield hangs up

by adafruit_support_bill on Sat Oct 12, 2019 1:11 pm

Good to hear you solved it. Thanks for the follow-up.

That is a nice looking R2 unit! :)

adafruit_support_bill
 
Posts: 77422
Joined: Sat Feb 07, 2009 10:11 am

Re: MP3 shield hangs up

by ganderson on Sat Oct 12, 2019 2:53 pm

Thanks. Audio and lighting systems are built with Adafruit products. The Adafruit tutorials are awesome to work with, especially a newbie like myself.

ganderson
 
Posts: 6
Joined: Wed Aug 14, 2019 7:55 pm

Please be positive and constructive with your questions and comments.