SPI onBoard Network

Mega16 master, Mega8 slave

Peter KWS
Benutzer
Avatar
Gender: n/a
Age: 41
Posts: 18
Registered: 11 / 2011
Subject:

SPI onBoard Network

 · 
Posted: 28.11.2014 - 11:40  ·  #1
Hi all. I have a few questions. I'm trying SPI onboard NETWORK, as in the sample programms, SPImaster and SPIslave. I want to ask if anyone has tested sample programs are written or just the head? For example, in the manual it says ... The internal mode of the SPI peripheral must be Identical in the master and the slaves and is Declared in this
Manner:
Define SPIOrder = MSB; {LSB}
SPICPOL = 0; {0/1}
SPICPHA = 0; {0/1}
SPIpresc = 0; {0/1/2/3}

And Sample programms =

SPIslave:
SPICPOL = 0; {0/1}
SPICPHA = 0; {0/1}
SPIpresc = 0; {0/1/2/3}

SPImaster:
SPICPOL = 0; {0/1}
SPICPHA = 0; {0/1}
SPIpresc = 3; {0/1/2/3}

SPIpresc do not match. It's right?

Test programs do not work, at least not me.
Hardware connection is ok, all lines 10K pullup,
from master portB, 0 i'm ussing to slave ss pin.

Anyone have idea? Thanks all Peter :)
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 24
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: SPI onBoard Network

 · 
Posted: 28.11.2014 - 14:14  ·  #2
Hello Peter,

a SPI or TWI Network is always a bad idea if the slave is any CPU.
The slave interface must run with interrupts and no interrupt delays
are allowed. Multitasking and other heavy duty interrupt jobs must
be avoided.

I always prefer a TTL UART interface, maybe with a SLIP protocol for
security and speed.

rolf
Peter KWS
Benutzer
Avatar
Gender: n/a
Age: 41
Posts: 18
Registered: 11 / 2011
Subject:

Re: SPI onBoard Network

 · 
Posted: 28.11.2014 - 18:44  ·  #3
Maybe I believed tutorials, I did not know that they are dysfunctional. But I have done hardware where Mega128 as master and 3 slaves with _ mega8. So that must somehow be solved using spi wires. probably write my own protocol like serial comunications with 74HC595. Thanks Rolf have a nice day :)
Avra
Schreiberling
Avatar
Gender:
Location: Belgrade, Serbia
Age: 53
Homepage: rs.linkedin.com/in…
Posts: 653
Registered: 07 / 2002
Subject:

Re: SPI onBoard Network

 · 
Posted: 29.11.2014 - 13:50  ·  #4
Rolf just wanted to say that SPI network might not be the best option if you have interrupts or multitasking, because you will have errors in communication in such a case. You will be spared of much of these headaches if you use buffered serial communication, and that was the reason why it was recommended instead. I would use SPI network if a very high speed is needed, packets are very short, and short interrupts are acceptable in my application. In your test I would check with logic analyzer if anything is coming out of SPI master, cable length and all connections, and if your initialization set wrong some some IO pin directions.
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   77   91 · Page-Gen-Time: 0.022293s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI