Dear Roland,
We want to use PCA9685 to generate PWM signal for control. The PCA9685 is driven by a Renessas MCU. We try to write/read the MODE1 register by using following driver code. However, we find that the read register always return 0xFF. Below is screen capture and attached please find the logic analyzer data. Please comment.
PCA9685_write_byte(PCA9685_MODE1_REG, 0x01);
MSB = PCA9685_read_byte(PCA9685_MODE1_REG);
Hi Lin,
Please try to add some delay between your write and read functions. As you can see in Table 15 of the datasheet, the Tbuf time is min. 4.7 us in the Standard mode, while in your case it seems to be 2.5 us only.
Hope it helps!
Best regards,
Tomas
Dear Tomas,
I have add 10ms between write and read functions. But the read back register data is still 0xff
Best regards,
Fiske Lin
Dear Lin,
Looking once again at your captured I2C traffic, it appears that your PCA9685_read_byte() function requires some modification. The first two bytes are correct, but they need to be followed by a repeated start condition (which is not visible in the captured data) and the I2C address again with the R/W bit high (0xF9).
So you should see:
Setup Write to [0xF8] + ACK
0x00 + ACK
Setup Read to [0xF9] + ACK
0x01 + NAK
Best regards,
Tomas