go_away

Author Topic: SPI SS pin failing on ATMega644  (Read 838 times)

0 Members and 1 Guest are viewing this topic.

Offline mstachoTopic starter

  • Supreme Robot
  • *****
  • Posts: 360
  • Helpful? 10
SPI SS pin failing on ATMega644
« on: March 19, 2012, 07:23:15 AM »
I'm trying to get SPI working between two ATMega644s (uh yes...I am STILL working on this...)  I've narrowed the problem down to a SS pin that isn't working on the master.  I know the rest of it works because when I put the slave's SS pin directly to ground (so that it's always selected) the SPI transmission does what it's supposed to -- turn off an LED once transmission is received.

I've scoped the SS pin on the master, and it doesn't do anything.  It appears to always be held HIGH.  I've put a pull-up resistor on the SS line and still nothing works.  Can anyone think of a reason that a digital output pin wouldn't be doing anything?  Could I have blown exactly the pin that I need?

I'm going to try it with another digital pin and see what happens, but last time I did that nothing worked anyway.

MIKE
Current project: tactile sensing systems for multifingered robot hands

Offline joe61

  • Supreme Robot
  • *****
  • Posts: 417
  • Helpful? 16
Re: SPI SS pin failing on ATMega644
« Reply #1 on: March 19, 2012, 10:01:48 AM »
Just as a sanity check, you are explicitly bringing the SS pin low, right? That is, the SPI hardware doesn't control the SS pin, it's manual.

I'm sure you are, but can't think of anything else right now.

Joe

Offline mstachoTopic starter

  • Supreme Robot
  • *****
  • Posts: 360
  • Helpful? 10
Re: SPI SS pin failing on ATMega644
« Reply #2 on: March 19, 2012, 12:19:52 PM »
yup!  I'm using webbot, so I've tried:

pin_low(SSPIN)

And

pin_make_output(SSPIN, FALSE)

And neither work.  I've tried to change which pin is SS, from B4 to B3, and nothing (and I followed internet advice that said to make sure B4 is output anyway).  The kicker is that I can set B0 all I want -- it has an LED on it and it goes high and low to indicate which Byte I'm sending over SPI.  I can also SEND and RECEIVE stuff over SPI: the slave device turns its LED on when it receives 0x01 and off when it receives 0x00, and that's been happening, as long as I hardwire the SS pin of the slave to ground.

So I'm stumped at this point.  I have absolutely no idea why I can't drive the SS pin low.  My only guess is that the SS pin on the slave is floating somehow and driving the SS pin of the master to a high state always.  But I've tried a pull-up resistor and also, just for fun, a pull-down.  Both 10K.  Maybe the circuit just hates me :-P

I think I'm just going to use an ARM and avoid inter uC communications altogether, but I'd still love to know what's wrong!

MIKE
Current project: tactile sensing systems for multifingered robot hands

Offline joe61

  • Supreme Robot
  • *****
  • Posts: 417
  • Helpful? 16
Re: SPI SS pin failing on ATMega644
« Reply #3 on: March 19, 2012, 01:00:26 PM »
Could it be on the slave side? I mean is the slave driving it high somehow? The only other thing I can think of is a connection problem between the two for that line.

That's a good one. If you ever figure it out let us know what it was.

Joe

 


Get Your Ad Here