26 Eylül 2017 Salı

I2C Debugger

I2C debugger of Proteus is a useful virtual instrument. You can follow the traffic on the BUS as sniffer or you send messages to devices on the bus. If we look at TC74 example, we see that there are two type of communication caused by write and read functions.

    I2C_MasterWrite( 0, 1, 0b1001101, &I2C_status) :                 S 9A A 00 A P
    I2C_MasterRead( &readValue, 1, 0b1001101, &I2C_status) : S 9B A 1A N P

Syntax of I2C is given at help file.

TC74 datasheet provides structure of write and read protocols. As you can see S 9A A 00 A P corresponds to a write sequence and S 9B A 1A N P corresponds to a receive byte. 1A is the temperature value.


We can monitor clock (blue) and data (yellow) also in oscilloscope 



Possible errors in I2C: 
  1. Pullup resistors are left at ANALOG, change them to DIGITAL
  2. Power supply must be VCC, dont put separate +5V to feed I2C bus
  3. Address may become wrong. In that case, equipment will not respond and you will receive 0x00 byte. for example, I changed the A5 address of TC74 to A1, look at I2C debugger will show only traffic coming from PIC like "S 9A N P" but there is no response from TC74.


Hiç yorum yok:

Yorum Gönder