本公司需要应用bq76PL455IC进行电池管理电压采集,在使用中根据bq76PL455A-Q1 Example Code 进行配置,单片机能与之通信,可以配置控制IO口,清除错语,测试均衡控制信号测试,都没有问题,但是一直无法采集到电压:
U16 nSent, nRead;// nTopFound = 0;
U16 nDev_ID;// nGrp_ID;
U8 cnt_test = 0;
U8 bFrame[132];
U16 crc;
U32 wTemp = 0;
WakeUp_PL455();
__delay_ms(10);
nSent = PL455_WriteReg(0, 107, 0x8000, 2, FRMWRT_ALL_NR); // clear all fault summary flags
nSent = PL455_WriteReg(0, 81, 0x38, 1, FRMWRT_ALL_NR); // clear fault flags in the system status register
nSent = PL455_WriteReg(0, 14, 0x19, 1, FRMWRT_ALL_NR); // set auto-address mode on all boards
nSent = PL455_WriteReg(0, 12, 0x08, 1, FRMWRT_ALL_NR); // enter auto address mode on all boards, the next write to this ID will be its address
for (nDev_ID = 0; nDev_ID < TOTALBOARDS; nDev_ID++)
{
nSent = PL455_WriteReg(nDev_ID, 10, nDev_ID, 1, FRMWRT_ALL_NR); // send address to each board
}
nSent = PL455_WriteReg(0, 16, 0x1080, 2, FRMWRT_SGL_NR);
// Clear all faults
nSent = PL455_WriteReg(0, 82, 0xffc0, 2, FRMWRT_SGL_NR); // clear all fault summary flags
nSent = PL455_WriteReg(0, 81, 0x38, 1, FRMWRT_SGL_NR); // clear fault flags in the system status register
////////////////////////////////////////////////////////////////////////////////////////////////
//nSent = PL455_WriteReg(0, 60, 0x00, 1, FRMWRT_SGL_NR);
nSent = PL455_WriteReg(0, 61, 0x00, 1, FRMWRT_SGL_NR); // set 0 initial delay
nDev_ID = 0;
nSent = PL455_WriteReg(nDev_ID, 62, 0xBC, 1, FRMWRT_SGL_NR); // set 99.92us ADC sampling period
nDev_ID = 0;
nSent = PL455_WriteReg(nDev_ID, 7, 0x00, 1, FRMWRT_SGL_NR); // set no oversampling period
nDev_ID = 0;
nSent = PL455_WriteReg(nDev_ID, 81, 0x38, 1, FRMWRT_SGL_NR); // clear fault flags in the system status register
nRead = PL455_ReadReg(nDev_ID, 81, &wTemp, 1, 4); // 0ms timeout
nSent = PL455_WriteReg(nDev_ID, 82, 0xFFC0, 2, FRMWRT_SGL_NR); // clear all fault summary flags
nRead = PL455_ReadReg(nDev_ID, 82, &wTemp, 1, 4); // 0ms timeout
nSent = PL455_WriteReg(0, 13, 0x08, 1, FRMWRT_SGL_NR); // set number of cells to 8
nSent = PL455_WriteReg(0, 3, 0x00FF03C0, 4, FRMWRT_SGL_NR); // select all cell channels 1-8, AUX channels 0 and 1, and internal digital die and internal analog die temperatures
nDev_ID = 0;
nSent = PL455_WriteReg(nDev_ID, 144, 0xD1EC, 2, FRMWRT_SGL_NR); // set OV threshold = 4.1000V
nSent = PL455_WriteReg(nDev_ID, 142, 0x6148, 2, FRMWRT_SGL_NR); // set UV threshold = 1.9000V
nSent = PL455_WriteReg(0, 144, 0xD1EC, 2, FRMWRT_ALL_NR); // set OV threshold = 4.1000V
nSent = PL455_WriteReg(0, 142, 0x6148, 2, FRMWRT_ALL_NR); // set UV threshold = 1.9000V
nSent = PL455_WriteReg(0, 2, 0x02, 1, FRMWRT_ALL_NR); // send sync sample command
nSent = PL455_WriteReg(0, 2, 0x00, 1, FRMWRT_ALL_NR); // send sync sample command
nSent = PL455_WriteReg(0, 13, 0x08, 1, FRMWRT_SGL_NR); // set number of cells to 8
nSent = PL455_WriteReg(0, 3, 0x00FF03C0, 4, FRMWRT_SGL_NR); // select all cell channels 1-8, AUX channels 0 and 1, and internal digital die and internal analog die temperatures
nDev_ID = 0;
nSent = PL455_WriteReg(nDev_ID, 2, 0x20, 1, FRMWRT_SGL_R); // send sync sample command //发送采样命令
nSent = WaitRespFrame(bFrame, 27, 4); // 24 bytes data + packet header + CRC, 0ms timeout //读取采集数据
while(1)
{////发送采集命令后在此查询接收到的数据(1)//接收断点1
PIN_LED = !PIN_LED;
__delay_ms(2000);
ClrWdt();
Uart_SendChar1(rx_buf,27); //打印接收到的数据
}
在接收断点1处,接收到来自于前端IC传过来的数据为:(8路节电池电压和四路AUX电压)
17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 87 7C 00 00 17 97
17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 86 eC 00 00 16 46
17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 86 f4 00 00 96 41
.......
//一直不明白为什么返回来的数据电压点都不对!电路板是官网的DEMO,只是控制端用单片机来处理。
由于项目紧急,只能在论坛上请求支持! 期待TI的技术支持能给以帮助!