主题中讨论的其他器件: USB2ANY
工具与软件:
尊敬的团队:
我想通过 BQ79600实现反向寻址。 参考本示例、我无法正确收集数据。 示例如下:
我的系统是1个 MCU 加1个 BQ79600加4个 BQ79616
我的说明如下
SpiWake79600(); //wake up BQ79600 delay_us(500); delay_ms(3); SpiWriteReg(NULL_BQ, CONTROL1, 0x20, Length_1, FRMWRT_SGL_W); //wake BQ79616 delay_ms(80); SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN1, DummyValue, Length_1, FRMWRT_STK_W); SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN2, DummyValue, Length_1, FRMWRT_STK_W); SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN3, DummyValue, Length_1, FRMWRT_STK_W); SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN4, DummyValue, Length_1, FRMWRT_STK_W); SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN5, DummyValue, Length_1, FRMWRT_STK_W); SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN6, DummyValue, Length_1, FRMWRT_STK_W); SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN7, DummyValue, Length_1, FRMWRT_STK_W); SpiWriteReg(NULL_BQ, OTP_ECC_DATAIN8, DummyValue, Length_1, FRMWRT_STK_W); SpiWriteReg(NULL_BQ, CONTROL1, 0x80, Length_1, FRMWRT_REV_ALL_W); //brdcast Write 0x02 to address 0x308(1) SpiWriteReg(NULL_BQ, COMM_CTRL, 0x02, Length_1, FRMWRT_ALL_W); //brdcast Write 0x81 to address 0x309 (enable BQ7961X-Q1 auto addressing) SpiWriteReg(NULL_BQ, CONTROL1, 0x81, Length_1, FRMWRT_ALL_W); //SET ADDRESSES FOR EVERY BOARD for(currentBoard1=0; currentBoard1<5; currentBoard1++) { SpiWriteReg(NULL_BQ, DIR1_ADDR, currentBoard1, Length_1, FRMWRT_ALL_W); } //BROADCAST WRITE TO SET ALL DEVICES AS STACK DEVICE SpiWriteReg(NULL_BQ, COMM_CTRL, SetStarkDevice, Length_1, FRMWRT_ALL_W); //set base device as base SpiWriteReg(NULL_BQ, COMM_CTRL, 0x00, Length_1, FRMWRT_SGL_W); //SET THE HIGHEST DEVICE IN THE STACK AS BOTH STACK AND TOP OF STACK SpiWriteReg(0x04, COMM_CTRL, SetTopDevice, Length_1, FRMWRT_SGL_W); //SYNCRHONIZE THE DLL WITH A THROW-AWAY READ SpiReadReg(NULL_BQ, OTP_ECC_DATAIN1, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R); SpiReadReg(NULL_BQ, OTP_ECC_DATAIN2, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R); SpiReadReg(NULL_BQ, OTP_ECC_DATAIN3, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R); SpiReadReg(NULL_BQ, OTP_ECC_DATAIN4, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R); SpiReadReg(NULL_BQ, OTP_ECC_DATAIN5, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R); SpiReadReg(NULL_BQ, OTP_ECC_DATAIN6, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R); SpiReadReg(NULL_BQ, OTP_ECC_DATAIN7, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R); SpiReadReg(NULL_BQ, OTP_ECC_DATAIN8, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_STK_R); for(currentBoard1=0; currentBoard1<5; currentBoard1++) { SpiReadReg(currentBoard1, DIR1_ADDR, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_SGL_R); } //OPTIONAL: read register address 0x2001 and verify that the value is 0x14 SpiReadReg(NULL_BQ, Bridge_DEV_CONF1, autoaddr_response_frame, Length_1, NULL_BQ, FRMWRT_SGL_R);
无法正常收集数据。 请帮助我找出问题所在。