Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Any idea on SPI malfunction detection?

Status
Not open for further replies.

seyyah

Advanced Member level 2
Joined
Oct 7, 2001
Messages
646
Helped
8
Reputation
16
Reaction score
8
Trophy points
1,298
Activity points
6,233
I want to detect and reinitialize the spi communication if it fails. I mean the communication may seem to continue but it may loss the synchronization with a peripheral device and it may read nonrelevant datas or it may halt. What do you do or what can we do in order to detect those situations and reinitialize and restart the communication.
 

SPI protocol itself doesn't have provisions for error detection. But if the structure of the data, which the SPI slave is sending, allows to detect the loss of synchronization you're describing, or other faults, then it's possible to achieve what you're trying to do. What is the peripheral?
 

SPI has the select signal as sufficient synchronization means. There are SPI-like protocols, that access a single slave without SYNC/CS, they need additional methods, e.g. timeout to reset the communications to a known state.

Because SPI is basically intended for board level data exchange, it doesn't consider hardware transmission errors and doesn't provide an integrity check at the physical layer.
 

to add, because SPI is clocked, synchronization is maintained. A frequent 'checksum'? to catch a non responding device.
 

Hi

Try writing some known data to a non used non changed slave register

(in some SPI enabled devices you can use the control register)

Whether you can read it back - the SPI hardware is working!

All the best

Bobi

The microcontroller specialist
 

seyyah said:
I want to detect and reinitialize the spi communication if it fails. I mean the communication may seem to continue but it may loss the synchronization with a peripheral device and it may read nonrelevant datas or it may halt. What do you do or what can we do in order to detect those situations and reinitialize and restart the communication.
I assume you want to reinitialize the spi communication from the master side?

IF so, what is the master, a microcontroller? Which one? IF it is, are you using the hardware SPI or bit-banged routines?

If you are sure the master is losing sync with a slave device you can either:

1. Reset the slave if you have control over the reset line.

2. Bring the SS line high on the slave in question, then low again to reset the slave's SPI interface. (this entirely depends on what the slave is)

3. Disable SPI enable in the master (if possible, i.e. with a microcontroller), then re-enable it.

If you provide more information I am sure someone may find a solution for you.

Good Luck
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top