Nxp PCA9685 PWM LED controller register read write problem

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Nxp PCA9685 PWM LED controller register read write problem

1,609件の閲覧回数
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

タグ(1)
0 件の賞賛
返信
3 返答(返信)

1,538件の閲覧回数
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 件の賞賛
返信

1,538件の閲覧回数
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 件の賞賛
返信

1,538件の閲覧回数
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 件の賞賛
返信