I'm having trouble starting off with developing on the Arduino. I find the Documentation on how to actually communicate over SPI kind of non existing. So i'm asking for guidance.
Raspberry Pi + Arduino MEGA 2560
The setup i seek is as followed:
Pi controls Arduino by sending commands. (This works and is the topic of many samples). After the Arduino reveived a command, the Pi waits for a Response.
The whole communication should be as asynchronous as possible. Meaning the Pi can receive data anytime but only reacts when its expecting something. And also the Pi should be able to send data anytime it wants.
So where do i start? How to find out which of the Two should be Master or Slave? How do i wait on the Pi (with c/c++) for SPI input?
You see i'm a beginner, asking beginner questions. Any directions, hints or possibly code would be much appreciated.
One more Question: I have the two spi devices /dev/spidev0.0 and /dev/spidev0.1. Is one of them the MOSI and the other one the MISO device? Because the spidev_test.c file uses spidev0.0 and uses both, a read and a transmit buffer which wouldn't make any sense in that case.