SPI multiprocessor

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

Hi,

I have board with 4 AVR processors. They are communicating over SPI (1 x master AVR M162 + 3 x slave AVR M168) For programming I am using STK 500 - ISP. When I want load program into one cpu, remain cpu are by DIP SWITCH in reset. Some time when I programming one CPU, programs in others are deleted. SPI is 5cm long. Are require some resistors (pull up / down), terminators... ?

Thanks

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

It sounds like you have a problem with uncontrolled chip selects. In operation the master controls the chip selects, SCLK, and MOSI lines. During programing it is the programmer that does this. Have you allowed for these possibilities?

We never have time to do it right,
but we always have time to do it over

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

Given that the CPUs are programmed by holding RST low and using the SPI port I'd say it's a dead cert that you will have issues.

Quote:
remain cpu are by DIP SWITCH in reset

If anything the other CPUs should not be held in reset, but then you will have issues with contention on the MISO signal unless you have the SS sorted properly.

______
Rob

Scattered showers my arse -- Noah, 2348BC.
Rob Gray, old fart, nature photographer, embedded hardware/software designer, and serial motorhome builder, www.robgray.com

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

Hi,

I agree with Graynomad. Because your AVRs are all in a reset state ISP programming signals are getting through to all your AVRs and erasing and programming all of them or at least having a go.

I have managed to do a similar thing as you are trying. I was programming 8 ATmega16s on a panel of 8 pcbs with their MOSIs all connected, their MISOs all connected and their SCKs all connected. Their individual RSTs where brought out to another AVR which would monitor the serial commands from the PC to the ISP programmer (An STK500 too) and when it saw the command 'Programming Enable' go out to each of the 8 ATmega16s it would issue a reset pulse to all but 1 of the 8 ATmega16s and so when those 7 ATmega16s saw further ISP commands they would ignore them as they hadn't received the 'Programming Enable' ISP command first after reset. It would know which of the 8 ATmega16s to not reset by monitoring the command to set the STK500's analog voltage to 0.1 to 0.8 volts. A batch file for the command line version of the STK500 application was written to progam all the 8 ATmega16s in one hit .

Obviously you can't do this easily with your setup but I do have a suggestion that in effect does a very similar thing:

Instead of routing the RST signals via the DIP switch, you could route the SCK signals via the DIP switch and connect all the RSTs together. This way all the AVRs would be held in a known reset state but the ISP commands would get clocked into only one AVR at a time

Hope this helps and maybe even works.

Good luck

Pete

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

SCK instead RESET - important. I will try it.

Thanks Pete