Home Forums Sparkfun MP3 Shield Library Support Forum Interference with millis() function Reply To: Interference with millis() function

#2169

Try changing the following in SFEMP3ShieldConfig.h from

#define USE_MP3_REFILL_MEANS USE_MP3_INTx

to

#define USE_MP3_REFILL_MEANS USE_MP3_Polled

This will make the demo run without using the interrupts. The SFEMP3Shield library does not directly affect the millis() or its sourced components. I suspect the above change will confirm that it is an interference of interrupts. Between the Arduino’s core library for millis() sourced by Timer0’s Overflow interrupt vector and the VS1053 DREQ. Where the MP3 driver reads ahead the MP3 file, while in the interrupt, and the TIMER0_OVF_vect’s increamenting of the timer0_millis value.

I have toyed with reducing this overhead or blocking of other interrupts. But it is a major change and lot of work.

I think changing to USE_MP3_Polled is a quick fix. Note that you need the MP3player.available(); in the main loop.