Detect I2C Stop on LPC812

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Detect I2C Stop on LPC812

1,294 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by remcopoelstra on Thu Nov 27 03:34:08 MST 2014
Hi,

I'm using an LPC812.
I'm trying to detect when a transfer has ended over the I2C bus. I've enabled the SLVDESEL interrupt, but my interrupt handler is only called when the address for the next transfer is received. The documentation states that SLVDESEL should also be set on a STOP condition.
I've set a breakpoint on the SLVDESEL handling code and I've included a screenshot of my scope, where can be seen that communication only stalls after the start of the next transfer.
Note that the address is the same, so if SLVDESEL only reacts on addresses, then it should not be set, as the same slave is addressed!

This is how I handle the SLVDESEL interrupt:
uint32_t pending=Chip_I2C_GetPendingInt(LPC_I2C0);

if (pending&I2C_INTSTAT_SLVDESEL) {
uint32_t monitor_read=LPC_I2C0->MONRXDAT;
Chip_I2CS_ClearStatus(LPC_I2C0,0xffffffff);
handle->callbacks->command_done(handle->buffer,!(monitor_read&I2C_MONRXDAT_MONNACK));
}
if (pending&I2C_INTSTAT_SLVPENDING) {
           /*Handle normal communication, works fine*/
        }


Since the SLVDESEL is too late, I read the wrong data from MONRXDAT, so I miss the acknowledge bit just before the STOP (which is what I'm interested in).

How can I reliably detect the STOP condition?

Thanks in advance.

Kind regards,

Remco Poelstra
Labels (1)
0 Kudos
Reply
1 Reply

1,245 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by remcopoelstra on Thu Nov 27 03:37:14 MST 2014
Of course did I forget to attach the image....
0 Kudos
Reply