|
|
View previous topic :: View next topic |
Author |
Message |
Ttelmah Guest
|
|
Posted: Wed May 10, 2006 10:28 am |
|
|
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
|
well.... |
Posted: Wed May 10, 2006 10:56 am |
|
|
...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
|
|
Posted: Wed May 10, 2006 11:46 am |
|
|
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 |
|
|
|
|
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
|