Nxp PCA9685 PWM LED controller register read write problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Nxp PCA9685 PWM LED controller register read write problem

1,271 Views
pylin
Contributor I

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);

LogicScreenCapture.png

Tags (1)
0 Kudos
3 Replies

1,200 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

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.

Dyn Char.JPG

2020-07-20_9-08-35.png

Hope it helps!

Best regards,

Tomas

0 Kudos

1,200 Views
pylin
Contributor I

Dear Tomas,

I have add 10ms between write and read functions. But the read back register data is still 0xff

Best regards,

Fiske Lin

0 Kudos

1,200 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

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

0 Kudos