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

How to break out from I2C lockup incident

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



Joined: 02 Dec 2005
Posts: 9

View user's profile Send private message

How to break out from I2C lockup incident
PostPosted: Tue Apr 03, 2007 9:21 am     Reply with quote

Hi,

I'm using compiler v3.249. I'm using CCS I2C built-in function (#use i2c....). Occasionally when I transfer information through I2C bus, I will faced some software hang problem. This hang usually occurs on the #use i2c.... line. May I know what usually can cause the program to hang at #use i2c... when doing I2C transfer.

If my code is stuck on this line, is there anyway that I can use to break out from this 'hang situation' and maybe send an error message or do a restart I2C transmission again.

Cheers, Felix
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 03, 2007 1:23 pm     Reply with quote

Compile a test program that uses all the CCS i2c functions.
Print out the .LST file. Look at the ASM code for each function.
Look for places in the code where it polls a status bit, in a loop.
For example, it might poll the "Buffer Full" bit in the SSPSTAT register.

These are places where possibly the code could lock-up.
It might get stuck in a polling loop, where the status bit never goes true.

These are places where you could add a timeout test. You would have
to write your own versions of the CCS routines to add this feature.
Use the #byte and #bit directives to declare the addresses of the
i2c registers and register-bits.
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