Preview all the data that is to be sent before sending it, or preview each byte before sending that byte?
Is there possibility to program Arduino in such way to 'preview' communication on SPI without interrupting communication ?
Sending data to the serial port shouldn't interfere with SPI communication, as long as you either send all the data first, then perform the SPI communication (Serial.print() blocks until the last byte is accepted) or send the data to the serial port one byte at a time (with a high baud rate) just before sending it via SPI.
Arduino should be device that only peek messages and thats all (So orginal device will work as to day, and additionally I will have preview of messages sent over bus)
Arduino should be device that only peek messages and thats all (So orginal device will work as to day, and additionally I will have preview of messages sent over bus)
We must have different meanings attached to the word preview. In that diagram, Arduino is not previewing the message being sent. It is intercepting a copy of the message that has already been sent. Nothing "pre" about that.
There is nothing about that diagram that represents anything other than a typical multi-slave setup. One of the slaves will do something with every message received, whether it is the intended target, or not. Clearly, the Arduino must not generate any SPI data in response to anything coming from the master, unless it is properly configured as a slave, and is the slave being addressed.
What you are looking to build is a protocol sniffer of some kind.
If you only want to see the data traveling in one direction it should be simple, connect the Arduino's SCK and either MISO or MOSI depending on the direction you want to capture, then write some code to print the values it reads off the SPI line.
If you want to see the data traveling in both directions things are much harder. You can do the above for one signal but also use the UART in SPI mode to get the data going in the other direction. (Just theory on my part, there may be a dependancy that stops the UART being used this way).
If the data rate is slow enough you can "bit bang" both MOSI and MISO. That would be pretty easy.
Even if the rate is high you could slow it down for the test, as long as a slow version is still valid for the test.
Next, for $30 you can get a Bus Pirate, I've never used one but I gather they can decode various protocols including SPI.
And the best way to do it (IMO) is buy a logic analyzer like the Saleae for about $150.