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


Further update:


The modified library with the interrupts re-enabled during the refill routine is continuing to work well, with apparently no dropped millis() interrupts.

I did notice however that when playing a file a couple of minutes long (3.92 MB) there is a delay of about 1.8 sec after the playTrack and before control is returned to my sketch. In other words,

long startTime = millis();


Serial.println(millis() – startTime);

prints about 1800.

I realize there is a lot going on during that time – opening the file and doing the initial buffer fill, but the library would be even more useful if that delay was not present.

Once the song starts to play, it looks like my sketch gets about 77% of the CPU – not bad! I measured this by observing that a loop that takes 54 ms to execute when no song is playing takes about 70 if the song is playing, after the 1.8 sec delay.