AppTaskCan.c 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191
  1. /*
  2. * @Author: chenjie
  3. * @Date: 2022-10-27
  4. * @LastEditTime: 2022-11-10
  5. * @LastEditors: chenjie
  6. * @Description:
  7. * @FilePath: \S32K146_4G\code\app\AppTaskCan.c
  8. * Copyright (c) 2022 by chenjie, All Rights Reserved.
  9. */
  10. #include "AppTaskCan.h"
  11. #include "AppFuncLib.h"
  12. #ifdef APP_CAN_ENABLE
  13. static uint8 BattSendFlg = 0;
  14. static void UDSAnsFunc(uint8 *rawData);
  15. static void UdsAns(bool PosFlg, uint8 UdsService, uint8 UdsSubService, uint8 Idx, uint8 *AnsData, uint8 AnsDataLen);
  16. static void BattSendFunc(void);
  17. void CanTask(void *pvParameters)
  18. {
  19. uint32 timerCANIdle = 0x00;
  20. uint32 timerCounterNow = 0;
  21. (void)pvParameters;
  22. CanIf_bRxFlag = false;
  23. Can_Msg_Type_Data CanRxMsg;
  24. CanRecvQueueHandle1 = xQueueCreate(100, sizeof(Can_Msg_Type_Data));
  25. BaseType_t ret = pdFALSE;
  26. GsensorInit();
  27. while (1)
  28. {
  29. Can_MainFunction_Read();
  30. do
  31. {
  32. memset(&CanRxMsg, 0, sizeof(CanRxMsg));
  33. ret = xQueueReceive(CanRecvQueueHandle1, &CanRxMsg, 1);
  34. if (ret == pdPASS)
  35. {
  36. timerCANIdle = 0x00;
  37. if (IsJumptoBootloader(CanRxMsg.id, CanRxMsg.data))
  38. {
  39. DoRoutinePositiveAnswer();
  40. RequestEnterBootloader();
  41. SystemSoftwareReset();
  42. break;
  43. }
  44. else
  45. {
  46. BcuDecodeFunction(CanRxMsg.id, CanRxMsg.data); // can协议解析
  47. }
  48. }
  49. if (timerCANIdle > 20000)
  50. {
  51. timerCANIdle = 0;
  52. xSemaphoreGive(sleep_mutex);
  53. }
  54. } while (ret == pdPASS);
  55. if ((TimerCounter - timerCounterNow) >= 100)
  56. {
  57. timerCANIdle = timerCANIdle + 100;
  58. BcuRxDiagnose();
  59. timerCounterNow = TimerCounter;
  60. }
  61. }
  62. }
  63. // 注意解码超限问题
  64. void BcuDecodeFunction(uint32 ID, uint8 *rawData)
  65. {
  66. switch (ID)
  67. {
  68. case 0x1801D0F3:
  69. BMS_ReqVIN = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0x3);
  70. BMS_ReqHVOff = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 2) & 0x3);
  71. BcuRxFlag[0] = 0x01;
  72. break;
  73. case 0x1801D8F3:
  74. BMS_SoftwareVersion = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
  75. BMS_HardwareVersion = (UINT16)(((*(UINT8 *)(rawData + 2)) | (*(UINT8 *)(rawData + 3) << 8)) & 0xFFFF);
  76. BMS_ProtocolEditionH = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0x3);
  77. BMS_ProtocolEditionL = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 2) & 0xF);
  78. BcuRxFlag[1] = 0x01;
  79. break;
  80. case 0x1880D0F3:
  81. BMS_CharDevNum = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xF);
  82. BMS_FtPosRly = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 4) & 0x1);
  83. BMS_FtNegRly = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 5) & 0x1);
  84. BMS_FtPosCharRly1 = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 6) & 0x1);
  85. BMS_FtNegCharRly1 = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 7) & 0x1);
  86. BMS_FtPosCharRly2 = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0x1);
  87. BMS_FtNegCharRly2 = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 1) & 0x1);
  88. BMS_FtHeatRly1 = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 2) & 0x1);
  89. BMS_FtHeatRly2 = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 3) & 0x1);
  90. BMS_StPosRly = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 4) & 0x3);
  91. BMS_StNegRly = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 6) & 0x3);
  92. BMS_StPreCharRly = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0x3);
  93. BMS_StPosCharRly1 = (UINT8)(((*(UINT8 *)(rawData + 2)) >> 2) & 0x3);
  94. BMS_StNegCharRly1 = (UINT8)(((*(UINT8 *)(rawData + 2)) >> 4) & 0x3);
  95. BMS_StPosCharRly2 = (UINT8)(((*(UINT8 *)(rawData + 2)) >> 6) & 0x3);
  96. BMS_StNegCharRly2 = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0x3);
  97. BMS_FtAuxRelayWeld = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 2) & 0x1);
  98. BMS_BraOpenCirc = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 3) & 0x1);
  99. BMS_FtBackCharCurrOutLim = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 4) & 0x3);
  100. BMS_FtPosRlyOpen = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 6) & 0x1);
  101. BMS_FtNegRlyOpen = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 7) & 0x1);
  102. BMS_FtPosCharRly1Open = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0x1);
  103. BMS_FtPosCharRly2Open = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 1) & 0x1);
  104. BMS_FtNegCharRly1Open = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 2) & 0x1);
  105. BMS_FtNegCharRly2Open = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 3) & 0x1);
  106. BMS_FtTMSContClose = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 4) & 0x1);
  107. BMS_FtTMSContOpen = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 5) & 0x1);
  108. BMS_FtTMS = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 6) & 0x1);
  109. BMS_Ft24VSpy = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 7) & 0x1);
  110. BMS_FtPACKSelfProt = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0x1);
  111. BMS_FtCharSockTempOver = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 1) & 0x3);
  112. BMS_FtTempOutCtrl = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 3) & 0x1);
  113. BMS_StPosHeatRly = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 4) & 0x3);
  114. BMS_StNegHeatRly = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 6) & 0x3);
  115. BMS_CharSysNum = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xF);
  116. BMS_FtCode = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
  117. BcuRxFlag[2] = 0x01;
  118. break;
  119. case 0x1881D0F3:
  120. BMS_ST1CheckSum = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
  121. BMS_ST1Counter = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xF);
  122. BMS_Mode = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 4) & 0x3);
  123. BMS_AuxRlySt = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 6) & 0x1);
  124. BMS_BattBalaSt = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 7) & 0x1);
  125. BMS_CharGunSt = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0x1);
  126. BMS_CharMode = (UINT8)(((*(UINT8 *)(rawData + 2)) >> 1) & 0x3);
  127. BMS_CharSt = (UINT8)(((*(UINT8 *)(rawData + 2)) >> 3) & 0x3);
  128. BMS_FtLvl = (UINT8)(((*(UINT8 *)(rawData + 2)) >> 5) & 0x3);
  129. BMS_FtCellTempDiff = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0x3);
  130. BMS_FtCellTempHigh = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 2) & 0x3);
  131. BMS_FtPACKOverVolt = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 4) & 0x3);
  132. BMS_FtPACKUndeVolt = (UINT8)(((*(UINT8 *)(rawData + 3)) >> 6) & 0x3);
  133. BMS_FtSOCLow = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0x3);
  134. BMS_FtCellOverVolt = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 2) & 0x3);
  135. BMS_FtCellUndeVolt = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 4) & 0x3);
  136. BMS_FtIns = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 6) & 0x3);
  137. BMS_FtCellOverVoltDiff = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0x3);
  138. BMS_FtCharCurrOver = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 2) & 0x3);
  139. BMS_FtDisCharCurrOver = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 4) & 0x3);
  140. BMS_FtCellTempLow = (UINT8)(((*(UINT8 *)(rawData + 5)) >> 6) & 0x3);
  141. BMS_FtBranVoltDifOver = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0x3);
  142. BMS_FtBMSHardWare = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 2) & 0x3);
  143. BMS_FtSOCHigh = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 4) & 0x1);
  144. BMS_FtSOCJump = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 5) & 0x1);
  145. BMS_FtInCom = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 6) & 0x1);
  146. BMS_FtSysMism = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 7) & 0x1);
  147. BMS_FtHvIntLock = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0x1);
  148. BMS_FtSmoke = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 1) & 0x1);
  149. BMS_FtFire = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 2) & 0x1);
  150. BMS_FtNum = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 3) & 0x1F);
  151. BcuRxFlag[3] = 0x01;
  152. break;
  153. case 0x1882D0F3:
  154. BMS_PackSOC = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
  155. BMS_PackSOH = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
  156. BMS_PackCurr = (UINT16)(((*(UINT8 *)(rawData + 2)) | (*(UINT8 *)(rawData + 3) << 8)) & 0xFFFF);
  157. BMS_MaxCharCurr = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
  158. BMS_MaxDisCharCurr = (UINT16)(((*(UINT8 *)(rawData + 6)) | (*(UINT8 *)(rawData + 7) << 8)) & 0xFFFF);
  159. BcuRxFlag[4] = 0x01;
  160. break;
  161. case 0x1883D0F3:
  162. BMS_PosIns = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
  163. BMS_NegIns = (UINT16)(((*(UINT8 *)(rawData + 2)) | (*(UINT8 *)(rawData + 3) << 8)) & 0xFFFF);
  164. BMS_BattVolt = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
  165. BMS_LinkVolt = (UINT16)(((*(UINT8 *)(rawData + 6)) | (*(UINT8 *)(rawData + 7) << 8)) & 0xFFFF);
  166. BcuRxFlag[5] = 0x01;
  167. break;
  168. case 0x1884D0F3:
  169. BMS_MaxCellTemp = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
  170. BMS_MinCellTemp = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
  171. BMS_AverCellTemp = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
  172. BMS_MaxCellTempCSC = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
  173. BMS_MaxCellTempNum = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0xFF);
  174. BMS_MinCellTempCSC = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0xFF);
  175. BMS_MinCellTempNum = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
  176. BcuRxFlag[6] = 0x01;
  177. break;
  178. case 0x1885D0F3:
  179. BMS_MaxCellVolt = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
  180. BMS_MaxCellVoltCSC = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
  181. BMS_MaxCellVoltNum = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
  182. BMS_AverCellVolt = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
  183. BcuRxFlag[7] = 0x01;
  184. break;
  185. case 0x1886D0F3:
  186. BMS_MinCellVolt = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
  187. BMS_MinCellVoltCSC = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
  188. BMS_MinCellVoltNum = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
  189. BMS_ContChrgCurr = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
  190. BMS_ContDisCharCurr = (UINT16)(((*(UINT8 *)(rawData + 6)) | (*(UINT8 *)(rawData + 7) << 8)) & 0xFFFF);
  191. BcuRxFlag[8] = 0x01;
  192. break;
  193. case 0x1887D0F3:
  194. BMS_CharReqVolt = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
  195. BMS_CharReqCurr = (UINT16)(((*(UINT8 *)(rawData + 2)) | (*(UINT8 *)(rawData + 3) << 8)) & 0xFFFF);
  196. BMS_SysInsRes = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
  197. BMS_InsDeteSt = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0x1);
  198. BMS_FtCharInsLow = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 1) & 0x1);
  199. BMS_FtCurrSenr = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 2) & 0x1);
  200. BMS_FtHeatingFilm = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 3) & 0x1);
  201. BMS_FtMainLoopPreChar = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 4) & 0x1);
  202. BMS_FtAuxLoopPreChar = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 5) & 0x1);
  203. BMS_FtACANLost = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 6) & 0x1);
  204. BMS_FtDCDC = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 7) & 0x1);
  205. BMS_FtSOCDif = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0x1);
  206. BMS_FtCellOverDisChar = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 1) & 0x1);
  207. BMS_FtCharOver = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 2) & 0x3);
  208. BMS_FtContDisCharCurrOverLoad = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 4) & 0x3);
  209. BMS_FtContCharCurrOverLoad = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 6) & 0x3);
  210. BcuRxFlag[9] = 0x01;
  211. break;
  212. case 0x1888D0F3:
  213. BMS_MaxDisCharPwr = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
  214. BMS_MaxCharPwr = (UINT16)(((*(UINT8 *)(rawData + 2)) | (*(UINT8 *)(rawData + 3) << 8)) & 0xFFFF);
  215. BMS_ContDisCharPwr = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
  216. BMS_ContCharPwr = (UINT16)(((*(UINT8 *)(rawData + 6)) | (*(UINT8 *)(rawData + 7) << 8)) & 0xFFFF);
  217. BcuRxFlag[10] = 0x01;
  218. break;
  219. case 0x1889D0F3:
  220. BMS_InstEngyCons = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
  221. BMS_TotalEngyCons = (UINT16)(((*(UINT8 *)(rawData + 2)) | (*(UINT8 *)(rawData + 3) << 8)) & 0xFFFF);
  222. BMS_SOE = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
  223. BMS_RmanCharTime = (UINT16)(((*(UINT8 *)(rawData + 6)) | (*(UINT8 *)(rawData + 7) << 8)) & 0xFFFF);
  224. BcuRxFlag[11] = 0x01;
  225. break;
  226. case 0x188AD0F3:
  227. BMS_Gun1DCNegTemp = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
  228. BMS_Gun1DCPosTemp = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
  229. BMS_Gun2DCNegTemp = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
  230. BMS_Gun2DCPosTemp = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
  231. BMS_CurrHeatSt = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0x3);
  232. BMS_CurrCoolSt = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 2) & 0x3);
  233. BMS_FtCharCnct = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 4) & 0x1);
  234. BMS_FtOverDisCharCurrDuringChar = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 5) & 0x1);
  235. BMS_FtCharNTC = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 6) & 0x1);
  236. BMS_FtELock = (UINT8)(((*(UINT8 *)(rawData + 4)) >> 7) & 0x1);
  237. BMS_CharNum = (UINT16)(((*(UINT8 *)(rawData + 5)) | (*(UINT8 *)(rawData + 6) << 8)) & 0xFFFF);
  238. BcuRxFlag[12] = 0x01;
  239. break;
  240. case 0x18C1D0F3:
  241. BMS_CellVoltFramNum = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
  242. BMS_CSC_Code = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
  243. if (BMS_CellVoltFramNum == 0 || BMS_CellVoltFramNum > 128)
  244. {
  245. break;
  246. }
  247. for (UINT8 i = 0; i < 3; i++)
  248. {
  249. BMS_CellVolt[(BMS_CellVoltFramNum - 1) * 3 + i] = (UINT16)(((*(UINT8 *)(rawData + i * 2 + 2)) | (*(UINT8 *)(rawData + i * 2 + 3) << 8)) & 0xFFFF);
  250. }
  251. BcuRxFlag[13] = 0x01;
  252. break;
  253. case 0x18C2D0F3:
  254. BMS_CellTempFramNum = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
  255. BMS_CSC_Code = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
  256. if (BMS_CellTempFramNum == 0 || BMS_CellTempFramNum > 12)
  257. {
  258. break;
  259. }
  260. for (UINT8 i = 0; i < 6; i++)
  261. {
  262. if (((BMS_CellTempFramNum - 1) * 6 + i) < sizeof(BMS_CellTemp))
  263. {
  264. BMS_CellTemp[(BMS_CellTempFramNum - 1) * 6 + i] = (UINT8)(((*(UINT8 *)(rawData + 2 + i))) & 0xFF);
  265. if (BMS_CellTemp[(BMS_CellTempFramNum - 1) * 6 + i] <= (0xFF - 10) && BMS_CellTemp[(BMS_CellTempFramNum - 1) * 6 + i] >= 10)
  266. {
  267. BMS_CellTemp[(BMS_CellTempFramNum - 1) * 6 + i] = BMS_CellTemp[(BMS_CellTempFramNum - 1) * 6 + i] - 10; // the tcp offset is -40, while the can message offset is -50
  268. }
  269. }
  270. }
  271. BcuRxFlag[14] = 0x01;
  272. break;
  273. case 0x18E1D0F3:
  274. BMS_Checksum = 0;
  275. for (UINT8 i = 1; i < 8; i++)
  276. {
  277. BMS_Checksum = (UINT8)(((*(UINT8 *)(rawData + i))) & 0xFF) ^ BMS_Checksum;
  278. }
  279. if (BMS_Checksum == (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF))
  280. {
  281. BMS_PackComp = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0x7);
  282. BMS_BattCodeLeng = (UINT8)(((*(UINT8 *)(rawData + 1)) >> 3) & 0x1F);
  283. BMS_SN[0] = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
  284. BMS_SN[1] = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
  285. BMS_SN[2] = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0xFF);
  286. BMS_SN[3] = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0xFF);
  287. BMS_SN[4] = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
  288. BMS_SN[5] = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
  289. }
  290. BcuRxFlag[15] = 0x01;
  291. break;
  292. case 0x18E2D0F3:
  293. BMS_Checksum = 0;
  294. for (UINT8 i = 1; i < 8; i++)
  295. {
  296. BMS_Checksum = (UINT8)(((*(UINT8 *)(rawData + i))) & 0xFF) ^ BMS_Checksum;
  297. }
  298. if (BMS_Checksum == (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF))
  299. {
  300. BMS_SN[6] = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
  301. BMS_SN[7] = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
  302. BMS_SN[8] = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
  303. BMS_SN[9] = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0xFF);
  304. BMS_SN[10] = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0xFF);
  305. BMS_SN[11] = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
  306. BMS_SN[12] = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
  307. }
  308. BcuRxFlag[16] = 0x01;
  309. break;
  310. case 0x18E3D0F3:
  311. BMS_Checksum = 0;
  312. for (UINT8 i = 1; i < 8; i++)
  313. {
  314. BMS_Checksum = (UINT8)(((*(UINT8 *)(rawData + i))) & 0xFF) ^ BMS_Checksum;
  315. }
  316. if (BMS_Checksum == (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF))
  317. {
  318. BMS_SN[13] = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
  319. BMS_SN[14] = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
  320. BMS_SN[15] = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
  321. BMS_SN[16] = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0xFF);
  322. BMS_SN[17] = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0xFF);
  323. BMS_SN[18] = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
  324. BMS_SN[19] = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
  325. }
  326. BcuRxFlag[17] = 0x01;
  327. break;
  328. case 0x18E4D0F3:
  329. BMS_Checksum = 0;
  330. for (UINT8 i = 1; i < 8; i++)
  331. {
  332. BMS_Checksum = (UINT8)(((*(UINT8 *)(rawData + i))) & 0xFF) ^ BMS_Checksum;
  333. }
  334. if (BMS_Checksum == (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF))
  335. {
  336. BMS_SN[20] = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
  337. BMS_SN[21] = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
  338. BMS_SN[22] = (UINT8)(((*(UINT8 *)(rawData + 3))) & 0xFF);
  339. BMS_SN[23] = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0xFF);
  340. BMS_SN[24] = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0xFF);
  341. BMS_SN[25] = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
  342. BMS_SN[26] = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
  343. }
  344. BcuRxFlag[18] = 0x01;
  345. break;
  346. case 0x18E5D0F3:
  347. BMS_BattRateCap = (UINT16)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8)) & 0xFFFF);
  348. BMS_BattRateVolt = (UINT16)(((*(UINT8 *)(rawData + 2)) | (*(UINT8 *)(rawData + 3) << 8)) & 0xFFFF);
  349. BMS_BattRateEngy = (UINT16)(((*(UINT8 *)(rawData + 4)) | (*(UINT8 *)(rawData + 5) << 8)) & 0xFFFF);
  350. BMS_BattType = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xF);
  351. BMS_CoolType = (UINT8)(((*(UINT8 *)(rawData + 6)) >> 4) & 0x3);
  352. BcuRxFlag[19] = 0x01;
  353. break;
  354. case 0x18E6D0F3:
  355. BMS_CSC_Total = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
  356. BMS_CellTotal = (UINT16)(((*(UINT8 *)(rawData + 1)) | (*(UINT8 *)(rawData + 2) << 8)) & 0xFFFF);
  357. BMS_TempTotal = (UINT16)(((*(UINT8 *)(rawData + 3)) | (*(UINT8 *)(rawData + 4) << 8)) & 0xFFFF);
  358. BMS_CellVoltLevel = (UINT8)(((*(UINT8 *)(rawData + 5))) & 0xFF);
  359. BMS_CellMinVolt = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
  360. BMS_CellMaxVolt = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
  361. BcuRxFlag[20] = 0x01;
  362. break;
  363. case 0x18F1D0F3:
  364. BMS_TotalCharEngy = (UINT32)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8) | (*(UINT8 *)(rawData + 2) << 16) | (*(UINT8 *)(rawData + 3) << 24)) & 0xFFFFFF);
  365. BMS_TotalDisCharEngy = (UINT32)(((*(UINT8 *)(rawData + 3)) | (*(UINT8 *)(rawData + 4) << 8) | (*(UINT8 *)(rawData + 5) << 16) | (*(UINT8 *)(rawData + 6) << 24)) & 0xFFFFFF);
  366. BMS_SingleCharEngy = (UINT16)(((*(UINT8 *)(rawData + 6)) | (*(UINT8 *)(rawData + 7) << 8)) & 0xFFFF);
  367. BcuRxFlag[21] = 0x01;
  368. break;
  369. case 0x18F2D0F3:
  370. BMS_TotalBackCharEngy = (UINT32)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8) | (*(UINT8 *)(rawData + 2) << 16) | (*(UINT8 *)(rawData + 3) << 24)) & 0xFFFFFF);
  371. BMS_TotalStaCharEngy = (UINT32)(((*(UINT8 *)(rawData + 3)) | (*(UINT8 *)(rawData + 4) << 8) | (*(UINT8 *)(rawData + 5) << 16) | (*(UINT8 *)(rawData + 6) << 24)) & 0xFFFFFF);
  372. BcuRxFlag[22] = 0x01;
  373. break;
  374. case 0x18F3D0F3:
  375. BMS_TotalGunCharEngy = (UINT32)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8) | (*(UINT8 *)(rawData + 2) << 16) | (*(UINT8 *)(rawData + 3) << 24)) & 0xFFFFFF);
  376. BMS_TotalGunCharCapy = (UINT32)(((*(UINT8 *)(rawData + 3)) | (*(UINT8 *)(rawData + 4) << 8) | (*(UINT8 *)(rawData + 5) << 16) | (*(UINT8 *)(rawData + 6) << 24)) & 0xFFFFFF);
  377. BcuRxFlag[23] = 0x01;
  378. break;
  379. case 0x18F4D0F3:
  380. BMS_TotalCharCapy = (UINT32)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8) | (*(UINT8 *)(rawData + 2) << 16) | (*(UINT8 *)(rawData + 3) << 24)) & 0xFFFFFF);
  381. BMS_TotalDisCharCapy = (UINT32)(((*(UINT8 *)(rawData + 3)) | (*(UINT8 *)(rawData + 4) << 8) | (*(UINT8 *)(rawData + 5) << 16) | (*(UINT8 *)(rawData + 6) << 24)) & 0xFFFFFF);
  382. BMS_SingleCharCapy = (UINT16)(((*(UINT8 *)(rawData + 6)) | (*(UINT8 *)(rawData + 7) << 8)) & 0xFFFF);
  383. BcuRxFlag[24] = 0x01;
  384. break;
  385. case 0x18F5D0F3:
  386. BMS_TotalBackCharCapy = (UINT32)(((*(UINT8 *)(rawData + 0)) | (*(UINT8 *)(rawData + 1) << 8) | (*(UINT8 *)(rawData + 2) << 16) | (*(UINT8 *)(rawData + 3) << 24)) & 0xFFFFFF);
  387. BMS_TotalStaCharCapy = (UINT32)(((*(UINT8 *)(rawData + 3)) | (*(UINT8 *)(rawData + 4) << 8) | (*(UINT8 *)(rawData + 5) << 16) | (*(UINT8 *)(rawData + 6) << 24)) & 0xFFFFFF);
  388. BMS_HVBranNum = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
  389. BMS_SingleHVBranchCellNum = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
  390. BcuRxFlag[25] = 0x01;
  391. break;
  392. case 0x18FF45F4:
  393. BMS_ReqMode = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0x3);
  394. BMS_HVCmd = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 2) & 0x3);
  395. BMS_ChgSts = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 4) & 0x3);
  396. BMS_HVRelaySts = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 6) & 0x3);
  397. BMS_HVVolt = (UINT16)(((*(UINT8 *)(rawData + 1)) | (*(UINT8 *)(rawData + 2) << 8)) & 0xFFFF);
  398. BMS_SetTemp = (UINT8)(((*(UINT8 *)(rawData + 4))) & 0xFF);
  399. BMS_Life = (UINT8)(((*(UINT8 *)(rawData + 6))) & 0xFF);
  400. BMS_CRC = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0xFF);
  401. BcuRxFlag[26] = 0x01;
  402. break;
  403. case 0x18FFC13A:
  404. TMS_WorkStatus = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0x3);
  405. TMS_HVRelayST = (UINT8)(((*(UINT8 *)(rawData + 0)) >> 2) & 0x3);
  406. TMS_OutletTemp = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
  407. TMS_InletTemp = (UINT8)(((*(UINT8 *)(rawData + 2))) & 0xFF);
  408. TMS_ReqPow = (UINT16)(((*(UINT8 *)(rawData + 5)) | (*(UINT8 *)(rawData + 6) << 8)) & 0xFFFF);
  409. TMS_ErrCode = (UINT8)(((*(UINT8 *)(rawData + 7))) & 0x3F);
  410. TMS_FaultLevel = (UINT8)(((*(UINT8 *)(rawData + 7)) >> 6) & 0x3);
  411. BcuRxFlag[27] = 0x01;
  412. break;
  413. case 0x1C00EDEA:
  414. UDSAnsFunc(rawData);
  415. break;
  416. default:
  417. break;
  418. }
  419. }
  420. static void UDSAnsFunc(uint8 *rawData)
  421. {
  422. static uint8 UdsStates = 1;
  423. uint8 Data[8] = {0};
  424. memcpy(Data, rawData, 8);
  425. uint8 UdsService = 0;
  426. uint8 UdsSubService = 0;
  427. UdsService = Data[0];
  428. UdsSubService = Data[1];
  429. uint8 AnsData[24] = {0};
  430. static uint8 deviceSnRecvFlg = 0;
  431. switch (UdsService)
  432. {
  433. case 0x10: // 模式切换
  434. {
  435. if (UdsSubService == 0x01)
  436. {
  437. UdsStates = 0x01; // 关闭UDS诊断
  438. UdsAns(true, UdsService, UdsSubService, 0x00, NULL, 0);
  439. }
  440. else if (UdsSubService == 0x02)
  441. {
  442. if (UdsStates == 0x01 || UdsStates == 0x02)
  443. {
  444. UdsStates = 0x02; // 打开UDS诊断
  445. UdsAns(true, UdsService, UdsSubService, 0x00, NULL, 0);
  446. }
  447. else
  448. {
  449. UdsAns(false, UdsService, UdsSubService, 0x00, NULL, 0);
  450. }
  451. }
  452. break;
  453. }
  454. case 0x11: // 控制
  455. {
  456. if (UdsStates == 0x02)
  457. {
  458. switch (UdsSubService)
  459. {
  460. case 0x01: // 重启
  461. {
  462. AnsData[0] = AppSwVersion >> 24;
  463. AnsData[1] = AppSwVersion >> 16;
  464. AnsData[2] = AppSwVersion >> 8;
  465. AnsData[3] = AppSwVersion >> 0;
  466. UdsAns(true, UdsService, UdsSubService, 0x00, AnsData, 4);
  467. AppConfigInfo.appSaveFlg = true;
  468. vTaskDelay(pdMS_TO_TICKS(1000));
  469. SystemSoftwareReset();
  470. break;
  471. }
  472. default:
  473. {
  474. UdsAns(false, UdsService, UdsSubService, 0x00, NULL, 0);
  475. break;
  476. }
  477. }
  478. }
  479. else
  480. {
  481. UdsAns(false, UdsService, UdsSubService, 0x00, NULL, 0);
  482. }
  483. break;
  484. }
  485. case 0x22: // 查询
  486. {
  487. if (UdsStates == 0x02)
  488. {
  489. switch (UdsSubService)
  490. {
  491. case 0x01: // 版本号查询
  492. {
  493. AnsData[0] = AppSwVersion >> 24;
  494. AnsData[1] = AppSwVersion >> 16;
  495. AnsData[2] = AppSwVersion >> 8;
  496. AnsData[3] = AppSwVersion >> 0;
  497. UdsAns(true, UdsService, UdsSubService, 0x00, AnsData, 4);
  498. break;
  499. }
  500. case 0x02: // SN号码查询
  501. {
  502. memcpy(AnsData, AppConfigInfo.deviceSn, 17);
  503. for (uint8 i = 0; i < 5; i++)
  504. {
  505. UdsAns(true, UdsService, UdsSubService, i, &AnsData[i * 4], 4);
  506. }
  507. break;
  508. }
  509. case 0x03: // ICCID查询
  510. {
  511. memcpy(AnsData, IccidNum, 20);
  512. for (uint8 i = 0; i < 5; i++)
  513. {
  514. UdsAns(true, UdsService, UdsSubService, i, &AnsData[i * 4], 4);
  515. }
  516. break;
  517. }
  518. case 0x04: // IMEI查询
  519. {
  520. memcpy(AnsData, ImeiNum, 15);
  521. for (uint8 i = 0; i < 4; i++)
  522. {
  523. UdsAns(true, UdsService, UdsSubService, i, &AnsData[i * 4], 4);
  524. }
  525. break;
  526. }
  527. case 0x05: // 驻网状态查询
  528. {
  529. AnsData[0] = RegChkRet;
  530. UdsAns(true, UdsService, UdsSubService, 0x00, AnsData, 1);
  531. break;
  532. }
  533. case 0x06: // 联网状态查询
  534. {
  535. AnsData[0] = SocketId;
  536. UdsAns(true, UdsService, UdsSubService, 0x00, AnsData, 1);
  537. break;
  538. }
  539. case 0x07: // 定位信息查询
  540. {
  541. GPSInfo GpsRecvData;
  542. if (xQueuePeek(GpsDataQueueHandle, &GpsRecvData, 0) == pdPASS)
  543. {
  544. AnsData[0] = GpsRecvData.locateMark;
  545. AnsData[4] = GpsRecvData.longitude[0];
  546. AnsData[5] = GpsRecvData.longitude[1];
  547. AnsData[6] = GpsRecvData.longitude[2];
  548. AnsData[7] = GpsRecvData.longitude[3];
  549. AnsData[8] = GpsRecvData.latitude[0];
  550. AnsData[9] = GpsRecvData.latitude[1];
  551. AnsData[10] = GpsRecvData.latitude[2];
  552. AnsData[11] = GpsRecvData.latitude[3];
  553. AnsData[12] = GpsRecvData.altitude[0];
  554. AnsData[13] = GpsRecvData.altitude[1];
  555. AnsData[14] = GpsRecvData.satelliteNum;
  556. for (uint8 i = 0; i < 4; i++)
  557. {
  558. UdsAns(true, UdsService, UdsSubService, i, &AnsData[i * 4], 4);
  559. }
  560. break;
  561. }
  562. else
  563. {
  564. AnsData[0] = 0xFF;
  565. UdsAns(true, UdsService, UdsSubService, 0x00, AnsData, 1);
  566. }
  567. break;
  568. }
  569. case 0x08: // 温度检测查询
  570. {
  571. UdsAns(true, UdsService, UdsSubService, 0x00, AnsData, 1);
  572. break;
  573. }
  574. case 0x09: // 电池信息查询
  575. {
  576. UdsAns(true, UdsService, UdsSubService, 0x00, AnsData, 1);
  577. BattSendFlg = 1;
  578. break;
  579. }
  580. case 0x0A: // 三轴数据查询
  581. {
  582. AnsData[0] = xyzData[0] >> 8;
  583. AnsData[1] = xyzData[0] >> 0;
  584. AnsData[2] = xyzData[1] >> 8;
  585. AnsData[3] = xyzData[1] >> 0;
  586. AnsData[4] = xyzData[2] >> 8;
  587. AnsData[5] = xyzData[2] >> 0;
  588. for (uint8 i = 0; i < 2; i++)
  589. {
  590. UdsAns(true, UdsService, UdsSubService, i, &AnsData[i * 4], 4);
  591. }
  592. break;
  593. }
  594. } // switch
  595. } // if
  596. else
  597. {
  598. UdsAns(false, UdsService, UdsSubService, 0x00, NULL, 0);
  599. }
  600. break;
  601. }
  602. case 0x27: // 控制
  603. {
  604. if (UdsStates == 0x02)
  605. {
  606. }
  607. else
  608. {
  609. UdsAns(false, UdsService, UdsSubService, 0x00, NULL, 0);
  610. }
  611. break;
  612. }
  613. case 0x2E: // 写入
  614. {
  615. if (UdsStates == 0x02)
  616. {
  617. switch (UdsSubService)
  618. {
  619. case 0x01:
  620. {
  621. setbit(deviceSnRecvFlg, Data[3]);
  622. if (Data[3] < 0x04)
  623. {
  624. memcpy(&AppConfigInfo.deviceSn[Data[3] * 4], &Data[4], 4);
  625. UdsAns(true, UdsService, UdsSubService, 0x00, &Data[3], 1);
  626. }
  627. else if (Data[3] == 0x04)
  628. {
  629. memcpy(&AppConfigInfo.deviceSn[Data[3] * 4], &Data[4], 1);
  630. UdsAns(true, UdsService, UdsSubService, 0x00, &Data[3], 1);
  631. }
  632. if (deviceSnRecvFlg == 0x1F)
  633. {
  634. deviceSnRecvFlg = 0;
  635. AppConfigInfo.appSaveFlg = true;
  636. AppConfigInfo.eolFlg = true;
  637. }
  638. break;
  639. }
  640. }
  641. }
  642. else
  643. {
  644. UdsAns(false, UdsService, UdsSubService, 0x00, NULL, 0);
  645. }
  646. break;
  647. }
  648. case 0x31: // 控制
  649. {
  650. if (UdsStates == 0x02)
  651. {
  652. }
  653. else
  654. {
  655. UdsAns(false, UdsService, UdsSubService, 0x00, NULL, 0);
  656. }
  657. break;
  658. }
  659. default:
  660. break;
  661. }
  662. return;
  663. }
  664. static void UdsAns(bool PosFlg, uint8 UdsService, uint8 UdsSubService, uint8 Idx, uint8 *AnsData, uint8 AnsDataLen)
  665. {
  666. Can_Msg_Type CanTxMsg;
  667. uint32 CanAnsId = 0x1C00EAED;
  668. uint8 SendData[8] = {0};
  669. if (PosFlg)
  670. {
  671. SendData[0] = 0x78;
  672. SendData[1] = UdsService;
  673. SendData[2] = UdsSubService;
  674. SendData[3] = Idx;
  675. if (AnsData != NULL && AnsDataLen != 0x00)
  676. {
  677. memcpy(&SendData[4], AnsData, AnsDataLen);
  678. }
  679. }
  680. else
  681. {
  682. SendData[0] = 0x7F;
  683. SendData[1] = UdsService;
  684. SendData[2] = UdsSubService;
  685. SendData[3] = 0x00;
  686. }
  687. CanTxMsg.id = CanAnsId;
  688. CanTxMsg.idFrame = CAN_EXTENDED_ID_TYPE;
  689. CanTxMsg.sdu = SendData;
  690. CanTxMsg.length = 8;
  691. CanIf_SendMessage(CAN1, CanTxMsg);
  692. }
  693. static void BattSendFunc(void)
  694. {
  695. // Can_Msg_Type CanTxMsg;
  696. // uint32 CanAnsId = 0;
  697. // uint8 SendData[8] = {0};
  698. // static uint8 SendStep = 0;
  699. // static uint8 SendCounter = 0;
  700. // switch (SendStep)
  701. // {
  702. // case 0x00:
  703. // {
  704. // SendStep++;
  705. // break;
  706. // }
  707. // case 0x01:
  708. // {
  709. // CanAnsId = 0x1C01EAED;
  710. // SendData[0] = battHeatState;
  711. // SendData[1] = battFanState;
  712. // SendData[2] = battRelayState;
  713. // SendData[3] = battConverState;
  714. // SendStep++;
  715. // break;
  716. // }
  717. // case 0x02:
  718. // {
  719. // uint16 ErrorTemp ;
  720. // ErrorTemp = GetErrorNum(ErrorArray,sizeof(ErrorArray)/2);
  721. // CanAnsId = 0x1C09EAED;
  722. // SendData[0] = battWorkState;
  723. // SendData[1] = ErrorTemp>>8;
  724. // SendData[2] = ErrorTemp;
  725. // SendData[3] = 0;
  726. // SendData[4] = 0;
  727. // SendData[5] = 0;
  728. // SendData[6] = 0;
  729. // SendData[7] = 0;
  730. // SendStep++;
  731. // break;
  732. // }
  733. // case 0x03:
  734. // {
  735. // CanAnsId = 0x1C0AEAED;
  736. // uint16 SocTemp = battSOC*10;
  737. // SendData[0] = battI>>8;
  738. // SendData[1] = battI;
  739. // SendData[2] = battPackVol>>8;
  740. // SendData[3] = battPackVol;
  741. // SendData[4] = SocTemp>>8;
  742. // SendData[5] = SocTemp;
  743. // SendData[6] = battSOH;
  744. // SendData[7] = battMOSSwitchState;
  745. // SendStep++;
  746. // break;
  747. // }
  748. // case 0x04:
  749. // {
  750. // CanAnsId = 0x1C10EAED + (SendCounter<<16);
  751. // if((SendCounter*8 + 7)>BMS_TEMPNUM)
  752. // {
  753. // SendCounter = 0;
  754. // SendStep++;
  755. // break;
  756. // }
  757. // else
  758. // {
  759. // SendData[0] = battCellTemp[SendCounter*8 + 0];
  760. // SendData[1] = battCellTemp[SendCounter*8 + 1];
  761. // SendData[2] = battCellTemp[SendCounter*8 + 2];
  762. // SendData[3] = battCellTemp[SendCounter*8 + 3];
  763. // SendData[4] = battCellTemp[SendCounter*8 + 4];
  764. // SendData[5] = battCellTemp[SendCounter*8 + 5];
  765. // SendData[6] = battCellTemp[SendCounter*8 + 6];
  766. // SendData[7] = battCellTemp[SendCounter*8 + 7];
  767. // }
  768. // break;
  769. // }
  770. // case 0x05:
  771. // {
  772. // CanAnsId = 0x1CA0EAED + (SendCounter<<16);
  773. // if((SendCounter*4 + 3)>BMS_CELLNUM)
  774. // {
  775. // SendCounter = 0;
  776. // SendStep++;
  777. // break;
  778. // }
  779. // else
  780. // {
  781. // SendData[0] = battCellU[SendCounter*4 + 0]>>8;
  782. // SendData[1] = battCellU[SendCounter*4 + 0];
  783. // SendData[2] = battCellU[SendCounter*4 + 1]>>8;
  784. // SendData[3] = battCellU[SendCounter*4 + 1];
  785. // SendData[4] = battCellU[SendCounter*4 + 2]>>8;
  786. // SendData[5] = battCellU[SendCounter*4 + 2];
  787. // SendData[6] = battCellU[SendCounter*4 + 3]>>8;
  788. // SendData[7] = battCellU[SendCounter*4 + 3];
  789. // }
  790. // break;
  791. // }
  792. // default:
  793. // {
  794. // SendStep = 0;
  795. // BattSendFlg = 0;
  796. // return;
  797. // break;
  798. // }
  799. // }
  800. // CanTxMsg.id = CanAnsId;
  801. // CanTxMsg.idFrame = CAN_EXTENDED_ID_TYPE;
  802. // CanTxMsg.sdu = SendData;
  803. // CanTxMsg.length = 8;
  804. // CanIf_SendMessage(CAN1, CanTxMsg);
  805. }
  806. void BcuRxDiagnose(void) // 100ms调用一次
  807. {
  808. static UINT32 TimeCounter = 0; // ms
  809. TimeCounter = TimeCounter + 10; //
  810. for (UINT8 i = 0; i < sizeof(BcuInTable) / 4; i++)
  811. {
  812. if (BcuRxFlag[i] == 1) // received msg, and clear the error conter
  813. {
  814. BcuRxErrorCounter[i] = 0;
  815. BcuRxFlag[i] = 0;
  816. continue;
  817. }
  818. if (BcuRxErrorCounter[i] < 3)
  819. {
  820. BcuRxShortError[i] = 0;
  821. BcuRxLongError[i] = 0;
  822. }
  823. else if (BcuRxErrorCounter[i] >= 3 && BcuRxErrorCounter[i] < 13)
  824. {
  825. BcuRxShortError[i] = 1;
  826. BcuRxLongError[i] = 0;
  827. }
  828. else if (BcuRxErrorCounter[i] >= 13)
  829. {
  830. BcuRxShortError[i] = 0;
  831. BcuRxLongError[i] = 1;
  832. BcuRxMsgSetInvalidValue(BcuInTable[i]);
  833. BcuRxErrorCounter[i] = 0;
  834. }
  835. else if (BcuRxErrorCounter[i] == 0xFF)
  836. {
  837. BcuRxErrorCounter[i] = 0xFE;
  838. }
  839. }
  840. if (TimeCounter % 100 == 0) // period <=100ms
  841. {
  842. BcuRxErrorCounter[0]++; // can msg 0x1801D0F3
  843. // if(BcuRxErrorCounter[0]>=13)
  844. BcuRxErrorCounter[2]++; // can msg 0x1880D0F3
  845. // if(BcuRxErrorCounter[2]>=13)
  846. BcuRxErrorCounter[3]++; // can msg 0x1881D0F3
  847. // if(BcuRxErrorCounter[3]>=13)
  848. BcuRxErrorCounter[4]++; // can msg 0x1882D0F3
  849. // if(BcuRxErrorCounter[4]>=13)
  850. BcuRxErrorCounter[5]++; // can msg 0x1883D0F3
  851. // if(BcuRxErrorCounter[5]>=13)
  852. BcuRxErrorCounter[6]++; // can msg 0x1884D0F3
  853. // if(BcuRxErrorCounter[6]>=13)
  854. BcuRxErrorCounter[7]++; // can msg 0x1885D0F3
  855. // if(BcuRxErrorCounter[7]>=13)
  856. BcuRxErrorCounter[8]++; // can msg 0x1886D0F3
  857. // if(BcuRxErrorCounter[8]>=13)
  858. BcuRxErrorCounter[9]++; // can msg 0x1887D0F3
  859. // if(BcuRxErrorCounter[9]>=13)
  860. BcuRxErrorCounter[10]++; // can msg 0x1888D0F3
  861. // if(BcuRxErrorCounter[10]>=13)
  862. BcuRxErrorCounter[13]++; // can msg 0x18C1D0F3
  863. // if(BcuRxErrorCounter[13]>=13)
  864. BcuRxErrorCounter[14]++; // can msg 0x18C2D0F3
  865. // if(BcuRxErrorCounter[14]>=13)
  866. BcuRxErrorCounter[19]++; // can msg 0x18E5D0F3
  867. // if(BcuRxErrorCounter[19]>=13)
  868. BcuRxErrorCounter[20]++; // can msg 0x18E6D0F3
  869. // if(BcuRxErrorCounter[20]>=13)
  870. }
  871. if (TimeCounter % 1000 == 0) // period ==1000ms
  872. {
  873. BcuRxErrorCounter[11]++; // can msg 0x1889D0F3
  874. // if(BcuRxErrorCounter[11]>=13)
  875. // printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[11]);
  876. BcuRxErrorCounter[12]++; // can msg 0x188AD0F3
  877. // if(BcuRxErrorCounter[12]>=13)
  878. // printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[12]);
  879. BcuRxErrorCounter[15]++; // can msg 0x18E1D0F3
  880. // if(BcuRxErrorCounter[15]>=13)
  881. // printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[15]);
  882. BcuRxErrorCounter[16]++; // can msg 0x18E2D0F3
  883. // if(BcuRxErrorCounter[16]>=13)
  884. // printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[16]);
  885. BcuRxErrorCounter[17]++; // can msg 0x18E3D0F3
  886. // if(BcuRxErrorCounter[17]>=13)
  887. // printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[17]);
  888. BcuRxErrorCounter[18]++; // can msg 0x18E4D0F3
  889. // if(BcuRxErrorCounter[18]>=13)
  890. // printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[18]);
  891. BcuRxErrorCounter[26]++; // can msg 0x18FF45F4
  892. // if(BcuRxErrorCounter[26]>=13)
  893. // printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[26]);
  894. BcuRxErrorCounter[27]++; // can msg 0x18FFC13A
  895. // if(BcuRxErrorCounter[27]>=13)
  896. // printf("can msg 0x%x lost,cycle time1000ms\n",COMInTable[27]);
  897. }
  898. if (TimeCounter % 30000 == 0) // period ==30000ms
  899. {
  900. BcuRxErrorCounter[1]++; // can msg 0x1801D8F3
  901. // if(BcuRxErrorCounter[1]>=13)
  902. // printf("can msg 0x%x lost,cycle time30000ms\n",COMInTable[1]);
  903. }
  904. }
  905. void BcuRxMsgSetInvalidValue(uint32 ID)
  906. {
  907. switch (ID)
  908. {
  909. case 0x1801D0F3:
  910. BMS_ReqVIN = 0xFF;
  911. BMS_ReqHVOff = 0xFF;
  912. break;
  913. case 0x1801D8F3:
  914. BMS_SoftwareVersion = 0xFFFF;
  915. BMS_HardwareVersion = 0xFFFF;
  916. BMS_ProtocolEditionH = 0xFF;
  917. BMS_ProtocolEditionL = 0xFF;
  918. break;
  919. case 0x1880D0F3:
  920. BMS_CharDevNum = 0xFF;
  921. BMS_FtPosRly = 0xFF;
  922. BMS_FtNegRly = 0xFF;
  923. BMS_FtPosCharRly1 = 0xFF;
  924. BMS_FtNegCharRly1 = 0xFF;
  925. BMS_FtPosCharRly2 = 0xFF;
  926. BMS_FtNegCharRly2 = 0xFF;
  927. BMS_FtHeatRly1 = 0xFF;
  928. BMS_FtHeatRly2 = 0xFF;
  929. BMS_StPosRly = 0xFF;
  930. BMS_StNegRly = 0xFF;
  931. BMS_StPreCharRly = 0xFF;
  932. BMS_StPosCharRly1 = 0xFF;
  933. BMS_StNegCharRly1 = 0xFF;
  934. BMS_StPosCharRly2 = 0xFF;
  935. BMS_StNegCharRly2 = 0xFF;
  936. BMS_FtAuxRelayWeld = 0xFF;
  937. BMS_BraOpenCirc = 0xFF;
  938. BMS_FtBackCharCurrOutLim = 0xFF;
  939. BMS_FtPosRlyOpen = 0xFF;
  940. BMS_FtNegRlyOpen = 0xFF;
  941. BMS_FtPosCharRly1Open = 0xFF;
  942. BMS_FtPosCharRly2Open = 0xFF;
  943. BMS_FtNegCharRly1Open = 0xFF;
  944. BMS_FtNegCharRly2Open = 0xFF;
  945. BMS_FtTMSContClose = 0xFF;
  946. BMS_FtTMSContOpen = 0xFF;
  947. BMS_FtTMS = 0xFF;
  948. BMS_Ft24VSpy = 0xFF;
  949. BMS_FtPACKSelfProt = 0xFF;
  950. BMS_FtCharSockTempOver = 0xFF;
  951. BMS_FtTempOutCtrl = 0xFF;
  952. BMS_StPosHeatRly = 0xFF;
  953. BMS_StNegHeatRly = 0xFF;
  954. BMS_CharSysNum = 0xFF;
  955. BMS_FtCode = 0xFF;
  956. break;
  957. case 0x1881D0F3:
  958. BMS_ST1CheckSum = 0xFF;
  959. BMS_ST1Counter = 0xFF;
  960. BMS_Mode = 0xFF;
  961. BMS_AuxRlySt = 0xFF;
  962. BMS_BattBalaSt = 0xFF;
  963. BMS_CharGunSt = 0xFF;
  964. BMS_CharMode = 0xFF;
  965. BMS_CharSt = 0xFF;
  966. BMS_FtLvl = 0xFF;
  967. BMS_FtCellTempDiff = 0xFF;
  968. BMS_FtCellTempHigh = 0xFF;
  969. BMS_FtPACKOverVolt = 0xFF;
  970. BMS_FtPACKUndeVolt = 0xFF;
  971. BMS_FtSOCLow = 0xFF;
  972. BMS_FtCellOverVolt = 0xFF;
  973. BMS_FtCellUndeVolt = 0xFF;
  974. BMS_FtIns = 0xFF;
  975. BMS_FtCellOverVoltDiff = 0xFF;
  976. BMS_FtCharCurrOver = 0xFF;
  977. BMS_FtDisCharCurrOver = 0xFF;
  978. BMS_FtCellTempLow = 0xFF;
  979. BMS_FtBranVoltDifOver = 0xFF;
  980. BMS_FtBMSHardWare = 0xFF;
  981. BMS_FtSOCHigh = 0xFF;
  982. BMS_FtSOCJump = 0xFF;
  983. BMS_FtInCom = 0xFF;
  984. BMS_FtSysMism = 0xFF;
  985. BMS_FtHvIntLock = 0xFF;
  986. BMS_FtSmoke = 0xFF;
  987. BMS_FtFire = 0xFF;
  988. BMS_FtNum = 0xFF;
  989. break;
  990. case 0x1882D0F3:
  991. BMS_PackSOC = 0xFF;
  992. BMS_PackSOH = 0xFF;
  993. BMS_PackCurr = 0xFFFF;
  994. BMS_MaxCharCurr = 0xFFFF;
  995. BMS_MaxDisCharCurr = 0xFFFF;
  996. break;
  997. case 0x1883D0F3:
  998. BMS_PosIns = 0xFFFF;
  999. BMS_NegIns = 0xFFFF;
  1000. BMS_BattVolt = 0xFFFF;
  1001. BMS_LinkVolt = 0xFFFF;
  1002. break;
  1003. case 0x1884D0F3:
  1004. BMS_MaxCellTemp = 0xFF;
  1005. BMS_MinCellTemp = 0xFF;
  1006. BMS_AverCellTemp = 0xFF;
  1007. BMS_MaxCellTempCSC = 0xFF;
  1008. BMS_MaxCellTempNum = 0xFF;
  1009. BMS_MinCellTempCSC = 0xFF;
  1010. BMS_MinCellTempNum = 0xFF;
  1011. break;
  1012. case 0x1885D0F3:
  1013. BMS_MaxCellVolt = 0xFFFF;
  1014. BMS_MaxCellVoltCSC = 0xFF;
  1015. BMS_MaxCellVoltNum = 0xFF;
  1016. BMS_AverCellVolt = 0xFFFF;
  1017. break;
  1018. case 0x1886D0F3:
  1019. BMS_MinCellVolt = 0xFFFF;
  1020. BMS_MinCellVoltCSC = 0xFF;
  1021. BMS_MinCellVoltNum = 0xFF;
  1022. BMS_ContChrgCurr = 0xFFFF;
  1023. BMS_ContDisCharCurr = 0xFFFF;
  1024. break;
  1025. case 0x1887D0F3:
  1026. BMS_CharReqVolt = 0xFFFF;
  1027. BMS_CharReqCurr = 0xFFFF;
  1028. BMS_SysInsRes = 0xFFFF;
  1029. BMS_InsDeteSt = 0xFF;
  1030. BMS_FtCharInsLow = 0xFF;
  1031. BMS_FtCurrSenr = 0xFF;
  1032. BMS_FtHeatingFilm = 0xFF;
  1033. BMS_FtMainLoopPreChar = 0xFF;
  1034. BMS_FtAuxLoopPreChar = 0xFF;
  1035. BMS_FtACANLost = 0xFF;
  1036. BMS_FtDCDC = 0xFF;
  1037. BMS_FtSOCDif = 0xFF;
  1038. BMS_FtCellOverDisChar = 0xFF;
  1039. BMS_FtCharOver = 0xFF;
  1040. BMS_FtContDisCharCurrOverLoad = 0xFF;
  1041. BMS_FtContCharCurrOverLoad = 0xFF;
  1042. break;
  1043. case 0x1888D0F3:
  1044. BMS_MaxDisCharPwr = 0xFFFF;
  1045. BMS_MaxCharPwr = 0xFFFF;
  1046. BMS_ContDisCharPwr = 0xFFFF;
  1047. BMS_ContCharPwr = 0xFFFF;
  1048. break;
  1049. case 0x1889D0F3:
  1050. BMS_InstEngyCons = 0xFFFF;
  1051. BMS_TotalEngyCons = 0xFFFF;
  1052. BMS_SOE = 0xFFFF;
  1053. BMS_RmanCharTime = 0xFFFF;
  1054. break;
  1055. case 0x188AD0F3:
  1056. BMS_Gun1DCNegTemp = 0xFF;
  1057. BMS_Gun1DCPosTemp = 0xFF;
  1058. BMS_Gun2DCNegTemp = 0xFF;
  1059. BMS_Gun2DCPosTemp = 0xFF;
  1060. BMS_CurrHeatSt = 0xFF;
  1061. BMS_CurrCoolSt = 0xFF;
  1062. BMS_FtCharCnct = 0xFF;
  1063. BMS_FtOverDisCharCurrDuringChar = 0xFF;
  1064. BMS_FtCharNTC = 0xFF;
  1065. BMS_FtELock = 0xFF;
  1066. BMS_CharNum = 0xFFFF;
  1067. break;
  1068. case 0x18C1D0F3:
  1069. BMS_CellVoltFramNum = 0xFF;
  1070. for (UINT16 i = 0; i < sizeof(BMS_CellVolt) / 2; i++)
  1071. {
  1072. BMS_CellVolt[i] = 0xFFFF;
  1073. }
  1074. break;
  1075. case 0x18C2D0F3:
  1076. BMS_CellTempFramNum = 0xFF;
  1077. BMS_CSC_Code = 0xFF;
  1078. for (UINT8 i = 0; i < sizeof(BMS_CellTemp); i++)
  1079. {
  1080. BMS_CellTemp[i] = 0xFF;
  1081. }
  1082. break;
  1083. case 0x18E1D0F3:
  1084. BMS_Checksum = 0xFF;
  1085. BMS_PackComp = 0xFF;
  1086. BMS_BattCodeLeng = 0xFF;
  1087. BMS_SN[0] = 0xFF;
  1088. BMS_SN[1] = 0xFF;
  1089. BMS_SN[2] = 0xFF;
  1090. BMS_SN[3] = 0xFF;
  1091. BMS_SN[4] = 0xFF;
  1092. BMS_SN[5] = 0xFF;
  1093. break;
  1094. case 0x18E2D0F3:
  1095. BMS_Checksum = 0xFF;
  1096. BMS_SN[6] = 0xFF;
  1097. BMS_SN[7] = 0xFF;
  1098. BMS_SN[8] = 0xFF;
  1099. BMS_SN[9] = 0xFF;
  1100. BMS_SN[10] = 0xFF;
  1101. BMS_SN[11] = 0xFF;
  1102. BMS_SN[12] = 0xFF;
  1103. break;
  1104. case 0x18E3D0F3:
  1105. BMS_Checksum = 0xFF;
  1106. BMS_SN[13] = 0xFF;
  1107. BMS_SN[14] = 0xFF;
  1108. BMS_SN[15] = 0xFF;
  1109. BMS_SN[16] = 0xFF;
  1110. BMS_SN[17] = 0xFF;
  1111. BMS_SN[18] = 0xFF;
  1112. BMS_SN[19] = 0xFF;
  1113. break;
  1114. case 0x18E4D0F3:
  1115. BMS_Checksum = 0xFF;
  1116. BMS_SN[20] = 0xFF;
  1117. BMS_SN[21] = 0xFF;
  1118. BMS_SN[22] = 0xFF;
  1119. BMS_SN[23] = 0xFF;
  1120. BMS_SN[24] = 0xFF;
  1121. BMS_SN[25] = 0xFF;
  1122. BMS_SN[26] = 0xFF;
  1123. break;
  1124. case 0x18E5D0F3:
  1125. BMS_BattRateCap = 0xFFFF;
  1126. BMS_BattRateVolt = 0xFFFF;
  1127. BMS_BattRateEngy = 0xFFFF;
  1128. BMS_BattType = 0xFF;
  1129. BMS_CoolType = 0xFF;
  1130. break;
  1131. case 0x18E6D0F3:
  1132. BMS_CSC_Total = 0xFF;
  1133. // BMS_CellTotal = BMS_CELL_MAX_NUM;
  1134. // BMS_TempTotal = BMS_TEMP_MAX_NUM;
  1135. BMS_CellVoltLevel = 0xFF;
  1136. BMS_CellMinVolt = 0xFF;
  1137. BMS_CellMaxVolt = 0xFF;
  1138. break;
  1139. case 0x18F1D0F3:
  1140. BMS_TotalCharEngy = 0xFFFFFFFF;
  1141. BMS_TotalDisCharEngy = 0xFFFFFFFF;
  1142. BMS_SingleCharEngy = 0xFFFF;
  1143. break;
  1144. case 0x18F2D0F3:
  1145. BMS_TotalBackCharEngy = 0xFFFFFFFF;
  1146. BMS_TotalStaCharEngy = 0xFFFFFFFF;
  1147. break;
  1148. case 0x18F3D0F3:
  1149. BMS_TotalGunCharEngy = 0xFFFFFFFF;
  1150. BMS_TotalGunCharCapy = 0xFFFFFFFF;
  1151. break;
  1152. case 0x18F4D0F3:
  1153. BMS_TotalCharCapy = 0xFFFFFFFF;
  1154. BMS_TotalDisCharCapy = 0xFFFFFFFF;
  1155. BMS_SingleCharCapy = 0xFFFF;
  1156. break;
  1157. case 0x18F5D0F3:
  1158. BMS_TotalBackCharCapy = 0xFFFFFFFF;
  1159. BMS_TotalStaCharCapy = 0xFFFFFFFF;
  1160. BMS_HVBranNum = 0xFF;
  1161. BMS_SingleHVBranchCellNum = 0xFF;
  1162. break;
  1163. case 0x18FF45F4:
  1164. BMS_ReqMode = 0xFF;
  1165. BMS_HVCmd = 0xFF;
  1166. BMS_ChgSts = 0xFF;
  1167. BMS_HVRelaySts = 0xFF;
  1168. BMS_HVVolt = 0xFFFF;
  1169. BMS_SetTemp = 0xFF;
  1170. BMS_Life = 0xFF;
  1171. BMS_CRC = 0xFF;
  1172. break;
  1173. case 0x18FFC13A:
  1174. TMS_WorkStatus = 0xFF;
  1175. TMS_HVRelayST = 0xFF;
  1176. TMS_OutletTemp = 0xFF;
  1177. TMS_InletTemp = 0xFF;
  1178. TMS_ReqPow = 0xFFFF;
  1179. TMS_ErrCode = 0xFF;
  1180. TMS_FaultLevel = 0xFF;
  1181. break;
  1182. default:
  1183. break;
  1184. }
  1185. }
  1186. #endif