AppTaskCan.c 39 KB

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