Go Down

Topic: Is it possible to control SPI interface with software (code) using NANO pinouts? (Read 200 times) previous topic - next topic

F1_

Apr 28, 2017, 09:02 pm Last Edit: Apr 28, 2017, 09:25 pm by F1_ Reason: Making the question even more clear
Morning everyone,

I know Arduino NANO has 6 pins dedicated to attach communication Modules (which are "Reset, SCK, MISO, 5V, MOSI, GND - link) but assuming I already have one module using all that 6 pins, is it possible to use the Arduino NANO pinouts to controll the SPI Interface?


In other words I need a second AVR-ICSP but ArduinoNANO only has one, can I use the ArduinoNANO pinouts to control another communication module since I don't have a second AVR-ICSP?

CrossRoads

MOSI, MISO, SCK on D11,D12, D13 are available for all SPI slaves. Each needs its own slave select/chip select pin.
D10 must be an output, even if not for a select line, for the NANO to be SPI master.

There is no pin on the ICSP header to use as a select line.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

F1_

First thank you for your time and attention,
I am sorry for needing your confirmation again but please understand that English isn't my Native Language.

So it is possible to make a SPI slave using the pinouts right?

But if I wanted to make this NANO the Master it would be harder because there is no select line, did I get it right?


CrossRoads

If you want the Nano to be a slave, use D10 as it's slave select pin. When low, the device is in SPI slave mode and is looking for an externally driven SCK and data coming on MOSI, and will transfer data out on MISO.
I think this page has details you could use:
http://www.gammon.com.au/spi
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CrossRoads

"But if I wanted to make this NANO the Master it would be harder because there is no select line, did I get it right?"
For the Nano to be master, D10 has to be an output, and it controls the low &  high of the select lines going to the slaves.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

F1_

Thank you very much Mr. CrossRoads!
That's all the information I needed, once more thank you very much! :)

Go Up