PCF8563 RTC gives i2c Fail

cancel
Showing results for 
Search instead for 
Did you mean: 

PCF8563 RTC gives i2c Fail

Jump to solution
68 Views
AL_AM
Contributor I

Hello, I'm using a custom board that contains 5 i2c sensors. The i2c Bus works fine. the pull-up resistors are included and when I use the I2C tool to detect the i2c connected sensors I get the following:

AL_AM_0-1613341967019.png

 

 

The above image shows that the RTC has the address 0x00 while in the datasheet of the PCF8563 it has 2 addresses depends on the read-write operation.

AL_AM_1-1613341967034.png

 

Does this mean that the RTC is not working

 

the address 0x00 is the only unknown address for me.

 

if it is working then, when I tried to follow the  User-guide_UM10301 exactly on page 27 where there is an example of how to set the PCF8563:

AL_AM_2-1613341967035.png

 

I always get an error in the i2c. my code is as follows:

(I use the ESP32 with the esspressif-idf )

AL_AM_3-1613341967037.png

        i2c_master_start(CMD);
        i2c_master_write_byte(CMD, RTC_Write_Add, Want_Ack);
        i2c_master_write_byte(CMD, control_status_1, Want_Ack);
        i2c_master_write_byte(CMD, 0x00, Want_Ack);
        i2c_master_write_byte(CMD, 0x00, Want_Ack);
        i2c_master_write_byte(CMD, VL_secondsReg, Want_Ack);
        i2c_master_write_byte(CMD, 0x00, Want_Ack);        // Vl Sec 00
        i2c_master_write_byte(CMD, 0x45, Want_Ack);        // Min 45
        i2c_master_write_byte(CMD, 0x19, Want_Ack);        // Hou 7 PM
        i2c_master_write_byte(CMD, 0x12, Want_Ack);        // Days 12
        i2c_master_write_byte(CMD, 0x05, Want_Ack);        // Fri
        i2c_master_write_byte(CMD, 0x82, Want_Ack);        // set month 
        i2c_master_write_byte(CMD, 0x21, Want_Ack);        // 2021
        i2c_master_stop(CMD);
        ESP_ERROR_CHECK(i2c_master_cmd_begin(I2C_NUM_0, CMD, 1000 / portTICK_RATE_MS));

Summarizing my questions:

 

1- The appearance of the address 0x00 (which is the Control_status_1 Register) as the chip address is ok

2- if it's ok, then what could be my issue

 

 

 

0 Kudos
1 Solution
48 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hello Amir,

The 7-bit slave address of the PCF8563 is 0x51 followed by a write (0) or read (1) bit. This results in 0xA2 for a write as shown in the datasheet.

The second byte is the address of the register you want to write to. In your case Control_status_1 (0x00).

The third byte is the data you want to write to the register. In your case 0x00.

Then you can either send a stop condition or continue sending next bytes as the PCF8563 support auto incrementing of the register address.

Capture.JPG

It might be useful to use a logic analyzer or an oscilloscope to check what is going on the bus.

Best regards,

Tomas

 

View solution in original post

2 Replies
30 Views
AL_AM
Contributor I

Thank you Tomas......I found out that the 0x00 that I get on the bus is the ESP Address. while the RTC was missing on the board that I was using. i asked for a replacement.

0 Kudos
49 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hello Amir,

The 7-bit slave address of the PCF8563 is 0x51 followed by a write (0) or read (1) bit. This results in 0xA2 for a write as shown in the datasheet.

The second byte is the address of the register you want to write to. In your case Control_status_1 (0x00).

The third byte is the data you want to write to the register. In your case 0x00.

Then you can either send a stop condition or continue sending next bytes as the PCF8563 support auto incrementing of the register address.

Capture.JPG

It might be useful to use a logic analyzer or an oscilloscope to check what is going on the bus.

Best regards,

Tomas

 

View solution in original post