AppTaskCan.c 40 KB

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