nano and SPI

Hi,

short question: can I use SPI with the nano?

The arduino site states: SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which, although provided by the underlying hardware, is not currently included in the Arduino language.
In the forum though I find topics about the nano using SPI.

I want to use a nrf24L01 with it.

Thanks
Robert

It seems to have those pins:

The arduino site states: SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which, although provided by the underlying hardware, is not currently included in the Arduino language.

Where on earth does it say that? Certainly not here:

Yes you can. The SPI library uses those pins.
Here's a test sketch I was working on today.
D13, SCK, is connected to a shift register serial clock
D10, Latch, is connected to a shift register output register clock
D11, MOSI, is connected to a shift register Serial data in line.
When D5 is connected to GND, 11111111 is sent to the shift register.
When D5 is open (pulled high by internal pullup resistor) 00000000 is sent out.

#include <SPI.h>

byte latch = 10;

void setup(){

  pinMode (5, INPUT);
  digitalWrite(5, HIGH);

  pinMode (latch, OUTPUT);
  digitalWrite( latch, HIGH );
  SPI.begin(); 

}

void loop(){
  if (digitalRead(5) == LOW){

    digitalWrite(latch, LOW);
    SPI.transfer(0xFF);
    digitalWrite (latch, HIGH);
  }
  else {
    digitalWrite(latch, LOW);
    SPI.transfer(0x00);
    digitalWrite (latch, HIGH);
  }
}

Is this a cross-post of: http://arduino.cc/forum/index.php/topic,131566 ?

It looks like it. Grrr.

No. It isn't. If you read the post carefully you see that in the post you state, I talk about my two Romeo All-in-One boards. Not about the nano.

So long.
Robert

It's stated here: http://www.arduino.cc/en/Main/ArduinoBoardNano

At the link you posted, the nano isn't listed either.

Thanks
Robert

SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which, although provided by the underlying hardware, is not currently included in the Arduino language.

Wow, is that page in need of an update!

CrossRoads:
Yes you can. The SPI library uses those pins.

Thanks a lot. It is really strange that it is nowhere stated that the nano works with SPI.
Even wikipedia doesn't state it: Arduino (Plattform) – Wikipedia

Thanks for the information.

Robert

robvoi:
At the link you posted, the nano isn't listed either.

What of it? As the Nano page says:

The Arduino Nano is a small, complete, and breadboard-friendly board based on the ATmega328 ...

The Atmega328 is the processor used in the Uno. The SPI library works on the Uno. Therefore it works on the Nano.

The arduino site states ...

It helps to quote the link in the original post, rather than having to have it dragged out of you. The site is quite large.

robvoi:
short question: can I use SPI with the nano?

See this page:

I took the first example, copied and pasted into a sketch, set the board type to Nano, and it compiled OK.

Was that too difficult for you to try for yourself?

Hey Nick,
calm down. I don't own a nano but I am just evaluating which board to buy.
If you don't have something useful to state like "I use it, it works" or "tried it - doesn't work" please don't post.

Btw: That you can compile somehting doesn't mean it works.

Thanks
Robert

It's the same processor, it has the required pins, and the sketch compiles without errors. What more do you want? I don't have a nrf24L01 to hand to test it.

Yep. That's why I wonder about the statement on arduino.cc and the listing of supported protocols on wikipedia.

@robvoi

please be appreciative of the help you're getting. Nick is really helping you here.

BTW wikipedia is not a source of information about Arduino. There are several problems with their pages about Arduino but it's a pain to get them fixed.

m

I use it, it works.

Happy now?

Hi,

thanks for your response. I am glad about any help here.
I felt offended by more or less stating that I am too lazy to test things myself by by cross posting. Both is not true as explained in my answers. Sneding me PMs and blocking my responses doesn't help either.
Maybe it was just a language issue. So let's leave it as this.

I think it is clear now that SPI on a nano works (also thanks to AWOL - yes happy now :slight_smile: ). The question what the statement about SPI on this official arduino page http://www.arduino.cc/en/Main/ArduinoBoardNano means stays.

Thanks for the information.

Robert

The question what the statement about SPI on this official arduino page http://www.arduino.cc/en/Main/ArduinoBoardNano means stays.

These pins support SPI communication, which, although provided by the underlying hardware, is not currently included in the Arduino language.

I take it to mean that, like I2C, there is/are no in-built simple function(s), like say "digitalRead/Write" or "analogRead/Write" to support SPI.
There is of course, an SPI library.

OK. That's an acceptable interpretation. Thanks. :slight_smile:

HI,

just got my nano. SPI works fine with Pins 9 to 13.

Thanks again for the support.

Robert