Arduino Forum

Using Arduino => Networking, Protocols, and Devices => Topic started by: siletto on Nov 15, 2012, 01:32 pm

Title: SPI on other pins
Post by: siletto on Nov 15, 2012, 01:32 pm
Hy!
Is it possible to change which pins are used by the spi communication?
Title: Re: SPI on other pins
Post by: pylon on Nov 15, 2012, 01:44 pm
Not for the hardware SPI. But you can emulate an SPI interface on any 4 GPIO pins but it's way slower. Describe your problem, maybe we have another solution than to change the SPI pins.
Title: Re: SPI on other pins
Post by: siletto on Nov 15, 2012, 02:15 pm
I bought two 2.4Ght radio module which have spi interface, with a 2x4 array 2.54mm pins. They are like:  GND-CE-SCK-MISO
                                                                                                                                                 VCC-CSN-MOSI-IRQ
And i am willing to make a pcb for it, but i want to try it out first.
It is based on the nRF24L01+, so there exists a library which makes the register setting, or hard work unnecessary, but i have to mess up with wires and sockets, pins.
I know that it is not the place of advertisements, but this module(a pair, of course):
http://www.ebay.com/itm/290773692550?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649
Title: Re: SPI on other pins
Post by: SurferTim on Nov 15, 2012, 02:21 pm
Why not use hardware SPI and use different slave select pins for each device? Is there a reason you have ruled out that option?
Title: Re: SPI on other pins
Post by: siletto on Nov 15, 2012, 02:31 pm
Hello. I Maybe wasn't clear.
I want to attach 1 module to the pc, and one to the arduino. The problem is that the matching pins on the module don't line up with the arduino's spi pins, so i have to attach wires between the module, and the arduino, not just simply plug the module into the board.
So i asked if there is a possibility to change the pins used by spi interface.
Title: Re: SPI on other pins
Post by: SurferTim on Nov 15, 2012, 02:37 pm
You can use different pin with software SPI, but it is slower, and takes more resources. If you must connect the wires anyway, why not use the hardware SPI interface? It works pretty good.

If you are going to design a board, do yourself a favor and use the ICSP connector for your hardware SPI data lines. That way it will be both Uno and Mega compatible.
Title: Re: SPI on other pins
Post by: Riva on Nov 15, 2012, 02:38 pm

Hello. I Maybe wasn't clear.
I want to attach 1 module to the pc, and one to the arduino. The problem is that the matching pins on the module don't line up with the arduino's spi pins, so i have to attach wires between the module, and the arduino, not just simply plug the module into the board.
So i asked if there is a possibility to change the pins used by spi interface.

As stated previously you can use software to emulate the SPI but you won't be able to plug the device directly into the arduino headers as I don't think you will never get VCC & GND to match the radios 2x4 header format
Title: Re: SPI on other pins
Post by: siletto on Nov 15, 2012, 04:15 pm
Oh, yes, i almost forgotten it, you are right.
The module needs 3.3V

But thanks for the help.
Title: Re: SPI on other pins
Post by: pylon on Nov 15, 2012, 05:12 pm
Quote
The module needs 3.3V


This probably means it also needs a level converter for the SPI pins, except if it explicitly is 5V tolerant.