user4358: I learned, that SPI-code uses interrupts. So is it true then, that I can't use SPI related code inside an ISR?
Background: I want to capture one or more revolution speeds with an MCP23S17. I rewired the interrupt lines to INT1 and INT2 accordingly to get the interrupts at the Arduino.
I thought it was good to fetch the port registers from the MCP23S17 inside the ISR, but this apparently doesn't work. 
Is the only thing I can do in my ISR set a flag for another test in the main loop? And let a routine called from lood() then poll the registers from the port expander? This opposes the idea to fetch the relevant data which issued the interrupt ASAP. 

user4143: SPI doesn't use interrupts.  It references the interrupt flag to know if a transfer has been completed, but it doesn't actually have interrupts enabled:
SPDR = data;
asm volatile("nop");
while (!(SPSR & _BV(SPIF))) ; // wait
return SPDR;

It should be perfectly possible to use SPI within the interrupt - indeed there is portions of the SPI API that deal specifically with this - see https://www.arduino.cc/en/Reference/SPIusingInterrupt for instance.

4358: <p>I learned, that SPI-code uses interrupts. So is it true then, that I can't use SPI related code inside an ISR?</p>

<p>Background: I want to capture one or more revolution speeds with an MCP23S17. I rewired the interrupt lines to INT1 and INT2 accordingly to get the interrupts at the Arduino.</p>

<p>I thought it was good to fetch the port registers from the MCP23S17 inside the ISR, but this apparently doesn't work. </p>

<p>Is the only thing I can do in my ISR set a flag for another test in the main loop? And let a routine called from lood() then poll the registers from the port expander? This opposes the idea to fetch the relevant data which issued the interrupt ASAP. </p>
 4143: <p>SPI doesn't use interrupts.  It references the interrupt flag to know if a transfer has been completed, but it doesn't actually have interrupts enabled:</p>

<pre><code>SPDR = data;
asm volatile("nop");
while (!(SPSR &amp; _BV(SPIF))) ; // wait
return SPDR;
</code></pre>

<p>It should be perfectly possible to use SPI within the interrupt - indeed there is portions of the SPI API that deal specifically with this - see <a href="https://www.arduino.cc/en/Reference/SPIusingInterrupt" rel="nofollow">https://www.arduino.cc/en/Reference/SPIusingInterrupt</a> for instance.</p>
