bq27520 STM32L433 iic读取失败
1.电路设计部分
2.程序读取
参考sluua35.pdf文档,读取器件类型
Example using DEVICE_ TYPE subcommand:
●To device address 0xAA, starting at command 0x00, write two bytes of data: 0x01 and 0x00.
●Then read the response using an incremental read. To device address 0xAB, starting at command
0x00, read two bytes.
读取代码
void bq27520 read type (u8 * buf)
{
u8 temp;
IIC Start() ;
IIC Send Byte (0xAA) ;
IIC wait Ack() ;
IIC Send Byte (0x00) ;
IIC Wait Ack() ;
IIC Send Byte (0x01) ;
IIC wait Ack() ;
IIC Send Byte (0x00) ;
IIC Wait Ack() ;
IIC stop() ;
HAL Delay(2) ;
IIC start() ;
IIC_ Send Byte (0xAA) ;
IIC Wait Ack() ;
IIC Send Byte (0x00) ;
IIC Wait Ack() ;
IIC start() ;
IIC Send Byte (0xAB) ;
IIC wait Ack() ;
buf[0]=IIC Read Byte(1) ;
buf[1]=IIC Read Byte(0) ;
IIC stop() ;
}
3.逻辑分析仪抓取波形