So I'm trying to switch one of my test setups from another board over to an Arduino Uno. I had a couple of questions. I would appreciate the help.
Can I make the Arduino Uno act as a slave to another device thats not an Uno.
I read that the SPI does not support slave mode on the SPI bus, so does that mean the Arduino can only be a master and not a slave. The only case I've seen of an arduino be a slave is when its connected to another arduino.
To add some insight. I'm hoping my connection to look like the following :
PC <--(TTL converter [ttl3usb9m-ls])--> Arduino <--(I want to use SPI connection and have my device as the Master and the Arduino as the Slave)--> My device <--(Ethernet)--> PC(Back To)
I read that the SPI does not support slave mode on the SPI bus, so does that mean the Arduino can only be a master and not a slave.
The SPI library (part of the IDE) does not support the slave mode directly although you still can use the library you just have to initialize the hardware by direct register manipulations.
Do you have any recommendations on how I should go about making the Uno a slave to my device?
This might be the time where you should tell us more about your "device". On what processor is it based? What voltage level does it have? What SPI speeds does it support?
Well I'm looking for an SPI speed of 13 MHz. I also noticed in the link someone attached above that the setup is to connect an arduino to another arduino. Is it possible for me to apply the same principle but with my device.
So I should be able to use that link and work through it with my device. That's good news.
Could you explain to me why I can't use the arduino uno. I mean 16MHz is within my range. Are there any benefits of using a Due or a Teensy.
16MHz is the processor speed. That means it can't react to anything in any way if it appears and disappears in less than a 16-millionth of a second.
Normally for SPI communication, you get a "clock" signal which says "look at the data line NOW" and then you look at the data pin to see if you are receiving a one or a zero. The key part is the "and then". That takes time. With a 16MHz processor, it will take two processor cycles to say "and" and "then". So that means you can't detect any incoming signal faster than 8MHz.
Now that's not entirely true - the Arduino chip has specialised hardware which does the SPI without bothering the main processor. But 8MHz is as fast as it will go. 4MHz is the default transmission speed.
It may work, the receiver may be able to decode 13MHz, but I don't expect that it will work reliably.
What would be the benefits and disadvantages between the Due & Teensy?
Clearly, the benefits are faster processor speeds. Clearly, the disadvantages are that you don't have either one and appear to be unwilling to get either one.
Now that's not entirely true - the Arduino chip has specialised hardware which does the SPI without bothering the main processor. But 8MHz is as fast as it will go. 4MHz is the default transmission speed.
8MHz is max speed for SPI master, for slave mode it's 4MHz.
Don't forget that the processor does not only have to shift the bits out it also has to provide the information that should be sent. So if one byte is sent an interrupt happens and the next byte has to be written to the SPI register. The interrupt needs several clock cycles so at 4MHz you have no time for any calculations you can only send simple informations.
The Due is not able to be an SPI slave to my knowledge.