koesterk
Joined: 15 Apr 2008 Posts: 3
|
Command "write_eeprom" collides with incoming I2C |
Posted: Tue Apr 15, 2008 9:21 am |
|
|
Hi guys,
following problem occurs: PIC16F677 works as an I2C slave in an embedded system. The I2C handler is interrupt based and similar to the compiler's examples. Additionally, the software has to save frequently status bytes to the internal EEPROM. Now it might happen that the I2C stream occurs while command "eeprom_write" has just been started. In this case on electrical side the PIC confirms the identified device address, but following bytes are all NAK'ed. The next -and all following- incoming I2C commands are directly NAK'ed at the device address. I need to reset the device to get I2C back on track.
I guess that the global interrupt is disabled while waiting for the EEPROM's write confirmation. Thus, the Interrupt Service Routine can't move the incoming bytes away.
Two questions: Anybody out there with such (or similar) experiences? Does it make sense to write my own EEPROM write command in assembler with disabled GIE only around the atomic sequence 0x55 - 0xAA?
Second question: What happens to the I2C peripheral when SSP interrupt is not able to handle incoming bytes? Any chance to re-activate I2C functionality from software? Resetting the PIC no option for me.
Thanks a lot and best regards
Klaus |
|