Use Arduino (Nano) as SPI Master AND Slave

Hi,

I'm working on a project where I want to set up a network of Arduinos. I want to have one master Arduino that talks (two-way communication) to several slave Arduinos within the network. I plan to do this via an SPI connection and found many examples.

However, each of the slave Arduinos needs also to talk to a MCP4922 DAC via SPI. That means that each slave Arduino needs to be master for a second SPI connection. Is there a way to implement this? So far I'm working with Arduino Nano but I could switch to a different model. A different DAC would also be possible if necessary.

Thanks for your help!

Hi GWDEN,

According the ATMEL ATmega328/p, ATmega32U4, ATMega32U4 datasheets the MCUs just have one SPI port. Please see Arduino Uno, Nano, etc. page 18, https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/ATMega32U4.pdf page 178, Arduino Mega page 6.

for the STM32 please see STM32 page 7

Regards and let me know the progress of your work.

3 SPI buses can be implemented on a DUE: The "main" ICSP used by the Library, USART0 in SPI mode and USART1 in SPI mode.

AFAIK the SPI Library do not implement the arduino as an SPI slave, so you will need to make some direct register programming.

Thanks for your help. I haven't looked into it in detail but it seems that someone else did the programming to use an Arduino as SPI slave (see Arduino as SPI Master and Slave Demo Code - Exhibition / Gallery - Arduino Forum )

My last idea is to use I2C to get the data from the slave Arduinos to the master and do the backwards channel via single digital connection. However, I need to count I/O ports for that.

and something like this? "Simple network of Arduinos built using a ring of serial connections"