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 CCS Technical Support

Trouble with I2C comm 18f452 (M) to 18f2550 (Sl)
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Mar 12, 2007 1:31 pm     Reply with quote

Right, but you don't even know if your current code will work on any PIC.
You are testing two things:
1. Your code.
2. The ability of your code to 'fix' a PIC with erratas.

You need to test it, at least temporarily, on a good PIC of a different
type. This will prove that your basic code works at all.

I can't make you do this. All I can do is recommend it. I can't really
help you any further.
PICuser123
Guest







28F2455
PostPosted: Fri Mar 30, 2007 2:17 pm     Reply with quote

I have experienced the same problem as you. I've also noticed that when the slave is removed from the bus and then when the I2c is reconnected things are fine.

I've also connectd 5v to the clk bus when it is stuck and seems to get the device out of the hang state. I've been able to see the PIC hang usually after a reset of power to the slave.

I'm not sure what can be done but is very frustrating. The exact same code works in a 16F690, but not in the 18F2455. Any one find a solution to the problem?
PICuser123
Guest







18F2455
PostPosted: Fri Mar 30, 2007 3:27 pm     Reply with quote

I think I've found a work around. Problem appears to lie within the I2c interrupt.

1) Make sure that the fuse NOXINST is used. If fuse is enabled the PIC does some strange things.
2) Dont use the i2c_read(); in the interrupt. For what ever reason code hangs if used. I just used "incomming = *0xFC9" and read value directly. (I will try to enable it. Since I added the other states)
3) Needed to add in a way to take care of the 2 other I2c conditions. If state = 0 and if state >80 (ie 81). In both these I do an i2cWrite.

I will have to test further, but at least the PIC now can run without getting hung in the I2C ISR. Right now I'm just doing an I2c READ. It may not work with a write. I havent got that far yet.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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