Dear all,
I have a daisy chain setup with currently testing 3 BQ chips (our battery pack features 10, but first try it simple). I initialized the registers using the software reference manual (slva617a.pdf). I included the code below. Be careful: I have a very ugly implementation for broadcast messages: since these messages lack an ADDRESS field, the REGISTER field is in the ADDRESS field, and the REGISTER field is in the ADDRESS field (in my included code). The datalength field specifies the number of bytes. If set to 0, no databytes are transmitted.
The code currently works untill the following moment: autoaddressing works fine! All the connected boards respond their address (with different amount of BQ chips tested, even with the full 10). Then, starting from 'step10', the measurement settings are send to the boards (still following the software reference manual).
The problem starts here: with either 1, 2 or 3 boards connected (address 0, 1 and 2), the SYNCHRONOUSLY SAMPLE CHANNELS command (chapter 3.2 in the software reference manual) only returns the data from the first board in the network (address 0). Sending the SYNC SAMPLE message, followed by a specific read message (askBoardx), does not work as expected either. No response is send from any board in the chain. Weirdly, repeating the SYNC SAMPLE with aksBoardx 5 times, suddenly data is reported from board number 0. Even if I ask data from board 2, board 0 replies after 5 transmits. I included the data asking messages below.
This leads me to believe that I did something wrong setting the registers from the BQ chips. I tried different settings, but to no success. I hope somebody has either experienced similar problems and solved them, or is willing to take a look at the settings I configured and detecting a mistake.
Thanks very very very much in advance.
//----------------------asking for data messages--------------------------------------------
UARTsendMessage synchroSampleChannels;
askData.bit.TYPE = 0xE1;
askData.bit.ADDRESS = 0x02; //register field, since this is a broadcast command
askData.bit.REGISTER = 0x02; //measure all cells and all AUX connectors, since this is a broadcast command
uint64_t message0 = 0x99; //datalength is set to 0, so this byte is not send
askData.bit.DATA = &message0;
askData.bit.datalength = 0;
UARTsendMessage syncSample;
askData.bit.TYPE = 0xF1;
askData.bit.ADDRESS = 0x02; //register field, since this is a broadcast command
askData.bit.REGISTER = 0x00; //first part of data, since this is a broadcast command
uint64_t message1 = 0x99; //datalength is set to 0, so this byte is not send
askData.bit.DATA = &message1;
askData.bit.datalength = 0;
UARTsendMessage askBoard2;
askData.bit.TYPE = 0x81;
askData.bit.ADDRESS = 0x02;
askData.bit.REGISTER = 0x02;
uint64_t message2 = 0x20; //measure all cells and all AUX connectors
askData.bit.DATA = &message2;
askData.bit.datalength = 1;