Detecting I2C failure

VI70

New Member
I'm planning on using NVRAM module (specifically: DS1307 RTC board with 32k of high endurance EPROM) attached via I2C bus and would like to know how can I tell if communication is successful or not?  I have W8 board.
 
Each time when you write to I2C device, I2C slave will ACK by pulling down the I2C bus.  You can check ZBIT to see that change.  If there is no I2C slave on the I2C address, it will not ACK.
 
Having difficulty with an I2C module and looking for any insights.  Works fine with Arduino Mega2560 so i know hw is good.  Have tried on two WC32 w/ IO Exp boards.  Test code below.  Always branches to NO_DEV.  Without that simply "returns" 255.  Sensor is ATTiny 144 based and only operates in slave mode.  Appreciate any thoughts.
 
START    
    TSTEQ OP16 1  
    CALLSUB TST_16   
    END    
 
TST_16:
    
    I2CWRITE 1 0 32         #start to slave on 0x20
    BNZ NO_DEV        #check zbit
    I2CWRITE 0 0 5         #set to reg 0x05
    I2CWRITE 1 0 33         #rstrt - tell slave we will read
    I2CREAD 0 0 RAMB10     #read MSB
    I2CREAD 0 1 RAMB11     #read LSB - stop
    SET OP16 0  
    SET VAR1 RAMB10  
    SET VAR2 RAMB11  
    RET    

NO_DEV:
    I2CWRITE 1 1 32
    SET OP16 0
    PRINT1 "NO DEV"   
    RET    
 
 
So does the ATTiny device pull down SDA line to ack the write command or not?  When addressed with write to its I2C address, most slave should pull down SDA bus to ACK master.  If it always not detect that ACK, then there is something wrong.

https://my.st.com/public/STe2ecommunities/ImageLibrary/STM%20I2C/i2c_waveform_correct.jpg

 
Please see that picture showing the ACK
 
did not appear to be pulling SDA. However when I put it back on the Arduino to test it there i can no longer get it to work.  will troubleshoot the device.  thanks
 
Back
Top