In my program I have a number of pins being "watched" by interrupts. Should I be concerned if an interrupt occurs during writing to an SD Card (SPI)?
Thanks
In my program I have a number of pins being "watched" by interrupts. Should I be concerned if an interrupt occurs during writing to an SD Card (SPI)?
Thanks
No. Not unless your ISR is badly-written.
I'm not sure, but I don't think so. Remember that timer0 interrupts are taking place all the time to generate the millis() increment. And they don't seem to bother SD communications. And if they could be a problem, the library authors may have disabled interrupts during critical periods, then re-enabled them afterwards.
And looking at the datasheet for the 328P, it looks like the SPI module does the shifting out and in on its own no matter what the processor is doing otherwise. So once a byte transfer is started, I suspect it continues to the end autonomously, and an interrupt would not affect that. Between bytes, I don't think timing is particularly critical.
Once, the user performs this instruction: byte x = SPI.transfer(0x32); or SPDR = 0x32;, the bits are shifting by dedicated hardware beyond the knowledge of MCU, which can be seen in the following diagram. Therefore, any interrupt within the system will draw the attention of the MCU and not of the SPI Logic.

