Talking to PCA9450B PMIC via I2C from U-Boot

cancel
Showing results for 
Search instead for 
Did you mean: 

Talking to PCA9450B PMIC via I2C from U-Boot

897 Views
frank_vanhooft
Contributor III

Hello,

This sounds like a dumb question (to me...) but does anyone have a known-working example set of commands for an iMX8 Nano talking to a PCA9450B PMIC, via I2C?

I have 2 devices on I2C bus 0: the PMIC (at address 25) and an RTC chip (at address 51).

I can do:

u-boot=> i2c dev 0
Setting bus to 0
u-boot=> i2c probe
Valid chip addresses: 25 51

Looks great right? I can read and write the registers in the RTC chip using the i2c md and mw commands, no problem. It works great. But if I try to read the registers from the PMIC, I get junk:

u-boot=> i2c md 25 0 8
0000: 30 30 30 30 30 30 30 30 00000000

Seems so simple... I feel like I'm missing something obvious here. Any suggestions?

Thanks.

 

0 Kudos
4 Replies

841 Views
frank_vanhooft
Contributor III

Problem found. I'm posting here in case anyone else bumps across this.

The PCA9450B datasheet is very light when it comes to describing its I2C interface. Most I2C devices have fairly detailed information. By comparision the PCA9450B datasheet, section 8, simply states that it implements an I2C interface and provides a link to the official I2C bus specification. Hence some trial & error is necessary to determine what the PCA9450B supports and doesn't support.

In my case, it turns out the PCA9450B apparently does not support auto-increment when accessing its registers. Which is why the U-Boot command I listed did not work. The solution is very simple - only access a single register at a time. Then it works.

u-boot=> i2c md 25 0 1
0000: 30 0
u-boot=>
0001: c0 .
u-boot=>
0002: ff .
u-boot=>
0003: c0 .
u-boot=>
0004: 04 .
u-boot=>
0005: 80 .
u-boot=>

 

0 Kudos

867 Views
jimmychan
NXP TechSupport
NXP TechSupport

You may try to add the printf into the driver to see if it is really read/write the pmic register by this I2C command in u-boot.

https://source.codeaurora.org/external/imx/uboot-imx/tree/drivers/power/pmic/pca9450.c?h=imx_v2019.0...

0 Kudos

887 Views
frank_vanhooft
Contributor III

Very recent I believe.

U-Boot reports: U-Boot 2019.04-1f-5.4.y_v2019.04_var01

Linux reports: NXP i.MX Release Distro 5.4-zeus

0 Kudos

892 Views
jimmychan
NXP TechSupport
NXP TechSupport

Which version of BSP are you using?

0 Kudos