1

I'm trying to use an Arduino as a slave and was searching for examples which I found many. But apart from the examples, I haven't found any documentation explaining many thing that show up in those examples.

For example, I'd like a document that would state what things like the following are:
-SPCR
-SPE
-SPDR
-ISR
-SPI_STC_vect

I'm asking this, because I don't and can't just copy an example and hope that it'll work, I really need to know what I'm doing.

Thank you,
João

2 Answers2

2

You are confusing SPI, a de facto standard, with the Arduino/Atmel hardware support for SPI.

SPCR, SPE and SPDR are registers of the Atmel MCU, part of the hardware support.

ISR is Interrupt Service Routine and SPI_STC_vect is the vector that point to that code. That is where the data received from the cable is read finally.

1

Take a look at Nick Gammon's SPI explanations also. Very good, with timing explained as well.

http://www.gammon.com.au/spi

CrossRoads
  • 2,376
  • 5
  • 9
  • His work is amazing, unfortunately he doesn't explain what those things are, apart from ISR and SPDR. And I had no idea from where the other things came. But there are already good answers that give me somewhere to look into. Thank you very much! – João Costa Feb 08 '18 at 15:09
  • I also explain SPI right here on this site: https://arduino.stackexchange.com/questions/16348/how-do-you-use-spi-on-an-arduino/ - As for the register names, they are explained in the datasheet. – Nick Gammon Feb 08 '18 at 20:32
  • Whilst I have a personal interest in the answer, it simply isn't practical to include or even summarize a lengthy post like an explanation of how SPI works. The OP is asking for documentation and this answer is giving a link to it. In my comment above I point out that there is more documentation available **on this site** which means it is less likely to go link-dead. Another answer might be to reference the datasheet, which again would have to be link-only, unless maybe you quoted a couple of pages. – Nick Gammon Feb 08 '18 at 20:57