View previous topic :: View next topic |
Author |
Message |
evsource
Joined: 21 Nov 2006 Posts: 129
|
SPI slave lockup |
Posted: Wed Sep 01, 2010 9:54 am |
|
|
Hi,
I'm using a 18F4685 master and 18F2221 (also tried a 18F2620) as the slave. Both are running at 40mHz, and the SPI clock is running at 625k (SPI_CLK_DIV_64). I'm using PCH 4.109.
The bus is operating in a noise switching environment. Measures have been taken with the voltage supply rails to keep them clean. Under the heaviest noise situations, the slave SPI bus will lockup. The slave runs a timer looking for data from the master. If the timer times out, I assume there might be a problem with the bus, and do the following:
Code: | setup_spi(FALSE);
setup_spi(SPI_SLAVE | SPI_MODE_3 ); |
Sometimes that works to get the communications working again, but not always. The only thing that works every time is to power down the chip and power it up again.
What could be causing the SPI to lock up? I've tried checking for the receive overflow indicator bit in the SSPCON1 register. That seems the only thing in the registers that the slave requires clearing in software if it gets set. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Sep 01, 2010 11:37 am |
|
|
Do a forum search for this:
Set it to: Search for all terms
There are several threads with suggested solutions. |
|
|
evsource
Joined: 21 Nov 2006 Posts: 129
|
|
Posted: Wed Sep 01, 2010 12:35 pm |
|
|
PCM programmer wrote: | Do a forum search for this:
Set it to: Search for all terms
There are several threads with suggested solutions. |
Thanks ... sort of. Unless I missed it, none of those talked about the slave's SPI getting locked up.
I'm using the slave select line. Several of those posts talked about that. |
|
|
|