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
Posted: Tue Apr 03, 2007 1:23 pm
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.
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