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

No ACK from slave when sending data with I2C
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
Ttelmah
Guest







PostPosted: Wed May 10, 2006 10:28 am     Reply with quote

At this point the problem comes that we cannot see all your code. There are several things 'left unsaid' in the code as posted (no definition for PORT_D as a byte, for example, you don't show if you are using any IO mode overrides, what the chip is, etc. etc.). In particular, there is an erratum for at least 18F chip, that would prevent I2C running if you select the TRIS as an input (which you do). Check this.

Best Wishes
davey



Joined: 04 May 2006
Posts: 17
Location: Sweden

View user's profile Send private message

well....
PostPosted: Wed May 10, 2006 10:56 am     Reply with quote

...I managed to get an acknowledge for the address-byte. I don�t know why, but it started working when I juggled with the cable that�s connected to the ICP-programmer. I suspect that there�s something fishy with my development-board (LAB-X1 from microEngineering Labs).

Anyhuw....now there�s another problem :-) I don�t get an acknowledge on the first data-byte that I send and the i2c-com freezes after 2-3 min. I think it�s the SLAVE that stops working.

I�ve posted a new thread in the forum with an updated code. If you have any thoughts about my current problem, please use that one. But thanx for all the tips&tricks so far....you�ve been persistent :-)

/David
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Wed May 10, 2006 11:46 am     Reply with quote

I've had similar problems with i2c before. You need to make sure that the Slave has enough time to service the interrupt before the Master tries to continue sending more i2c commands or else it might hang.

Try having a pin pulse, in the Slave isr routine, and put a scope on it. Monitor your i2c bus as well and look at the timing between the commands and the pulse signal. If the pulse occurs After the Master starts sending the next i2c_write() or i2c_read() then you will need to put a delay between the commands to ensure the Slave has the time to do it's thing.

I've, also, had to monitor the SSPSTAT register and output it to a port, with LED's connected, to see what the Slave was seeing so I could tell what conditions to look for. I would have the Master single step it's commands when I did this.

Ronald
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