TCA8424问题
时间:10-02
整理:3721RD
点击:
TCA8424上电后,中断引脚一直是低电平,按照手册应该是要先复位。但是我写reset命令后发现仍然是低电平,不知道是不是我写16位寄存器的方法有问题:
u8 au8Buf[3] = {0}; au8Buf[0] = reg >> 8; au8Buf[1] = reg & 0xff; au8Buf[2] = val; if (i2c_master_send(keypad_data->client, au8Buf, 3) < 0) { pr_err("%s:write reg error:reg=%x,val=%x\n", __func__, reg, val); return -1; }
另外我发现HID descriptor和Report Descriptor的寄存器,可以读,但是写不进去,这些都是只读的吗?
中断引脚INT有没有通过上拉电阻到Vcc?
有,10K电阻拉到3.2V
我按照 slave ACK reg高八位 reg 低八位 数据 这样写i2c总是不能复位成功。
[ 309.034732] i2c i2c-2: master_xfer[0] W, addr=0x3b, len=3 [ 309.044593] i2c i2c-2: <i2c_imx_xfer> [ 309.048306] i2c i2c-2: <i2c_imx_start> [ 309.052137] i2c i2c-2: <i2c_imx_bus_busy> [ 309.056161] i2c i2c-2: <i2c_imx_xfer> transfer message: 0 [ 309.061580] i2c i2c-2: <i2c_imx_xfer> CONTROL: IEN=1, IIEN=1, MSTA=1, MTX=1, TXAK=1, RSTA=0 [ 309.069948] i2c i2c-2: <i2c_imx_xfer> STATUS: ICF=1, IAAS=0, IBB=1, IAL=0, SRW=0, IIF=0, RXAK=1 [ 309.078659] i2c i2c-2: <i2c_imx_write> write slave address: addr=0x76 [ 309.085381] i2c i2c-2: <i2c_imx_trx_complete> TRX complete [ 309.090878] i2c i2c-2: <i2c_imx_acked> ACK received [ 309.095765] i2c i2c-2: <i2c_imx_write> write data [ 309.100478] i2c i2c-2: <i2c_imx_write> write byte: B0=0x6 [ 309.106147] i2c i2c-2: <i2c_imx_trx_complete> TRX complete [ 309.111642] i2c i2c-2: <i2c_imx_acked> ACK received [ 309.116529] i2c i2c-2: <i2c_imx_write> write byte: B1=0x0 [ 309.122195] i2c i2c-2: <i2c_imx_trx_complete> TRX complete [ 309.127690] i2c i2c-2: <i2c_imx_acked> ACK received [ 309.132576] i2c i2c-2: <i2c_imx_write> write byte: B2=0x1 [ 309.138243] i2c i2c-2: <i2c_imx_trx_complete> TRX complete [ 309.143738] i2c i2c-2: <i2c_imx_acked> ACK received [ 309.148624] i2c i2c-2: <i2c_imx_stop> [ 309.152293] i2c i2c-2: <i2c_imx_bus_busy> [ 309.156312] i2c i2c-2: <i2c_imx_xfer> exit with: success msg: 1
请问这里我到底应该怎么读写i2c呢?