TI中文支持网
TI专业的中文技术问题搜集分享网站

bq40z50 下读取Chemical ID写了个测试函,数,用的是block操作,但是操作时返回值都是-ENXIO

我照着bq40z50手册,下面内容,写了个测试函数,用的是block操作,但是操作时返回值都是-ENXIO,(No such device or address)

Example: Read Chemical ID() (0x0006) via ManufacturerBlockAccess()

1. Send Chemical ID() to ManufacturerBlockAccess().

(a) SMBus block write. Command = 0x44. Data sent = 06 00 (data must be sent in Little Endian)

2. Read the result from ManufacturerBlockAccess().

(a) SMBus block read. Command = 0x44. Data read = 06 00 00 01 (each data entity is returned in

Little Endian).

(b) The first 2 bytes, “06 00”, is the MAC command.

(c) The second 2 bytes, “00 01”, is the chem ID returning in Little Endian. That is 0x0100, chem ID

100

 

设备树配置:

&i2c1 {

        status = "ok"; 

        bq40z50: bq40z50@16{

                 compatible = "bq40z50";

                 reg = <0x16>;

        };

 

测试代码:

#define BQ40Z50_BLKWR_CMD             0x44

#define BQ40Z50_BLKRD_CMD              0x44

u8 value_id[2]={0x06,0x0};

u8 value_rd[4]={0x00,0x00,0x00,0x00};

 

i2c_smbus_write_block_data(drvdata->client, BQ40Z50_BLKWR_CMD, 2, value_id);

msleep( 1 );    

i2c_smbus_read_block_data(drvdata->client, BQ40Z50_BLKRD_CMD, value_rd);      

msleep( 1 );

Star Xu:

Can you turn on PEC and send a reset command (0x41) to get the change updated in RAM then repeat the commands you sent above. Then turn off PEC, send the reset command and repeat the commands so we see how they differ?

donric xu:

回复 Star Xu:

How toturn on PEC

Star Xu:

回复 donric xu:

TRM 14.2.1.3 SBS Configuration

赞(0)
未经允许不得转载:TI中文支持网 » bq40z50 下读取Chemical ID写了个测试函,数,用的是block操作,但是操作时返回值都是-ENXIO
分享到: 更多 (0)