Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiancetai
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈家乐
jiancetai
Commits
9271d298
Commit
9271d298
authored
Dec 31, 2025
by
何锐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:CAN转一线通
parent
8c74398e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
295 additions
and
200 deletions
+295
-200
settings.json
.vscode/settings.json
+3
-1
Task.c
YueJin_test_bench/source/Appliciation/Task.c
+0
-8
WMHComm.h
YueJin_test_bench/source/Appliciation/WMHComm.h
+1
-0
WMHCommData.c
YueJin_test_bench/source/Appliciation/WMHCommData.c
+4
-8
WMHCommData.h
YueJin_test_bench/source/Appliciation/WMHCommData.h
+202
-123
RSCAN.c
YueJin_test_bench/source/Driver/CAN/RSCAN.c
+85
-60
No files found.
.vscode/settings.json
View file @
9271d298
...
@@ -79,6 +79,8 @@
...
@@ -79,6 +79,8 @@
"rte_gpio.h"
:
"c"
,
"rte_gpio.h"
:
"c"
,
"task_scheduler.h"
:
"c"
,
"task_scheduler.h"
:
"c"
,
"gpio.h"
:
"c"
,
"gpio.h"
:
"c"
,
"string.h"
:
"c"
"string.h"
:
"c"
,
"mwwmhcomm.h"
:
"c"
,
"wmhcommdata.h"
:
"c"
}
}
}
}
\ No newline at end of file
YueJin_test_bench/source/Appliciation/Task.c
View file @
9271d298
...
@@ -133,7 +133,6 @@ uint8_t *pcan_data = &can_flag;
...
@@ -133,7 +133,6 @@ uint8_t *pcan_data = &can_flag;
uint8_t
test
[
10
]
=
{
0x56
,
0x0B
,
0x0C
,
0x0D
,
0x1
,
0x2
,
0x3
,
0x4
,
0x05
,
0xFF
};
uint8_t
test
[
10
]
=
{
0x56
,
0x0B
,
0x0C
,
0x0D
,
0x1
,
0x2
,
0x3
,
0x4
,
0x05
,
0xFF
};
uint8_t
timee
;
void
Sys_Run_Mode_100ms_Tasks_Group
(
void
)
void
Sys_Run_Mode_100ms_Tasks_Group
(
void
)
{
{
...
@@ -169,13 +168,6 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
...
@@ -169,13 +168,6 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
// testtime = 0;
// testtime = 0;
// }
// }
// General_Number_Disp(test, 100 , 100 );
// General_Number_Disp(test, 100 , 100 );
timee
++
;
if
(
timee
>
10
)
{
WMHCommFramePackedTransmit
(
EM_WMH_COMM_SEND_MSG_ICM_0x90
);
WMHCommFramePackedTransmit
(
EM_WMH_COMM_SEND_MSG_ICM_0x91
);
timee
=
0
;
}
}
}
/*=================================================================*/
/*=================================================================*/
...
...
YueJin_test_bench/source/Appliciation/WMHComm.h
View file @
9271d298
...
@@ -27,6 +27,7 @@ typedef enum {
...
@@ -27,6 +27,7 @@ typedef enum {
// EM_WMH_COMM_SEND_MSG_ICM_0x80 = 0,
// EM_WMH_COMM_SEND_MSG_ICM_0x80 = 0,
EM_WMH_COMM_SEND_MSG_ICM_0x90
=
0
,
EM_WMH_COMM_SEND_MSG_ICM_0x90
=
0
,
EM_WMH_COMM_SEND_MSG_ICM_0x91
,
EM_WMH_COMM_SEND_MSG_ICM_0x91
,
EM_WMH_COMM_SEND_MSG_ICM_0x92
,
EM_WMH_COMM_SEND_MSG_TOTAL
,
EM_WMH_COMM_SEND_MSG_TOTAL
,
}
EM_WMH_COMM_SEND_MSG_T
;
}
EM_WMH_COMM_SEND_MSG_T
;
...
...
YueJin_test_bench/source/Appliciation/WMHCommData.c
View file @
9271d298
...
@@ -34,10 +34,10 @@ void WMHCommFrameCallBack_WiBox_0x91(void)
...
@@ -34,10 +34,10 @@ void WMHCommFrameCallBack_WiBox_0x91(void)
void
WMHCommFrameCallBack_WiBox_0x92
(
void
)
void
WMHCommFrameCallBack_WiBox_0x92
(
void
)
{
{
uint8_t
tmpCond
=
0
;
uint8_t
tmpCond
=
0
;
if
((
WMHCommDataWiBox_0x92
.
bits
.
Inquire
==
0
)
||
(
WMHCommDataWiBox_0x92
.
bits
.
NfcOperate
==
0
))
//
if((WMHCommDataWiBox_0x92.bits.Inquire == 0)||(WMHCommDataWiBox_0x92.bits.NfcOperate == 0 ))
{
//
{
WMHCommFramePackedTransmit
(
EM_WMH_COMM_SEND_MSG_ICM_0x91
);
//
WMHCommFramePackedTransmit(EM_WMH_COMM_SEND_MSG_ICM_0x91);
}
//
}
}
}
void
WMHCommFrameTimeoutFunc_WiBox
(
void
)
void
WMHCommFrameTimeoutFunc_WiBox
(
void
)
...
@@ -74,10 +74,6 @@ void WMHCommFrameCallBack_Icm(void)
...
@@ -74,10 +74,6 @@ void WMHCommFrameCallBack_Icm(void)
// WMHCommDataIcm.bits.Mileage_M = 0x33;
// WMHCommDataIcm.bits.Mileage_M = 0x33;
// WMHCommDataIcm.bits.Mileage_L = 0x44;
// WMHCommDataIcm.bits.Mileage_L = 0x44;
WMHCommDataWiBox_0x90
.
bits
.
Espeed_H
=
0xEE
;
WMHCommDataWiBox_0x90
.
bits
.
Espeed_L
=
0xDD
;
WMHCommDataWiBox_0x91
.
bits
.
SignalStrengthOf4G
=
5
;
// //if(WMHCommDataWiBox_0x92.bits.Inquire == 0x11)
// //if(WMHCommDataWiBox_0x92.bits.Inquire == 0x11)
// {
// {
// if (tmpVal > 9999999) {
// if (tmpVal > 9999999) {
...
...
YueJin_test_bench/source/Appliciation/WMHCommData.h
View file @
9271d298
...
@@ -4,143 +4,218 @@
...
@@ -4,143 +4,218 @@
#define WMH_COMM_PROTOCOL_VERSION 0x2F;
#define WMH_COMM_PROTOCOL_VERSION 0x2F;
#define COMM_DATA_UNION_WI_BOX_LENGTH_0X90 15
/******************************************************* 发送 *******************************************************/
typedef
union
{
/******************************************************* 发送 *******************************************************/
struct
{
#define COMM_DATA_UNION_WI_BOX_LENGTH_0X90 16
uint8_t
ProductModel
:
6
;
//产品型号
typedef
union
uint8_t
ManufacturerCodingRules
:
2
;
//厂家编码规则
{
uint8_t
DeviceEncoding
:
8
;
//设备编码
uint8_t
SerialNumberL
:
8
;
//流水号
uint8_t
FaultStatus
:
1
;
//故障状态
uint8_t
ConstantSpeedStatus
:
1
;
//定速巡航状态
uint8_t
GearPStatus
:
1
;
//P档状态
uint8_t
ReadyStatus
:
1
;
//READY状态
uint8_t
SerialNumberH
:
4
;
//流水号高字节4
uint8_t
EstimateMileage_H
:
8
;
//预估里程
uint8_t
EstimateMileage_L
:
8
;
//预估里程
uint8_t
EnergyConsumption
:
8
;
//能耗系数
uint8_t
Fault8
:
1
;
//电机缺相故障
uint8_t
Fault7
:
1
;
//堵转保护故障
uint8_t
Fault6
:
1
;
//欠压保护故障
uint8_t
Fault5
:
1
;
//转把故障故障
uint8_t
Fault4
:
1
;
//控制器MOS管故障故障
uint8_t
Fault3
:
1
;
//刹车故障故障
uint8_t
Fault2
:
1
;
//电机霍尔故障故障
uint8_t
Fault1
:
1
;
//过压保护故障
uint8_t
Fault16
:
1
;
//电池充电过流保护故障
uint8_t
Fault15
:
1
;
//电池SOC过低故障
uint8_t
Fault14
:
1
;
//电池总压欠压保护故障
uint8_t
Fault13
:
1
;
//电池总压过压保护故障
uint8_t
Fault12
:
1
;
//电池放电MOS故障故障
uint8_t
Fault11
:
1
;
//电池充电MOS故障故障
uint8_t
Fault10
:
1
;
//控制器过热故障
uint8_t
Fault9
:
1
;
//电机过热故障
uint8_t
Reserved3
:
3
;
uint8_t
Fault21
:
1
;
//电池充电过温保护故障
uint8_t
Fault20
:
1
;
//电池充电低温保护故障
uint8_t
Fault19
:
1
;
//电池放电过温保护故障
uint8_t
Fault18
:
1
;
//电池放电低温保护故障
uint8_t
Fault17
:
1
;
//电池放电过流保护故障
uint8_t
Espeed_H
:
8
;
//电机脉冲数
uint8_t
Espeed_L
:
8
;
//电机脉冲数
uint8_t
Electricity
:
8
;
//电量
uint8_t
Reserved5
:
5
;
uint8_t
Fault39
:
1
;
//电池放电过流保护故障
uint8_t
GEAR
:
1
;
//1:S档 0:D档
uint8_t
FaultLED
:
1
;
//故障指示灯
uint8_t
BurglarStatus
:
1
;
//防盗状态
uint8_t
Reserved4
:
4
;
uint8_t
CartStatus
:
1
;
//推车状态
uint8_t
SideBraceStatus
:
1
;
//边撑状态
uint8_t
EBSStatus
:
1
;
//EBS状态
// uint8_t MessageWaittingToAnswer :1;//信息
// uint8_t PhoneWaittingToAnswer :1;//电话
// uint8_t PositFault :1;//定位故障
// uint8_t MasterControlFault :1;//主控故障
// uint8_t BtFault :1;//蓝牙故障
// uint8_t PowerFault :1;//电源故障
// uint8_t ThreeAxisSensorFault :1;//三轴传感器故障
// uint8_t OneServiceFault :1;//一线通故障
// uint8_t NetWorkFault :1;//网络故障
// uint8_t ACCFault :1;//ACC故障
// uint8_t Reserved2 :6;
// uint8_t AntennaFault :1;//天线故障
// uint8_t RfFault :1;//射频故障
//uint8_t EstimateMileage_H :8;//预估里程
//uint8_t EstimateMileage_L :8;//预估里程
}
bits
;
uint8_t
Bytes
[
COMM_DATA_UNION_WI_BOX_LENGTH_0X90
];
uint8_t
Bytes
[
COMM_DATA_UNION_WI_BOX_LENGTH_0X90
];
struct
{
// // ===================== Byte0 =====================
// uint8_t ProductModel :6; // 产品型号
// uint8_t ManufacturerCodingRules :2; // 厂家编码规则
// // ===================== Byte1 =====================
// uint8_t DeviceEncoding :8; // 设备编码
// // ===================== Byte2 =====================
// uint8_t SerialNumberL :8; // 流水号
// // ===================== Byte3 =====================
// uint8_t FaultStatus :1; // 故障状态
// uint8_t ConstantSpeedStatus :1; // 定速巡航状态
// uint8_t GearPStatus :1; // P档状态
// uint8_t ReadyStatus :1; // READY状态
// uint8_t SerialNumberH :4; // 流水号高字节4位
// // ===================== Byte4 =====================
// uint8_t EstimateMileage_H :8; // 预估里程高字节
// // ===================== Byte5 =====================
// uint8_t EstimateMileage_L :8; // 预估里程低字节
// // ===================== Byte6 =====================
// uint8_t EnergyConsumption :8; // 能耗系数
// // ===================== Byte7 =====================
// uint8_t Fault8 :1; // 电机缺相故障
// uint8_t Fault7 :1; // 堵转保护故障
// uint8_t Fault6 :1; // 欠压保护故障
// uint8_t Fault5 :1; // 转把故障
// uint8_t Fault4 :1; // 控制器MOS管故障
// uint8_t Fault3 :1; // 刹车故障
// uint8_t Fault2 :1; // 电机霍尔故障
// uint8_t Fault1 :1; // 过压保护故障
// // ===================== Byte8 =====================
// uint8_t Fault16 :1; // 电池充电过流保护故障
// uint8_t Fault15 :1; // 电池SOC过低故障
// uint8_t Fault14 :1; // 电池总压欠压保护故障
// uint8_t Fault13 :1; // 电池总压过压保护故障
// uint8_t Fault12 :1; // 电池放电MOS故障
// uint8_t Fault11 :1; // 电池充电MOS故障
// uint8_t Fault10 :1; // 控制器过热故障
// uint8_t Fault9 :1; // 电机过热故障
// // ===================== Byte9 =====================
// uint8_t Reserved3 :2; // 预留位3
// uint8_t Fault22 :1; // 电池放电握手失败故障
// uint8_t Fault21 :1; // 电池充电过温保护故障
// uint8_t Fault20 :1; // 电池充电低温保护故障
// uint8_t Fault19 :1; // 电池放电过温保护故障
// uint8_t Fault18 :1; // 电池放电低温保护故障
// uint8_t Fault17 :1; // 电池放电过流保护故障
// // ===================== Byte10 =====================
// uint8_t Espeed_H :8; // 电机脉冲数高字节
// // ===================== Byte11 =====================
// uint8_t Espeed_L :8; // 电机脉冲数低字节
// // ===================== Byte12 =====================
// uint8_t Electricity :8; // 电量
// // ===================== Byte13 =====================
// uint8_t Reserved5 :3; // 预留位5
// uint8_t TCSopen :1; // TCS功能开启
// uint8_t TCSa :1; // TCS动作中
// uint8_t Fault23 :1; // 控制器过流故障
// uint8_t GEAR :1; // 1:S档 0:D档
// uint8_t FaultLED :1; // 故障指示灯
// // ===================== Byte14 =====================
// uint8_t BurglarStatus :1; // 防盗状态
// uint8_t Reserved4 :4; // 预留位4
// uint8_t CartStatus :1; // 推车状态
// uint8_t SideBraceStatus :1; // 边撑状态
// uint8_t EBSStatus :1; // EBS状态
// // ===================== Byte15 =====================
// uint8_t VSpeed :8; // 车速
uint8_t
Data90_Byte1
:
8
;
uint8_t
Data90_Byte2
:
8
;
uint8_t
Data90_Byte3
:
8
;
uint8_t
Data90_Byte4
:
8
;
uint8_t
Data90_Byte5
:
8
;
uint8_t
Data90_Byte6
:
8
;
uint8_t
Data90_Byte7
:
8
;
uint8_t
Data90_Byte8
:
8
;
uint8_t
Data90_Byte9
:
8
;
uint8_t
Data90_Byte10
:
8
;
uint8_t
Data90_Byte11
:
8
;
uint8_t
Data90_Byte12
:
8
;
uint8_t
Data90_Byte13
:
8
;
uint8_t
Data90_Byte14
:
8
;
uint8_t
Data90_Byte15
:
8
;
uint8_t
Data90_Byte16
:
8
;
}
bits
;
}
COMM_DATA_UNION_WI_BOX_0x90
;
}
COMM_DATA_UNION_WI_BOX_0x90
;
extern
COMM_DATA_UNION_WI_BOX_0x90
WMHCommDataWiBox_0x90
;
extern
COMM_DATA_UNION_WI_BOX_0x90
WMHCommDataWiBox_0x90
;
#define COMM_DATA_UNION_WI_BOX_LENGTH_0X91 12
typedef
union
{
struct
{
uint8_t
Year
:
8
;
uint8_t
Month
:
8
;
uint8_t
Day
:
8
;
uint8_t
Hour
:
8
;
uint8_t
Minute
:
8
;
uint8_t
Second
:
8
;
uint8_t
BtDistanceSt
:
1
;
uint8_t
BtConnection
:
1
;
uint8_t
SignalStrengthOf4G
:
3
;
uint8_t
SignalStrengthOfGps
:
3
;
uint8_t
Reserved1
:
6
;
uint8_t
MessageWaittingToAnswer
:
1
;
//信息
uint8_t
PhoneWaittingToAnswer
:
1
;
//电话
uint8_t
PositFault
:
1
;
//定位故障
uint8_t
MasterControlFault
:
1
;
//主控故障
uint8_t
BtFault
:
1
;
//蓝牙故障
uint8_t
PowerFault
:
1
;
//电源故障
uint8_t
ThreeAxisSensorFault
:
1
;
//三轴传感器故障
uint8_t
OneServiceFault
:
1
;
//一线通故障
uint8_t
NetWorkFault
:
1
;
//网络故障
uint8_t
ACCFault
:
1
;
//ACC故障
uint8_t
Reserved2
:
6
;
uint8_t
AntennaFault
:
1
;
//天线故障
uint8_t
RfFault
:
1
;
//射频故障
uint8_t
EstimateMileage_H
:
8
;
//预估里程
uint8_t
EstimateMileage_L
:
8
;
//预估里程
}
bits
;
#define COMM_DATA_UNION_WI_BOX_LENGTH_0X91 12
typedef
union
{
uint8_t
Bytes
[
COMM_DATA_UNION_WI_BOX_LENGTH_0X91
];
uint8_t
Bytes
[
COMM_DATA_UNION_WI_BOX_LENGTH_0X91
];
struct
{
// // ===================== Byte0 =====================
// uint8_t Year :8; // 年
// // ===================== Byte1 =====================
// uint8_t Month :8; // 月
// // ===================== Byte2 =====================
// uint8_t Day :8; // 日
// // ===================== Byte3 =====================
// uint8_t Hour :8; // 小时
// // ===================== Byte4 =====================
// uint8_t Minute :8; // 分钟
// // ===================== Byte5 =====================
// uint8_t Second :8; // 秒
// // ===================== Byte6 =====================
// uint8_t BtDistanceSt :1; // 蓝牙感应距离状态
// uint8_t BtConnection :1; // 蓝牙连接状态
// uint8_t SignalStrengthOf4G :3; // LTE网络信号强度格数(CSQ=0或99→0格,CSQ=1-5→1格,CSQ=6-10→2格,CSQ=11-15→3格,CSQ=16-20→4格,CSQ≥21→5格)
// uint8_t SignalStrengthOfGps :3; // GPS信号连接格数(3颗→0格,4颗→1格,5颗→2格,6颗→3格,≥7颗→4格)
// // ===================== Byte7 =====================
// uint8_t Reserved1 :6; // 预留位1
// uint8_t MessageWaittingToAnswer :1; // 信息待回复
// uint8_t PhoneWaittingToAnswer :1; // 电话待接听
// // ===================== Byte8 =====================
// uint8_t PositFault :1; // 定位故障
// uint8_t MasterControlFault :1; // 主控故障
// uint8_t BtFault :1; // 蓝牙故障
// uint8_t PowerFault :1; // 电源故障
// uint8_t ThreeAxisSensorFault :1; // 三轴传感器故障
// uint8_t OneServiceFault :1; // 一线通故障
// uint8_t NetWorkFault :1; // 网络故障
// uint8_t ACCFault :1; // ACC故障
// // ===================== Byte9 =====================
// uint8_t Reserved2 :6; // 预留位2
// uint8_t AntennaFault :1; // 天线故障
// uint8_t RfFault :1; // 射频故障
// // ===================== Byte10 =====================
// uint8_t EstimateMileage_H :8; // 预估里程高字节
// // ===================== Byte11 =====================
// uint8_t EstimateMileage_L :8; // 预估里程低字节
uint8_t
Data91_Byte1
:
8
;
// 预估里程低字节
uint8_t
Data91_Byte2
:
8
;
// 预估里程低字节
uint8_t
Data91_Byte3
:
8
;
// 预估里程低字节
uint8_t
Data91_Byte4
:
8
;
// 预估里程低字节
uint8_t
Data91_Byte5
:
8
;
// 预估里程低字节
uint8_t
Data91_Byte6
:
8
;
// 预估里程低字节
uint8_t
Data91_Byte7
:
8
;
// 预估里程低字节
uint8_t
Data91_Byte8
:
8
;
// 预估里程低字节
uint8_t
Data91_Byte9
:
8
;
// 预估里程低字节
uint8_t
Data91_Byte10
:
8
;
// 预估里程低字节
uint8_t
Data91_Byte11
:
8
;
// 预估里程低字节
uint8_t
Data91_Byte12
:
8
;
// 预估里程低字节
}
bits
;
}
COMM_DATA_UNION_WI_BOX_0x91
;
}
COMM_DATA_UNION_WI_BOX_0x91
;
extern
COMM_DATA_UNION_WI_BOX_0x91
WMHCommDataWiBox_0x91
;
extern
COMM_DATA_UNION_WI_BOX_0x91
WMHCommDataWiBox_0x91
;
#define COMM_DATA_UNION_WI_BOX_LENGTH_0X92 5
#define COMM_DATA_UNION_WI_BOX_LENGTH_0X92 5
typedef
union
{
typedef
union
struct
{
{
uint8_t
Inquire
:
8
;
//0x00 未查询 0x11查询里程 0x22 查询NFC卡信息
uint8_t
NfcOperate
:
8
;
//0x00 无操作 0x11添卡 0x22 删卡
uint8_t
Card_H
:
8
;
//0x00 (暂不响应) 0x11~0xFF(卡1~卡15)
uint8_t
Card_L
:
8
;
uint8_t
Reserved
:
8
;
}
bits
;
uint8_t
Bytes
[
COMM_DATA_UNION_WI_BOX_LENGTH_0X92
];
uint8_t
Bytes
[
COMM_DATA_UNION_WI_BOX_LENGTH_0X92
];
struct
{
// // ===================== Byte0 =====================
// uint8_t Inquire :8; // 0x00→未查询,0x11→查询里程,~~0x22→查询NFC卡信息~~
// // ===================== Byte1 =====================
// uint8_t Reserved1 :8; // ~~0x00→无操作,0x11→添卡,0x22→删卡~~
// // ===================== Byte2 =====================
// uint8_t Reserved2 :8; // ~~0x00→暂不响应,0x11~0xFF→卡1~卡15~~
// // ===================== Byte3 =====================
// uint8_t Reserved3 :8; // 预留位3
// // ===================== Byte4 =====================
// uint8_t Reserved4 :8; // 预留位4
uint8_t
Data92_Byte1
:
8
;
// 预估里程低字节
uint8_t
Data92_Byte2
:
8
;
// 预估里程低字节
uint8_t
Data92_Byte3
:
8
;
// 预估里程低字节
uint8_t
Data92_Byte4
:
8
;
// 预估里程低字节
uint8_t
Data92_Byte5
:
8
;
// 预估里程低字节
}
bits
;
}
COMM_DATA_UNION_WI_BOX_0x92
;
}
COMM_DATA_UNION_WI_BOX_0x92
;
extern
COMM_DATA_UNION_WI_BOX_0x92
WMHCommDataWiBox_0x92
;
extern
COMM_DATA_UNION_WI_BOX_0x92
WMHCommDataWiBox_0x92
;
#define COMM_DATA_UNION_ICM_LENGTH 13
#define COMM_DATA_UNION_ICM_LENGTH 13
typedef
union
{
typedef
union
{
struct
{
struct
{
...
@@ -166,6 +241,10 @@ typedef union {
...
@@ -166,6 +241,10 @@ typedef union {
}
COMM_DATA_UNION_ICM
;
}
COMM_DATA_UNION_ICM
;
extern
COMM_DATA_UNION_ICM
WMHCommDataIcm
;
extern
COMM_DATA_UNION_ICM
WMHCommDataIcm
;
extern
COMM_DATA_UNION_WI_BOX_0x90
WMHCommDataWiBox_0x90
;
extern
COMM_DATA_UNION_WI_BOX_0x91
WMHCommDataWiBox_0x91
;
extern
COMM_DATA_UNION_WI_BOX_0x92
WMHCommDataWiBox_0x92
;
extern
uint8_t
WMHCommFrameCheckSumFunc
(
uint32_t
ID
,
uint8_t
DLC
,
uint8_t
ProtocolVersion
,
uint8_t
*
data
);
extern
uint8_t
WMHCommFrameCheckSumFunc
(
uint32_t
ID
,
uint8_t
DLC
,
uint8_t
ProtocolVersion
,
uint8_t
*
data
);
extern
void
WMHCommFrameCallBack_WiBox_0x90
(
void
);
extern
void
WMHCommFrameCallBack_WiBox_0x90
(
void
);
...
...
YueJin_test_bench/source/Driver/CAN/RSCAN.c
View file @
9271d298
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
#include "RSCAN.h"
#include "RSCAN.h"
#include "RSCAN_Table.h"
#include "RSCAN_Table.h"
#include "string.h"
#include "string.h"
#include "wmhcommdata.h"
#include "wmhcomm.h"
#define RSCAN_CKSCLK_IPERI2_CLKC 40000000UL
/*PPLLCLK2*/
#define RSCAN_CKSCLK_IPERI2_CLKC 40000000UL
/*PPLLCLK2*/
#define RSCAN_CKSCLK_ICANOSC_CLK_XIN_CAN 8000000UL
/*MainOSC*/
#define RSCAN_CKSCLK_ICANOSC_CLK_XIN_CAN 8000000UL
/*MainOSC*/
...
@@ -796,87 +798,110 @@ void RSCAN0_CH3_Receive(CAN_Frame_st_t *pstCANFrame)
...
@@ -796,87 +798,110 @@ void RSCAN0_CH3_Receive(CAN_Frame_st_t *pstCANFrame)
g_stRSCAN0Config
.
stRSCANCh3
.
pfnRSCANReadMsgCallBack
(
pstCANFrame
->
u32CANID
,
pstCANFrame
->
u8CANLEN
,
pstCANFrame
->
unCANData
.
u8CANData
);
g_stRSCAN0Config
.
stRSCANCh3
.
pfnRSCANReadMsgCallBack
(
pstCANFrame
->
u32CANID
,
pstCANFrame
->
u8CANLEN
,
pstCANFrame
->
unCANData
.
u8CANData
);
}
}
}
}
uint8_t
canData5
[
8
]
=
{
0
};
uint8_t
canData6
[
8
]
=
{
0
};
uint8_t
canData7
[
8
]
=
{
0
};
void
RSCAN0_CH4_Receive
(
CAN_Frame_st_t
*
pstCANFrame
)
void
RSCAN0_CH4_Receive
(
CAN_Frame_st_t
*
pstCANFrame
)
{
{
if
(
g_stRSCAN0Config
.
stRSCANCh4
.
pfnRSCANReadMsgCallBack
)
if
(
g_stRSCAN0Config
.
stRSCANCh4
.
pfnRSCANReadMsgCallBack
)
{
{
g_stRSCAN0Config
.
stRSCANCh4
.
pfnRSCANReadMsgCallBack
(
pstCANFrame
->
u32CANID
,
pstCANFrame
->
u8CANLEN
,
pstCANFrame
->
unCANData
.
u8CANData
);
g_stRSCAN0Config
.
stRSCANCh4
.
pfnRSCANReadMsgCallBack
(
pstCANFrame
->
u32CANID
,
pstCANFrame
->
u8CANLEN
,
pstCANFrame
->
unCANData
.
u8CANData
);
if
(
Diagnosis_banbenhao_flag_
==
1
)
//准备接收第一段数据(软件版本号)
if
(
pstCANFrame
->
u32CANID
==
0x090u
)
{
{
if
(
pstCANFrame
->
u32CANID
==
0x750u
)
canData5
[
0
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
0
];
canData5
[
1
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
1
];
canData5
[
2
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
2
];
canData5
[
3
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
3
];
canData5
[
4
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
4
];
canData5
[
5
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
5
];
canData5
[
6
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
6
];
canData5
[
7
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
7
];
if
(
canData5
[
0
]
==
0x10
)
{
{
/*第一步*/
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte1
=
canData5
[
1
];
canData2
[
0
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
5
];
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte2
=
canData5
[
2
];
canData2
[
1
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
6
];
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte3
=
canData5
[
3
];
canData2
[
2
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
7
];
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte4
=
canData5
[
4
];
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte5
=
canData5
[
5
];
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte6
=
canData5
[
6
];
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte7
=
canData5
[
7
];
}
}
Diagnosis_banbenhao_flag
=
2
;
else
if
(
canData5
[
0
]
==
0x11
)
}
if
(
Diagnosis_banbenhao_flag_
==
2
)
//准备接收第二段数据(软件版本号)
{
if
(
pstCANFrame
->
u32CANID
==
0x750u
)
{
{
/*第二步*/
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte8
=
canData5
[
1
];
if
((
pstCANFrame
->
unCANData
.
u8CANData
[
0
]
==
0x21
)
&&
(
pstCANFrame
->
unCANData
.
u8CANData
[
1
]
==
0x30
))
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte9
=
canData5
[
2
];
{
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte10
=
canData5
[
3
];
memcpy
(
canData1
,
pstCANFrame
->
unCANData
.
u8CANData
,
pstCANFrame
->
u8CANLEN
);
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte11
=
canData5
[
4
];
}
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte12
=
canData5
[
5
];
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte13
=
canData5
[
6
];
for
(
uint8_t
i
=
0
;
i
<
7
;
i
++
)
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte14
=
canData5
[
7
];
{
canData2
[
i
+
3
]
=
canData1
[
i
+
1
];
}
/*第三步*/
canData2
[
10
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
1
];
canData2
[
11
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
2
];
canData2
[
12
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
3
];
canData2
[
13
]
=
0xFF
;
}
}
Diagnosis_banbenhao_flag
=
3
;
else
if
(
canData5
[
0
]
==
0x12
)
{
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte15
=
canData5
[
1
];
WMHCommDataWiBox_0x90
.
bits
.
Data90_Byte16
=
canData5
[
2
];
}
WMHCommFramePackedTransmit
(
EM_WMH_COMM_SEND_MSG_ICM_0x90
);
}
}
if
(
Diagnosis_banbenhao_flag_
==
3
)
//准备接收数据(硬件版本号)
else
if
(
pstCANFrame
->
u32CANID
==
0x091u
)
{
{
if
(
pstCANFrame
->
u32CANID
==
0x750u
)
canData6
[
0
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
0
];
{
canData6
[
1
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
1
];
if
((
pstCANFrame
->
unCANData
.
u8CANData
[
0
]
==
0x10
)
&&
(
pstCANFrame
->
unCANData
.
u8CANData
[
7
]
==
0x46
))
canData6
[
2
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
2
];
{
canData6
[
3
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
3
];
memcpy
(
canData1
,
pstCANFrame
->
unCANData
.
u8CANData
,
pstCANFrame
->
u8CANLEN
);
canData6
[
4
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
4
];
for
(
uint8_t
i
=
0
;
i
<
3
;
i
++
)
canData6
[
5
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
5
];
{
canData6
[
6
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
6
];
canData3
[
i
]
=
canData1
[
i
+
5
];
canData6
[
7
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
7
];
}
}
if
(
canData6
[
0
]
==
0x10
)
{
WMHCommDataWiBox_0x91
.
bits
.
Data91_Byte1
=
canData6
[
1
];
WMHCommDataWiBox_0x91
.
bits
.
Data91_Byte2
=
canData6
[
2
];
WMHCommDataWiBox_0x91
.
bits
.
Data91_Byte3
=
canData6
[
3
];
WMHCommDataWiBox_0x91
.
bits
.
Data91_Byte4
=
canData6
[
4
];
WMHCommDataWiBox_0x91
.
bits
.
Data91_Byte5
=
canData6
[
5
];
WMHCommDataWiBox_0x91
.
bits
.
Data91_Byte6
=
canData6
[
6
];
WMHCommDataWiBox_0x91
.
bits
.
Data91_Byte7
=
canData6
[
7
];
}
}
Diagnosis_banbenhao_flag
=
4
;
else
if
(
canData6
[
0
]
==
0x11
)
{
WMHCommDataWiBox_0x91
.
bits
.
Data91_Byte8
=
canData6
[
1
];
WMHCommDataWiBox_0x91
.
bits
.
Data91_Byte9
=
canData6
[
2
];
WMHCommDataWiBox_0x91
.
bits
.
Data91_Byte10
=
canData6
[
3
];
WMHCommDataWiBox_0x91
.
bits
.
Data91_Byte11
=
canData6
[
4
];
WMHCommDataWiBox_0x91
.
bits
.
Data91_Byte12
=
canData6
[
5
];
}
WMHCommFramePackedTransmit
(
EM_WMH_COMM_SEND_MSG_ICM_0x91
);
}
}
if
(
Diagnosis_banbenhao_flag_
==
4
)
else
if
(
pstCANFrame
->
u32CANID
==
0x092u
)
{
{
if
(
pstCANFrame
->
u32CANID
==
0x750u
)
canData7
[
0
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
0
];
canData7
[
1
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
1
];
canData7
[
2
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
2
];
canData7
[
3
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
3
];
canData7
[
4
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
4
];
canData7
[
5
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
5
];
canData7
[
6
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
6
];
canData7
[
7
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
7
];
if
(
canData7
[
0
]
==
0x10
)
{
{
if
((
pstCANFrame
->
unCANData
.
u8CANData
[
0
]
==
0x21
)
&&
(
pstCANFrame
->
unCANData
.
u8CANData
[
7
]
==
0xAA
))
WMHCommDataWiBox_0x92
.
bits
.
Data92_Byte1
=
canData7
[
1
];
{
WMHCommDataWiBox_0x92
.
bits
.
Data92_Byte2
=
canData7
[
2
];
memcpy
(
canData4
,
pstCANFrame
->
unCANData
.
u8CANData
,
pstCANFrame
->
u8CANLEN
);
WMHCommDataWiBox_0x92
.
bits
.
Data92_Byte3
=
canData7
[
3
];
// for (uint8_t i = 0; i < 6; i++)
WMHCommDataWiBox_0x92
.
bits
.
Data92_Byte4
=
canData7
[
4
];
// {
WMHCommDataWiBox_0x92
.
bits
.
Data92_Byte5
=
canData7
[
5
];
// canData3[i+3] = canData4[i+2];
// }
canData3
[
3
]
=
canData4
[
1
];
canData3
[
4
]
=
canData4
[
2
];
canData3
[
5
]
=
canData4
[
3
];
canData3
[
6
]
=
canData4
[
4
];
canData3
[
7
]
=
canData4
[
5
];
canData3
[
8
]
=
canData4
[
6
];
canData3
[
9
]
=
0XFF
;
}
}
}
WMHCommFramePackedTransmit
(
EM_WMH_COMM_SEND_MSG_ICM_0x92
);
}
}
}
}
}
}
void
RSCAN0_CH5_Receive
(
CAN_Frame_st_t
*
pstCANFrame
)
void
RSCAN0_CH5_Receive
(
CAN_Frame_st_t
*
pstCANFrame
)
{
{
if
(
g_stRSCAN0Config
.
stRSCANCh5
.
pfnRSCANReadMsgCallBack
)
if
(
g_stRSCAN0Config
.
stRSCANCh5
.
pfnRSCANReadMsgCallBack
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment