(DS1307 RTC) I2C Not Working

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi All,

Am using CYBLE 012012-00

I have DS1307 Tiny RTC module which I2C based from which i want get data.

Below is code snippet of my code:-

while(I2CM_I2C_MSTR_NO_ERROR != I2CM_I2CMasterStatus())

    {

    I2CM_I2CMasterClearStatus();

    }

    while (I2CM_I2C_MSTR_NO_ERROR != I2CM_I2CMasterSendStart(0x68u, 0x00u)); 

    CyDelay(10);

    while (I2CM_I2C_MSTR_NO_ERROR != I2CM_I2CMasterWriteByte(0x00u)); 

    CyDelay(10);

    while (I2CM_I2C_MSTR_NO_ERROR != I2CM_I2CMasterSendRestart(0x68u, 0x1u));

    CyDelay(10);

    d1 = I2CM_I2CMasterReadByte(I2CM_I2C_ACK_DATA);

    d2 = I2CM_I2CMasterReadByte(I2CM_I2C_ACK_DATA);

    d3 = I2CM_I2CMasterReadByte(I2CM_I2C_ACK_DATA);

    d4 = I2CM_I2CMasterReadByte(I2CM_I2C_ACK_DATA);

    d5 = I2CM_I2CMasterReadByte(I2CM_I2C_ACK_DATA);

    d6 = I2CM_I2CMasterReadByte(I2CM_I2C_ACK_DATA);

    d7 = I2CM_I2CMasterReadByte(I2CM_I2C_ACK_DATA);

    d8 = I2CM_I2CMasterReadByte(I2CM_I2C_NAK_DATA);

    I2CM_I2CMasterSendStop();

i am not able to go forward beyond below line:-

while (I2CM_I2C_MSTR_NO_ERROR != I2CM_I2CMasterSendStart(0x68u, 0x00u)); 

not sure what to do?

i am using PSOC 4 creator

I have connected pins as below:-

RTC---proc side

vcc--3.3v

gnd--gnd

scl-scl(P3[5])

sda-sda(P3[4])

have anyone configured this before please help me out

Thanks

0 Likes
6 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Try with I2C address 0x34. The compponent adds the R/W bit itself.

Bob

0 Likes
Anonymous
Not applicable

Hi Bob,

I tried all combinations like (0x68,0x68u,104,0x32,0x32u,52) as a slave address

and for write bit (I2CM_I2C_WRITE_XFER_MODE,0,0x0,0x0u)

but it wont go past

while (I2CM_I2C_MSTR_NO_ERROR != I2CM_I2CMasterSendStart(104, 0));

any idea?

0 Likes

0x34 is not in your list. How many ohms are your pull-up resistors?

Bob

Anonymous
Not applicable

Hi bob

Actually its 0×34 by mistake i written 0×32 here in post.

Have used tiny rtc ds1307 module who's schematics shows 3.3k pull-up resistor

0 Likes

Last chance: Use a logic analyzer or a scope to check the signals. When the start command fails something with the signals is wrong.

Just came to my mind: could it be you forgot the I2C_Start() command?

Bob

0 Likes
Anonymous
Not applicable

I2C_start() function is already called.

Yes i have to probe the signals.

Thanks for the help.

0 Likes