SPI master & slave simultaneously


i find out if possible program 328p both spi master , spi slave within same program.

it not work master , slave "at same time".

here's scenario:

the microcontroller (slave) shall receive command master. upon receiving command, shall access eeprom using spi. understand in order retrieve data eeprom, microcontroller needs become master.

is above scenario possible?

thanks reading

yes, possible, have created that.

use hardware spi pins (10,11,12,13) put atmega328 in spi slave mode

i use software spi on set of pins interface sd card , nokia 5110 display

for using arduino in slave mode recommend reading

http://www.gammon.com.au/forum/?id=10892

by nick gammon (thanks nick, code helped lot). using software spi can use shiftout

http://arduino.cc/en/tutorial/shiftout

if want speed things up, fastdigitalwrite , fastdigitalread, , how build software spi functions it. can find code in standard sd card library of latest arduino build,

quote
/libraries/sd/utility/sd2card.cpp
/libraries/sd/utility/sd2pinmap.cpp


cheers,

jack


Arduino Forum > Using Arduino > Programming Questions > SPI master & slave simultaneously


arduino

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support