SPI Slave

Hey Guys,

I was hoping you guys could give me some advice.

So my project is looking to have an arduino as an SPI slave to another device which will be the mater. I also need a clk speed of 7 MHz.

My questions are the following:

  • Can I get an ardunio to act as a slave because I read that the SPI library doesn't support slave ?
  • Do you guys have any ideas as to which arduino would work for this task and or any recommendations such as the Uno. Due, etc..
  • I also need the arduino to support Ethernet. So if I need to buy a shield or if an arduino already supports that it would be great.

Please let me know what your thought's are. I appreciate the help. Also, I'm not every experienced so feel free to ask any questions or spend me links on stuff. I appreciate it.

Thanks,
Kevin

Can I get an ardunio to act as a slave because I read that the SPI library doesn't support slave ?

Yes, you can.

Do you guys have any ideas as to which arduino would work for this task and or any recommendations such as the Uno. Due, etc..

An UNO is not able to support 7MHz, it's hardware SPI is good for up to 4MHz and that's even very fast for a procesor running on 16MHz.
The Due is not able to act as an SPI slave as far as I know.

I don't have enough experience with the newest models of the Arduino family to tell you if these might be able to do what you want.

I also need the arduino to support Ethernet. So if I need to buy a shield or if an arduino already supports that it would be great.

That doesn't work as one SPI bus cannot be slave and master and I'm not aware of an Ethernet solution for the Arduino platform that doesn't use the SPI interface.

Are these 7MHz a fixed spec in your project or are you able to change that to let's say 4MHz?

There are libraries out there for SPI slave on Arduino. Just google for it.

Your clock speed is more of a problem. 7 MHz is not supported (16 MHz can not be divided down to 7 MHz), Arduino can do 4 MHz or 8 MHz (in theory at least).

Your clock speed is more of a problem. 7 MHz is not supported (16 MHz can not be divided down to 7 MHz), Arduino can do 4 MHz or 8 MHz (in theory at least).

In slave mode the clock is provided by the master and doesn't have to be generated from the CPU clock. So an ATmega328 can be SPI slave at 3MHz but it cannot synchronize at higher speeds than 4MHz as the following quotation of the datasheet shows:

In SPI Slave mode, the control logic will sample the incoming signal of the SCK pin. To ensure correct sampling of the clock signal, the minimum low and high periods should be:
Low periods: Longer than 2 CPU clock cycles.
High periods: Longer than 2 CPU clock cycles.

So one SPI clock cycle has to last at least 4 CPU clock cycles which results in 4MHz for a 16MHz CPU in the UNO.