BQ35100: Flash stream file parsing fails on a comapare, resulting in bricked bq35100 chip Part Number: BQ35100 Hello, We have implemented flash stream parser based on the code described in slua801. we tested the parser and it parses the flash stream file as per specifications (flash stream specification file attached1856.Flash Stream File Format.pdf). During our tests with the bq35100 device we found that firmware revision that was read and compared against a known value was failing. When using bqstudio reading of ID and version was working correctly. In order to do the same with flash streamer file to read id and fimware version, we had to add 100ms delay after i2cwrite command (see below routine). char *BQ35100_execute_fs(char *pFS) { int nLength = strlen(pFS); int nDataLength; char pBuf[16]; char pData[32]; int n, m; char *pEnd = NULL; char *pErr; bool bWriteCmd = false; bool bReadCmd = false; bool bCompareCmd = false; unsigned char nRegister; m = 0; for (n = 0; n < nLength; n++) if (pFS[n] != ' ') pFS[m++] = pFS[n]; pEnd = pFS + m; pEnd[0] = 0; do { switch (*pFS) { case ';': break; case 'W': case 'C': case 'R': bWriteCmd = *pFS == 'W'; bReadCmd = *pFS == 'R'; bCompareCmd = *pFS == 'C'; pFS++; if ((*pFS) != ':') goto exit_parse; pFS++; n = 0; while ((pEnd - pFS > 2) && (n < sizeof(pData) + 2) &&(*pFS != '\n')) { pBuf[0] = *(pFS++); pBuf[1] = *(pFS++); pBuf[2] = 0; m = strtoul(pBuf, &pErr, 16); if (*pErr) return (pFS - 2); if (n == 0) deviceAddress = m; if (n == 1) nRegister = m; if (n > 1) pData[n - 2] = m; n++; } if (n < 3) goto exit_parse; nDataLength = n - 2; if (bWriteCmd) { BQ35100_dump_data("Write", nRegister, pData, nDataLength); i2cWriteBytes(nRegister, (uint8_t *)pData, nDataLength); /* Adding a delay giving bq35100 device sometime to put register value on I2C bus before we read it. */ DelayMs(100); } if (bCompareCmd || bReadCmd) { char pDataFromGauge[nDataLength]; i2cReadBytes(nRegister, (uint8_t *)pDataFromGauge, nDataLength); if (bCompareCmd) { BQ35100_dump_data("Read", nRegister, pDataFromGauge, nDataLength); BQ35100_dump_data("Compare", nRegister, pData, nDataLength); if (memcmp(pData, pDataFromGauge, nDataLength)) { DEBUG_PRINTF("%s: Memory comparison action failed, exiting...\r\n", __func__); goto exit_parse; } } else BQ35100_dump_data("Read", nRegister, pDataFromGauge, nDataLength); } break; case 'X': pFS++; if ((*pFS) != ':') goto exit_parse; pFS++; n = 0; while ((pFS != pEnd) && (*pFS != '\n') &&(n