AppTaskCan.c 39 KB

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