I2C Monitor

Your I2C library currently sets up the mbed as a master.  I'd like to monitor the bus and log all data between a master and multiple slave devices.  The bus doesn't like two masters on it.  Any suggestions?


05 Jan 2010

Since you don't intend to participate in I2C traffic but just monitor it, you can't be neither master nor slave (for example, slave has to send acknowledgements of the received data). You'll probably have to use DigitalIn or BusIn, read pin values at fixed intervals and reconstruct the packets.

In the LPC1768 data sheet it states:

All I2C-bus controllers support multiple address recognition and a bus monitor mode.  I guess I'll dig into that a bit.


16 Jan 2010

Oh, interesting. That should work then.

Here's what it looks like I have to do

1) Set MM_ENA = 1 (BIT0 of MMCTRL)
2) Leave ENA_SCL = 0 (BIT1 of MMCTRL)
3) Set MATCH_ALL = 1 (BIT2 of MMCTRL)

16 Jan 2010

You'll need to do 4 in the IRQ handler. And you'll have to do it fast.

I'm not having any luck getting at the MMCTRL register.  Can you guys add a config class to the I2C libraries so we can use the I2C as a bus monitor or slave device?


27 Dec 2010


is there meanwhile a solution for monitoring the I2C-bus? I'm looking for a 'simple' way because i'm just a beginner in mbed.