File size: 8,204 Bytes
b24351f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
  "ticketNumber" : "892440",
  "reporterName" : "Maulin Lodhia",
  "rankPoints" : "380",
  "resolutionStatus" : "TI Thinks Resolved",
  "ticketName" : "BQ35100: Flash stream file parsing fails on a comapare, resulting in bricked bq35100 chip",
  "rankName" : "Intellectual",
  "replies" : " 6",
  "views" : " 55",
  "queryText" : "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)\n{\n\tint nLength = strlen(pFS);\n\tint nDataLength;\n\tchar pBuf[16];\n\tchar pData[32];\n\tint n, m;\n\tchar *pEnd = NULL;\n\tchar *pErr;\n\tbool bWriteCmd = false;\n\tbool bReadCmd = false;\n\tbool bCompareCmd = false;\n\tunsigned char nRegister;\n\n\tm = 0;\n\tfor (n = 0; n < nLength; n++)\n\t\tif (pFS[n] != ' ') pFS[m++] = pFS[n];\n\tpEnd = pFS + m;\n\tpEnd[0] = 0;\n\n\tdo\n\t{\n\t\tswitch (*pFS)\n\t\t{\n\t\t\tcase ';':\n\t\t\t\tbreak;\n\t\t\tcase 'W':\n\t\t\tcase 'C':\n\t\t\tcase 'R':\n\t\t\t\tbWriteCmd = *pFS == 'W';\n\t\t\t\tbReadCmd = *pFS == 'R';\n\t\t\t\tbCompareCmd = *pFS == 'C';\n\t\t\t\tpFS++;\n\t\t\t\tif ((*pFS) != ':') goto exit_parse;\n\t\t\t\tpFS++;\n\t\t\t\tn = 0;\n\t\t\t\twhile ((pEnd - pFS > 2) && (n < sizeof(pData) + 2) &&(*pFS != '\\n'))\n\t\t\t\t{\n\t\t\t\t\tpBuf[0] = *(pFS++);\n\t\t\t\t\tpBuf[1] = *(pFS++);\n\t\t\t\t\tpBuf[2] = 0;\n\t\t\t\t\tm = strtoul(pBuf, &pErr, 16);\n\t\t\t\t\tif (*pErr) return (pFS - 2);\n\t\t\t\t\tif (n == 0)  deviceAddress = m;\n\t\t\t\t\tif (n == 1) nRegister = m;\n\t\t\t\t\tif (n > 1) pData[n - 2] = m;\n\t\t\t\t\tn++;\n\t\t\t\t}\n\t\t\t\tif (n < 3) goto exit_parse;\n\t\t\t\tnDataLength = n - 2;\n\t\t\t\tif (bWriteCmd)\n\t\t\t\t{\n\t\t\t\t\tBQ35100_dump_data(\"Write\", nRegister, pData, nDataLength);\n\t\t\t\t\ti2cWriteBytes(nRegister, (uint8_t *)pData, nDataLength);\n\t\t\t\t\t/* Adding a delay giving bq35100 device sometime to put register value on I2C bus before we read it. */\n\t\t\t\t\tDelayMs(100);\n\t\t\t\t}\n\n\t\t\t\tif (bCompareCmd || bReadCmd)\n\t\t\t\t{\n\t\t\t\t\tchar pDataFromGauge[nDataLength];\n\t\t\t\t\ti2cReadBytes(nRegister, (uint8_t *)pDataFromGauge, nDataLength);\n\t\t\t\t\tif (bCompareCmd)\n\t\t\t\t\t{\n\t\t\t\t\t\tBQ35100_dump_data(\"Read\", nRegister, pDataFromGauge, nDataLength);\n\t\t\t\t\t\tBQ35100_dump_data(\"Compare\", nRegister, pData, nDataLength);\n\t\t\t\t\t\tif (memcmp(pData, pDataFromGauge, nDataLength))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tDEBUG_PRINTF(\"%s: Memory comparison action failed, exiting...\\r\\n\", __func__);\n\t\t\t\t\t\t\tgoto exit_parse;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\tBQ35100_dump_data(\"Read\", nRegister, pDataFromGauge, nDataLength);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'X':\n\t\t\t\tpFS++;\n\t\t\t\tif ((*pFS) != ':') goto exit_parse;\n\t\t\t\tpFS++;\n\t\t\t\tn = 0;\n\t\t\t\twhile ((pFS != pEnd) && (*pFS != '\\n') &&(n <sizeof(pBuf) - 1))\n\t\t\t\t{\n\t\t\t\t\tpBuf[n++] = *pFS;\n\t\t\t\t\tpFS++;\n\t\t\t\t}\n\t\t\t\tpBuf[n] = 0;\n\t\t\t\tn = atoi(pBuf);\n\t\t\t\tDEBUG_PRINTF(\"%s: Delaying %u ms\\r\\n\",__func__, n);\n\t\t\t\tDelayMs(n);\n\t\t\t\tbreak;\n\t\t\tdefault: goto exit_parse;\n\t\t}\n\t\twhile ((pFS != pEnd) && (*pFS != '\\n')) pFS++; //skip to next line\n\t\tif (pFS != pEnd) pFS++;\n\n\t} while (pFS != pEnd);\n\nexit_parse:\n\tdeviceAddress = BQ35100_I2C_ADDRESS;\n\treturn pFS;\n}\n Now when we tried to use overall configuration flash streamer (see attached files), the parsing failed at compare after X: 2ms, We tried increasing the delay to 200 ms from 2 ms. This time it went further in flash stream file but failed at a different point in compare command ;-------------------------------------------------------- ;Data Block ;-------------------------------------------------------- W: 16 00 03 00 00 W: 16 64 03 00 X: 200 C: 16 66 00 W: 16 00 02 00 00 00 E2 FF 33 03 D7 33 BB D6 33 E0 D6 33 09 D6 33 FF FF 3F 00 01 00 FF FF 3F FF FF 3F FF FF 3F FF FF 3F FF FF 3F FF FF 3F FF FF 3F FF FF 3F FF FF 3F FF FF 3F FF FF 3F 03 01 3D 00 01 3D 02 01 3D 0A 00 3D 0A 00 3D 80 03 3D 00 00 3D 00 00 3D 35 80 3D 11 02 3D 49 00 3D 20 2A 0E DF FA 0E E2 FF 32 W: 16 64 60 2B X: 200 C: 16 66 00 W: 16 00 02 01 00 00 FF AA 0E FB A7 0E FF A6 0E F5 ED 3A 06 D7 3A FF 1C 0E C7 FF 36 FF A1 0E FF A0 0E FD A3 0E F2 A2 0E C2 FF 3A FF A1 0E 7F A0 0E FF A3 0E 7F A2 0E BC A5 0E FF A4 0E BB FF 3A FD A1 0E F2 A0 0E FD A3 0E F2 A2 0E BB FF 3A 07 D7 3A 9E FF 3A E2 FF 33 FF AF 0E 01 4F 03 3F 11 0C BF FF 32 2F 10 0C W: 16 64 22 31 X: 200 At this point the parser exited and any subsequent attempts to access the chip failed. Note that the delay command were 2ms originally and we changed it to 200ms thinking additional delay would help. We have now bricked ~3 chips this way. We need help to get this flash streamer mechanism in order to calibrate and configure bq35100 device in factory. Thank you in advance. Regards, Maulin Lodhia Flash stream files used for the test flash_stream_files.7z",
  "partNumber" : " BQ35100",
  "allResponseList" : [ {
    "contentId" : "3301310",
    "userName" : "Andy Liu (BMS)",
    "rankPoints" : "42410",
    "rankName" : "Mastermind",
    "date" : "Mar 30, 2020 9:42 PM",
    "userId" : "1864278",
    "content" : "Hi Maulin, We will check your df.fs file and get back to you. Regarding the bricked devices, I would suggest you use the bqStudio and program the default srec file to them. Andy"
  }, {
    "contentId" : "3305165",
    "userName" : "Maulin Lodhia",
    "rankPoints" : "380",
    "rankName" : "Intellectual",
    "date" : "Apr 2, 2020 4:42 PM",
    "userId" : "594282",
    "content" : "Thank you Andy, Any update on this ? Maulin"
  }, {
    "contentId" : "3305540",
    "userName" : "Andy Liu (BMS)",
    "rankPoints" : "42410",
    "rankName" : "Mastermind",
    "date" : "Apr 2, 2020 11:37 PM",
    "userId" : "1864278",
    "content" : "I have been a bit busy this week. I would need some time to prepare some C code to verify your flash stream file. I think I should be able to provide my results early next week. Andy"
  }, {
    "contentId" : "3319570",
    "userName" : "Maulin Lodhia",
    "rankPoints" : "380",
    "rankName" : "Intellectual",
    "date" : "Apr 17, 2020 2:51 PM",
    "userId" : "594282",
    "content" : "Hello Andy, Any update on the flash stream file verification on BQ35100 ? Thanks Maulin"
  }, {
    "contentId" : "3327735",
    "userName" : "Eric Vos24",
    "rankPoints" : "3585",
    "rankName" : "Expert",
    "date" : "Apr 25, 2020 2:38 AM",
    "userId" : "3440231",
    "content" : "Maulin, Unfortunately i am not a software coder so i cannot comment on your code provided. Are you able to attached a Saleae or I2C sniffer on your line when using bqStudio vs your own method to check for differences? This is what i would recommend you do do next. Thanks, Eric Vos"
  }, {
    "contentId" : "3329548",
    "userName" : "Rob Sizeland",
    "rankPoints" : "20",
    "rankName" : "Prodigy",
    "date" : "Apr 27, 2020 9:56 PM",
    "userId" : "4209741",
    "content" : "Hi there, I've attached the flash instruction file BQ studio produces, as well as an i2c capture from when BQ studio does the same operation. I notice the delays that BQ studio are larger than the ones specified in the flash instruction file. Also, long writes are split up into multiple smaller writes. Are these differences important? Also, do you see anything else? Thanks, Rob. Battery-Cal.zip"
  } ],
  "tags" : [ "/support/power-management/f/196/tags/BQ35100", "/support/power-management/f/196/tags/_2300_%2b%2b%2b%2b%2b%2b%2b%2bBQ35100", "/support/power-management/f/196/tags/_2300_%2b%2b%2b%2b%2b%2b%2bBQstudio", "/support/power-management/f/196/tags/bqStudio" ],
  "fourmType" : "TI"
}