ARDUINO SPI comminucation spy between master and slave

Hello everyone =) ,

I would like spy SPI data which are sent by an ADC (slave) to a master (FPGA , or whatever :wink: ) with my ARDUINO DUE.

My first thinking was to put in place interruption on the SPI clock edge and capture at each edge the value of the data. Then, concatenate all the bits seen to read the data sent by the ADC.
I am working on it, but i was wondering if it wouldn't be simple to read that data directly with the SPI bus of my ARDUINO, but is it possible?

Indeed, the ARDUINO is neither the master, neither the slave. Could it work ? Does it exist that kind of spy SPI mode where it only read what he sees without doing anything but triggering on the datas seen ?

Thank you in advance,

I am working on it, but i was wondering if it wouldn't be simple to read that data directly with the SPI bus of my ARDUINO, but is it possible?

Yes, but only for one half of the communication (read either the slave or master data) as both use other pins and you cannot short the two pins.

If the interrupt version works depends mainly on the speed the two devices communicate at. Up to about 2-4 MHz you might get it working (rough estimate).

Keep in mind, the Arduino SPI library doesn't support SPI slave mode, so you have to direct register manipulations to get your Due to that mode.

Yes, but only for one half of the communication (read either the slave or master data) as both use other pins and you cannot short the two pins.

Yes and it's all good because I only want to see/read data from ADC.

Keep in mind, the Arduino SPI library doesn't support SPI slave mode, so you have to direct register manipulations to get your Due to that mode.

So i must be in "spi slave mode" by checking the ARDUINO registers manually for that?

If the interrupt version works depends mainly on the speed the two devices communicate at. Up to about 2-4 MHz you might get it working (rough estimate).

The communication between Slave/master is 5MHz and i would like to read 2 datas on 2 differents SPI buses (from 2 differents ADC). Do you think it's achievable?

Did you google spi sniffer BTW ?

You could get a $12 USB logic analyzer: Amazon.com . That gives you eight 24 MHz logic inputs allowing you bidirectional sniffing on two SPI busses.

The communication between Slave/master is 5MHz and i would like to read 2 datas on 2 differents SPI buses (from 2 differents ADC). Do you think it's achievable?

Not with one SPI channel. According to the datasheet the SAM3A has two SPI channels, so you might get that done.

If you want to do that just to get an idea of how to program the chip, the logic analyzer is the better choice as johnwasser pointed out.

Only SPI0 is available with the Sam3x8e (140 pin uc), usable either in Master mode or Slave mode. However USART0 and USART1 are usable in SPI Master Mode.