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
-
you know, there is a SPI library?Juraj– Juraj ♦02/08/2018 12:02:51Commented Feb 8, 2018 at 12:02
-
Yes, I do know there's a library. But is there any document available that says what are the resources of that library?João Costa– João Costa02/08/2018 12:08:36Commented Feb 8, 2018 at 12:08
-
2reference of he SPI library arduino.cc/en/Reference/SPIJuraj– Juraj ♦02/08/2018 12:19:47Commented Feb 8, 2018 at 12:19
-
2Atmega datasheet ww1.microchip.com/downloads/en/DeviceDoc/…Juraj– Juraj ♦02/08/2018 12:24:59Commented Feb 8, 2018 at 12:24
-
Thank you very much, I'll look into the Atmega datasheet, didn't occur to me looking into it.João Costa– João Costa02/08/2018 15:10:57Commented Feb 8, 2018 at 15:10
2 Answers 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.
Take a look at Nick Gammon's SPI explanations also. Very good, with timing explained as well.
-
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– João Costa02/08/2018 15:09:53Commented Feb 8, 2018 at 15:09
-
I also explain SPI right here on this site: arduino.stackexchange.com/questions/16348/… - As for the register names, they are explained in the datasheet.02/08/2018 20:32:58Commented Feb 8, 2018 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.02/08/2018 20:57:33Commented Feb 8, 2018 at 20:57