CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

SPI slave lockup

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
evsource



Joined: 21 Nov 2006
Posts: 129

View user's profile Send private message

SPI slave lockup
PostPosted: Wed Sep 01, 2010 9:54 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Sep 01, 2010 11:37 am     Reply with quote

Do a forum search for this:
Quote:
SPI slave nois*

Set it to: Search for all terms

There are several threads with suggested solutions.
evsource



Joined: 21 Nov 2006
Posts: 129

View user's profile Send private message

PostPosted: Wed Sep 01, 2010 12:35 pm     Reply with quote

PCM programmer wrote:
Do a forum search for this:
Quote:
SPI slave nois*

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group