1

I’ve checked the nano’s tech specs but I can’t seem to find any information regarding it. I’ve tried setting it to pin 26 (digital output)

asked Nov 21, 2019 at 13:01
1
  • the Nano Every doesn't have pin 26 Commented Nov 21, 2019 at 14:25

1 Answer 1

2

The following answer assumes the Arduino is the master.

You can use any pin for that (at least any GPIO pin).

Multiple SPI devices can be connected to a SPI peripheral on an Arduino (in principle).

Every SPI device should have their own CS/CC pin, and is mandatory when you use multiple SPI devices.

For this reason, there is no single pin the SPI can define for being used as CS/CC pin. However, it should give a GND or VCC value, thus a CS/CC pin should typically be configured as a digital input pin (as master) for each slave. (See remark of KIIV too); as slave the CS/CC pin should be a digital output pin.

For the other pins (MOSI, MISO, CLK), the Arduino uses a fixed set of pins because all SPI devices will be connected to these pins.

So the CS pin is configurable, and the other spi pins are fixed.

answered Nov 21, 2019 at 13:07
12
  • 1
    I am not familiar with the chip on that board, but if it's like the other AVR based boards the "primary" CS pin must be set to output (pin 10 on Uno - no idea what it will be on that board off hand). Otherwise SPI won't work. Commented Nov 21, 2019 at 14:28
  • 1
    However don't forget about SS (select slave) pin on AVR based Arduinos. It must be set as output (or at least used as output). Otherwise low level on this pin causes switching SPI to slave mode. Even left unconnected (as an input) it can be source of weird deadlocks in noisy environment. Commented Nov 21, 2019 at 14:30
  • 1
    The SPI peripheral in the chip has two modes of operation: one is Master and the other Slave. Which mode is selected depends on the DDR setting of the primary CS pin. It's a stupid way of doing it, but that's what Atmel's designers chose to do... Commented Nov 21, 2019 at 14:37
  • 1
    @MichelKeijzers I though it's general name for signal. Anyways /SS is active low, so as an input it should be held to the Vcc. The SPI supports multi-master mode and this pin is used to archieve it (only possibility to disable it is use it as an output) Commented Nov 21, 2019 at 14:38
  • 1
    @Majenko this is not ATmega328 or 2560. it is 4809. it has a flag in control register for master/slave mode and the flag is set by the SPI library. the SS pin can be used as input with SPI master mode. The peripherals of the 4809 are more like the SAMD peripherals then classic ATmega MCU peripherals Commented Nov 22, 2019 at 14:06

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.