Pages: [1]   Go Down
Author Topic: SPI exchange pin?  (Read 385 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
i'm working on a Arduino duemilanove. And I would like to know if it's possible to exchange some pins in the SPI protocol..?
In place of,

13      Spi Clock
12      (Datain) //not used
11      Dataout
10      Slaveselect

I would like to define:

13      Spi Clock
12      Dataout
11      Slaveselect1
10      Slaveselect2
7      (Datain)

I just try to exchange Datain and Dataout,... but the Dataout signal don't seems to work in this configuration on my oscilloscope,...?

Any Idea?
thanks
Logged

Wuppertal/Germany
Offline Offline
God Member
*****
Karma: 1
Posts: 895
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Jerome.

No, this is not possible when using the Hardware SPI feature of the ATMega.

But if you don't need to read back any data through the DataIn-pin you can code the SPI-Protocol in software by simply toggling any pin you like.
It will be much slower than the Hardware SPI (Clock is in the 100Khz range), but you have full control of the pins used.

I did this for a SPI-driven LCD http://code.google.com/p/doglcd/
and for a LedMatrix driver chip http://www.arduino.cc/playground/Main/LedControl

Its fast enough for these two projects

Eberhard
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for your reply.

Indeed, impossible to exchange spi pin of places (13,12,11,10),...except that you can add more than one slave select on the desired pin you want.

and if you dont use the MOSI or MISO pin, you can assign it for another use.

right?

thanks.
Logged

Wuppertal/Germany
Offline Offline
God Member
*****
Karma: 1
Posts: 895
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
indeed, impossible to exchange spi pin of places (13,12,11,10),...except that you can add more than one slave select on the desired pin you want.
Yes, you can use any other digital pin to select the slave you want to talk to.
Quote
and if you dont use the MOSI or MISO pin, you can assign it for another use.
No, the MOSI and MISO pins are not available for "normal" IO when you activate the Hardware-SPI module.

Eberhard
Logged

Pages: [1]   Go Up
Jump to: