Avr spi and bod strange behavier

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

Hello i have atmega 32 master and atmega 328 slave communicating on spi, all works great, but when in master the bod at 4v is enabled spi does not start working at startup, if i connect scope probes on any spi line ( i tryed to see what is going on) the spi starts to work wright away the simptom at startup dissapears..., i tried to blink a led in master spi isr (timer based) routine and it does blink with or without bod enabled, so that means spi in SW at least sends something, the slave does its job and spi isr awaits(not hung) for master to send.... Any ideeas? It seems like spi HW gets latched or something else...

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

Are the master and slave mpu's both powered from the same power source?

 

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

yep

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

Mihai_F wrote:
yep

Tell more.  Common ground?  Schematic?  Source code, preferably complete test program for both sides that demonstrates the symptoms.

 

/SS pin handling?

 

Simply ship a 'scope with each unit.

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Well found the problem, by enabling the bod created a bit of delay at start up for the master, and master and slave at power up did not reach operational level at the same time (slave being faster) witch made them out of sinc at start up, but contributing to this problem was that i did not have SS line from master to slave (on slave SS was connected to ground, an older issue that was not fixed). So i added the SS line (and master pulls it low when sending) and now every thing works even better than before (from sinc point of view ).

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

yeah  i was told on an older post a few months a go when started with spi about SS line, but did not pay enough attention to it's importance...

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

That is a VERY strange design that relies on the result of a race at startup for correct operation.

 

IMO/IME there should never be a race in an SPI setup. 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Strange, yes, design, well..... , it was not intended to be like that, it was more like i did not think it might be a problem.... But not it is obvious.

Last Edited: Wed. Jan 17, 2018 - 12:09 PM