SPI port failure

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SPI port failure

3,840 Views
SSK
Contributor I
Hi Forum Members,
 
I am using MC9S12A128 in one of my projects. I am using its SPI interface to communicate with MC68HC908AP16. The SPI communication works fine but sometimes it is found that the SPI port of MC9S12A128 fails to communicate and in turn it is found that the SPI port itself is of no use. The controller as such works fine except SPI port. What could be the possible reason(s) for this? Whether any care is needed from hardware/software design point of view for SPI?
 
Your earliest help in this regard will be highly appreciated.
 
Thanks in advance.
Labels (1)
0 Kudos
6 Replies

634 Views
bigmac
Specialist III
Hello, and welcome to the forum.
 
If one of the SPI flags is not cleared, an overrun condition can occur, that may prevent further communications.  Do you regain some communications after a reset?  You will need to post more details on what you are attempting ot achieve, and on the nature of your problem.  Preferably also post your SPI communications code for both master and slave.
 
If you also search the forums, you will find many code examples for SPI master communications (but far fewer for slave operation).  Do not ignore the 8-bit forum because the SPI modules for 9S12 and 9S08 devices are quite similar.
 
Regards,
Mac
 
0 Kudos

634 Views
SSK
Contributor I
Hi Mac,
 
After reset also the SPI port does not communicate. It seems that the SPI port gets damaged permanantly. Whether any care from hardware/software point of view for SPI design is needed?
 
Regards,
SSK
0 Kudos

634 Views
bigmac
Specialist III
Hello,
 
Yes, it is possible to potentially cause damage the MCU devices in a number of ways.  The following possibilities come to mind -
  1. Incorrect connections between the two MCUs.
  2. The two MCUs have different Vdd supply voltages.
  3. The two MCUs operate using different power sources, and one of the sources is turned off.
  4. Both MCUs are simultaneously configured for SPI master operation.
  5. The interconnections between the two MCUs have been subjected to severe static discharge, or other over-voltage.
Items 1, 2, 3 and 4 can result in over-current stress.  When experimenting, it is probably a good idea to fit series resistors (say 1k) in each of the interconnections, so as to limit any excess current.  SPI communications is not intended to cater for wide physical separation between master and slave(s).  They should be in very close proximity, preferably on the same circuit board.  This is likely to minimize the possibility of static discharge problems.
 
Have you been able to ascertain whether both MCUs are damaged?  When you send a byte from the master SPI (with slave disconnected), can you observe the presence of either the clock output signal, or the MOSI data signal?  You will need to monitor these using an oscilloscope, preferably with single sweep capture.  The monitoring process will be much easier if you significantly slow the SPI clock rate of the master.
 
Finally, did you successfully achieve SPI communications prior to the damage occurring?
 
Regards,
Mac
 


Message Edited by bigmac on 2007-12-13 06:26 AM
0 Kudos

634 Views
SSK
Contributor I
Hello Mac
 
Thank you very much for your nice reply.
 
Yes, it is possible to potentially cause damage the MCU devices in a number of ways.  The following possibilities come to mind -
  1. Incorrect connections between the two MCUs.
  2. The two MCUs have different Vdd supply voltages.
  3. The two MCUs operate using different power sources, and one of the sources is turned off.
  4. Both MCUs are simultaneously configured for SPI master operation.
  5. The interconnections between the two MCUs have been subjected to severe static discharge, or other over-voltage.
Items 1, 2, 3 and 4 can result in over-current stress.  When experimenting, it is probably a good idea to fit series resistors (say 1k) in each of the interconnections, so as to limit any excess current.  SPI communications is not intended to cater for wide physical separation between master and slave(s).  They should be in very close proximity, preferably on the same circuit board.  This is likely to minimize the possibility of static discharge problems.
 
This could be the possible area where I need to concentrate. I am having multiple I/O cards - Analog Input, Analog Output, DIO etc placed at various slots. AI card is placed at considerably larger distance from the master SPI. In this case whether 1K series resi. will help me to minimize the problems? What could be the other resolution?
 
Have you been able to ascertain whether both MCUs are damaged?  When you send a byte from the master SPI (with slave disconnected), can you observe the presence of either the clock output signal, or the MOSI data signal?  You will need to monitor these using an oscilloscope, preferably with single sweep capture.  The monitoring process will be much easier if you significantly slow the SPI clock rate of the master.
 
This I need to check using CROs.
 
Finally, did you successfully achieve SPI communications prior to the damage occurring?
 
Yes !! Above configuration of IO cards work normally. Only in some cases, even after some successful working cycles, the failure occurs.
 
Regards,
SSK
0 Kudos

634 Views
bigmac
Specialist III
Hello SSK,
 
Are you also implying that the analog input, analog output and DIO cards also utilize SPI communications?  I presume your "considerably larger distance" would amount to locating the card at the opposite end of a card cage.  You may find that permanent series resistors for each output, whether at the master or a slave, may offer a measure of over-current protection, especially when "hot plugging" is possible (but perhaps not recommended).  Depending on the amount of loading capacitance, a reduced SPI clock frequency might prove necessary.
 
If you wish to protect the MCU, at the expense of a more easily replaceable component, you might also consider non-inverting buffers for both input and output lines, at the master card.  With this arrangement, protective resistors would still be desireable, to protect the buffer device.
 
Another measure would be the inclusion of a pair of Schottky diodes at each line, to offer some additional transient protection at the card connector (for both master and slave ends).  However, the diodes will contribute to the total load capacitance.
 
Regards,
Mac
 
0 Kudos

634 Views
SSK
Contributor I
Hi Mac,
 
Thanks again for nice reply.
 
I will certainly work on these suggestions. Is anybody facing similar kind of experience with SPI port? what are their observations?
 
Thanks in advance.
 
Regards,
SSK
0 Kudos