Electronic – arduino – SPI Interrupt (SPIE) in SPI control register

arduinomicrocontrollerspistm32

I have been trying to understand SPI Interrupt i.e. what does it do and why is it used ? Reading about it on the web has not helped me. Can some one please explain it in a simple terms ?

Best Answer

SPIE or "SPI Interrupt Enable" is used to enable the interrupt.

(Assuming you are in Master mode) There are two ways of transferring data using SPI:

1.Polling: Here you write data in SPI's data register (SPDR) and then poll on the flag for SPI Transmission complete (SPIF).

2.Interrupt based: In this case, when you enable Interrupt for SPI, you write data in SPDR. Controller will transmit the data and will raise an interrupt when transmission is completed.

A question may arise that why there is interrupt for transmission but not for the reception, I am tempted to answer but It would be better if you figure that out! :-)