Ok, I've replaced _WDTE_SWDTEN in CONFIG2 with _WDTE_OFF and I'm still experiencing the glitches every 6.5 seconds. I've included the config registers in case there's something else that may be causing problems:
__CONFIG _CONFIG1, _FCMEN_OFF & _CSWEN_ON & _CLKOUTEN_OFF & _FEXTOSC_OFF & _RSTOSC_HFINT1
__CONFIG _CONFIG2, _BOREN_OFF & _WDTE_OFF & _MCLRE_ON & _PWRTE_OFF & _LPBOREN_OFF & _STVREN_OFF & _DEBUG_ON
__CONFIG _CONFIG3, _WRT_OFF & _LVP_OFF
__CONFIG _CONFIG4, _CP_OFF & _CPD_OFF
I've also attached an image to show the state for verification.
I've done a slightly deeper debug plot showing the following debug points....
START: indicates that state dealing with the START condition is executing
Nxt START: is tied to the I2C_ISR_END to indicate that the next state is a START
Nxt nSTART: is tied to the I2C_ISR_END to indicate that the next state is NOT a START
GLITCH: indicates that an error has occurred.
There is no other place in my code that signals a START condition on the bus other than this function, which is shown to be called twice on occasion, yet when this happens, execution doesn't get to the I2C_ISR_END function after the first START signal to store the next state prior to returning.
This is the code - apologies that it's not in a code box but I'm experiencing a lot of forbidden messages when I've previously tried:
; Trace shows the following code has run twice in succession after about 6.5 seconds....
bsf I2CCON2, SEN
; but the flow is not getting to the following instructions after the first start in a double start situation!
In the main ISR at address 0x0004, I clear the GIE bit to prevent further interrupts from occurring....just in case. Interrupts are re-enabled by setting the GIE bit right before the RETFIE instruction.
edit: including the I2C_ISR_END functionI2C_ISR_END movwf I2cMstState movf I2cMstState, F ; just in case for sanity btfsc STATUS, Z goto NXT_ZERO; Next state still requires the bus Dbg6ON Dbg6OFF returnNXT_ZERO; Bus clear and next state is ready for another START Dbg5ON Dbg5OFF return
post edited by iisnsr - 2019/10/25 07:04:24