SPI Hardware Questions...

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All,

I am working on a project where the "opportunity" just came up to use the SPI interface and let two AVRs communicate with each other via SPI.

The problem is that the /SS pin is already committed and it would take a board turn to free that pin up. Besides, it isn't even connected on the ISP programming header which I did put on my boards and is obviously used for AVR to AVR communications during programming.

The way I read the datasheet for the SPI functionality, it looks like you need the /SS pin to even activate the SPI functionality in slave mode. It apparently doesn't matter in master mode though the examples show it being tied to the slave to turn the slave's SPI function on and off remotely.

What I'd like to do is connect two boards with a 6-pin ribbon cable and use the stock ISP interface.

The questions - is there a workaround (besides bit-banging)? During ISP programming, the "master" holds reset low and that allows reaching into the device for writing to memory. I just want to communicate.

It sure would be handy just to connect up a ribbon and use the built-in SPI functionality but I'm thinking I can't and my only solution if I want ISP *and* SPI is to have two separate headers - one with the /SS pin for SPI and one without that has the conventional pinout for ISP.

Anyone able to shed some light?

Please note - this post may not present all information available on a subject.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Previous statements I made here were completely incorrect.
My apologies.
Dave Raymond

Last Edited: Mon. Apr 25, 2005 - 02:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Dave,

I can certainly do that but the /SS pin is being used as an output now and I can't just tie it low (on this board turn at least) and re-route functionalty without running jumper wires on a stack of boards.

I was just wondering if there was some way around this so I could use SPI without having to use /SS as well.

Thanks, though.

Please note - this post may not present all information available on a subject.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Previous statements I made here were completely incorrect.
My apologies.
Dave Raymond

Last Edited: Mon. Apr 25, 2005 - 02:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One guy is the master, both use his clk, the other guy is the slave... his mosi goes to the master miso

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the replies Dave and Bob.

I'll give it a try and see how it works. It's just the way I read the datasheet it seems to say in slave mode you have to use /SS as an input to assert slave mode. The way I read it, it says if you set SPI and master, using /SS is optional. But if you use slave mode SPI, set by register, /SS becomes an input regardless of the DDR setting and unless it is asserted low, the SPI functionality is disabled and it doesn't listen - i.e. the /SS pin is used as a chip select line and unless it is asserted, the chip isn't selected.

But I'll code in a routine and see if it works or not. I would really like to just set one as master and the other as slave in their respective firmwares and then have comms just work without having to bit-bang.

Please note - this post may not present all information available on a subject.