Home › Forums › Sparkfun MP3 Shield Library Support Forum › Tapping into SPI › Reply To: Tapping into SPI
There is no need to gracefully terminate SPI transfers, as they are not running in the background, like DMA transfers. Rather the ISR runs in the foreground until completion. They are in while loops.
The ISR is bound within the attachInterrupt(MP3_DREQINT, refill, RISING); function in the SFEMP3Shield::enableRefill() function.
When using the SPI ensure it is properly configured prior to using it. Don’t assume it is the way your code last left it. The SdCard and SFEMP3 libraries both when asserting the chip selects configure the SPI correspondingly. Overwriting what ever its prior state, as used by other code. This provides compatibility with other libraries using the SPI. Where the other libraries should do the same. Otherwise they would mess each other up. Yes, it may appear inefficient, but its compatible.
Note: I see that the SdCard recently added SetBitOrder. the MP3 does not. So that could be an issue, if different.
You could optionally wrap your code between MP3player.pauseDataStream() and MP3player.resumeDataStream() functions. However, this should no longer be needed.