Music Maker with S3

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
blindedscience
 
Posts: 10
Joined: Tue May 18, 2021 5:31 pm

Music Maker with S3

Post by blindedscience »

Hey all, I'm trying to build a small device that will do MP3 playback and flashing LEDs inside of Lego build. I initially selected the Music Maker and S3. I went with the S3 instead of the S2 used in the reference code because I wanted to remotely control it. This is my first feather project (I'm much more at home in the Circuit Playground), and I'm learning Arduino by force since it seems like python can't keep up with the VS1053 transfer (https://docs.circuitpython.org/projects ... en/latest/). New hardware AND new development platform - probably not smart on my part. I'm running into a bunch of problems that I'm hoping you all won't mind my asking about.

I managed to get the Blink reference sketch to run fine, so it appears I've figured out the basics of the Arduino IDE. However, when I upload the feather_player example sketch, I get myself into a rst 0x8 cycle. That, however, appears to be written for the S2. Same thing with player_simple. Questions:
1. Are the S2 and S3 sufficiently different that I'd need to make changes to the code to make it run?
2. If I *do* need to modify it, is it just identifying different pin connections?
3. What normally causes a rst 0x8 cycle? Something like trying to run S2 code on a S3? :)

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: Music Maker with S3

Post by adafruit_support_mike »

The reset is probably happening because of a timing issue:

The ESP8266 and ESP32 run a simple operating system that alternates between your code and built-in firmware that keeps the radios happy. That's based on a technique called 'cooperative multitasking' where your code periodically gives the OS a chance to swap over and tend the radios, using a function called yield().

The low-level Arduino code has yield() built into strategic places so you generally get proper swapping without having to do anything special. It's possible to write loops that last a long time without calling yield() though.

If the OS can't swap to the radios often enough, the radios can end up in a state that the OS can't handle. When that happens, the OS crashes with a timeout message.

The Music Maker code has to maintain close timing to keep the VS1053's buffer from running empty, which it can handle in one of two ways: the microcontroller can handle an interrupt when the VS1053 sets its 'need data' pin high, or it can check the pin directly.

The Music Maker library's interrupt code is written for AVR and SAMD microcontrollers, so I don't know how well it works with an ESP32. Checking the 'need data' pin directly is done by the feed_buffer() function.

When in doubt, you can throw yield() and feed_buffer() calls into any loops that are likely to run for a long time.

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”