UTMonkey
Member
Dear All,
Well actually not woes, I feel as if I have made a lot of progress but I am currently having difficulties with my 18F2550 -> I2C -> RTC project.
I have successfully been able to set the relevant START condition and transmitted the various bytes of data (I have the ACK's to show for it! ) and then successfully sent a STOP condition to the MSSP which appears to work as the SSPSTAT has the P bit set.
I now want to read the area of the RTC that I have written to, so according to the datasheet (DS1307) I reset the register pointer by:-
1. Sending a start condition
2. Perform a write with the address of the I2C slave (with the RW set at 0)
3. Perform a write of memory address (0x00).
4. Send a Stop.
The problem is that my program is stuck at step 1 waiting for SSPIF to be set, the start routine basically
1. Waits for no activity (no RW or other SSPSTAT activities )
2. Clear SPIF bit
3. Set SEN bit
4. Wait for SPIF bit to set (where it loops)
The strange thing is this "start" routine is the same routine that was run previously which worked fine.
I wondered if there were any bits set from the previous (succesful) write sequence that may disable a start condition from continuing.
The only thing I have noticed is that prior to the 2nd start sequence running is that SSPSTAT is 0b1001000 (basically SLEW = Disabled and P (stop bit) = enabled .
Perhaps the presence of the STOP bit stops a START sequence?
I could submit my code, but I would like to tidy it up first....
Hope this all makes sense.
Regards
Mark
Well actually not woes, I feel as if I have made a lot of progress but I am currently having difficulties with my 18F2550 -> I2C -> RTC project.
I have successfully been able to set the relevant START condition and transmitted the various bytes of data (I have the ACK's to show for it! ) and then successfully sent a STOP condition to the MSSP which appears to work as the SSPSTAT has the P bit set.
I now want to read the area of the RTC that I have written to, so according to the datasheet (DS1307) I reset the register pointer by:-
1. Sending a start condition
2. Perform a write with the address of the I2C slave (with the RW set at 0)
3. Perform a write of memory address (0x00).
4. Send a Stop.
The problem is that my program is stuck at step 1 waiting for SSPIF to be set, the start routine basically
1. Waits for no activity (no RW or other SSPSTAT activities )
2. Clear SPIF bit
3. Set SEN bit
4. Wait for SPIF bit to set (where it loops)
The strange thing is this "start" routine is the same routine that was run previously which worked fine.
I wondered if there were any bits set from the previous (succesful) write sequence that may disable a start condition from continuing.
The only thing I have noticed is that prior to the 2nd start sequence running is that SSPSTAT is 0b1001000 (basically SLEW = Disabled and P (stop bit) = enabled .
Perhaps the presence of the STOP bit stops a START sequence?
I could submit my code, but I would like to tidy it up first....
Hope this all makes sense.
Regards
Mark