Tool/software:
We use an S32K1 MCU to communicate with the BQ76952 over SPI (with CRC). Sometime when we transmit a command, the BQ76952 merely echoes the command back. This causes issues because it gets interpreted as real data (address matches and CRC is valid). As an example, here's the sequence we follow to read a sub-command with data:
- Write sub-command LSB ID to 0x3E
- Write sub-command MSB ID to 0x3F
- Wait for the 'operation time' period as defined in Table 9-2 in the TRM
- Read the length of the response form 0x61
- Read the data from 0x40 for the expected length
- Read the checksum from 0x60
Now, this process randomly fails at step 4 because the BQ76952 echoes the command back and we receive the wrong data length as a result i.e.
MOSI: 61 FF 13, MISO: 61 FF 13
As the received address (61) is what we're expecting and the CRC is valid, it is not possible for the MCU to know this is not 'real' data. I understand the BQ76952 may not be 'ready' but in that case it should respond with FF FF 00.
Are you able to provide any insight to help me understand what is happening? Is there anything we can do to resolve this apart from adding an unnecessarily long delay for step 3?
Thank you.