Go Down

Topic: How robust is SDlib to other interrupts (Read 641 times) previous topic - next topic

ardnut

Sep 12, 2012, 01:30 pm Last Edit: Sep 12, 2012, 08:06 pm by ardnut Reason: 1
I'm wanting to add a short ISR to handle some external hardware (write a byte to set PWM duty cycle).

I'll need to know how tolerant the SPI writing in SDlib is to the timing delays this will introduce.

Since the actual SPI timing is done by the SPI hardware in the chip and each byte is effectively buffered, I'm guessing it should be possible.

I'll just do some experimenting but any direct experience and possible caveats would be useful.

Thanks.



fat16lib

SD cards seem to be very tolerant for delays in SPI transfers.  I have delayed for many milliseconds mid-transfer with no problem.

Many people call analogRead() for several pins in an ISR while data is being written to the SD with no problem.  Each call takes about 120 microseconds.

SdFat uses millis() to detect timeout errors so spending more than a millisecond in an ISR will cause millis() to drop counts.  This should just extend the length for a timeout error.

ardnut

Many thanks. That's just what I was hoping was the case. Thanks for the detail.


Go Up