Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
TianYing_ty100
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
TY
TianYing_ty100
Commits
7b12dfa0
Commit
7b12dfa0
authored
Jun 02, 2024
by
张明扬
🇨🇳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:增加2E服务对UUID的写入
parent
cd6f8c18
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
1 deletion
+100
-1
PowerManag_user.c
Firmware/Source/Component/PowerManagement/PowerManag_user.c
+1
-0
UDS_ISO14229_Server.c
Firmware/Source/UDS/UDS_ISO14229_Server.c
+2
-0
UDS_ISO14229_Services.c
Firmware/Source/UDS/UDS_ISO14229_Services.c
+87
-1
UDS_ISO14229_Services.h
Firmware/Source/UDS/UDS_ISO14229_Services.h
+10
-0
No files found.
Firmware/Source/Component/PowerManagement/PowerManag_user.c
View file @
7b12dfa0
...
...
@@ -50,6 +50,7 @@ static void Power_KL30_Init(void)
Can_Init
();
CAN_TX_SetEnable
(
&
CAN_CH0_CanMsgTxOp
,
CAN_N_TX_Enable
);
DFlash_init
();
Data_Read_DiagPara
();
Analog_Signal_Conv_Init
();
BU98R10_Init
();
//Uart0_Init(115200);
...
...
Firmware/Source/UDS/UDS_ISO14229_Server.c
View file @
7b12dfa0
...
...
@@ -213,6 +213,8 @@ void UDS_Process_Service_Request(void)
break
;
case
0x22
:
UDS_Service_22_Indication
(
UDS_APP_RX
.
A_PDU
.
TA_type
,
UDS_APP_RX
.
A_PDU
.
Length
,
UDS_APP_RX
.
A_PDU
.
Data
);
break
;
case
0x2E
:
UDS_Service_2E_Indication
(
UDS_APP_RX
.
A_PDU
.
TA_type
,
UDS_APP_RX
.
A_PDU
.
Length
,
UDS_APP_RX
.
A_PDU
.
Data
);
break
;
case
0x27
:
UDS_Service_27_Indication
(
UDS_APP_RX
.
A_PDU
.
TA_type
,
UDS_APP_RX
.
A_PDU
.
Length
,
UDS_APP_RX
.
A_PDU
.
Data
);
break
;
case
0x28
:
UDS_Service_28_Indication
(
UDS_APP_RX
.
A_PDU
.
TA_type
,
UDS_APP_RX
.
A_PDU
.
Length
,
UDS_APP_RX
.
A_PDU
.
Data
);
...
...
Firmware/Source/UDS/UDS_ISO14229_Services.c
View file @
7b12dfa0
...
...
@@ -43,6 +43,7 @@ DiagSendDataNeg NegRes;
uint8_t
UDS_ISO14229_Transfer
[
250
];
DiagDFlashData
DiagDataForDFlash
;
Ser2EDFlashData
Ser2EDataForDFlash
;
DiagFlag
DiagDataForFlag
;
Ser27_FlowCtrlCntUnion
Ser27_FlowCtrlCnt
;
uint8_t
FlashDriverCheckSum
=
0
;
...
...
@@ -160,6 +161,15 @@ void DFlash_init(void)
}
}
void
Data_Read_DiagPara
(
void
)
{
uint8_t
i
;
Ser2EDFlashData
*
ReadSer2EDataForDFlash
=
(
Ser2EDFlashData
*
)
0x500600ul
;
for
(
i
=
0
;
i
<
32
;
i
++
)
{
Ser2EDataForDFlash
.
DID_F184
[
i
]
=
ReadSer2EDataForDFlash
->
DID_F184
[
i
];
}
}
void
S3_ServerCNTT
(
void
)
{
if
(
Wait10sFlag
==
1
)
...
...
@@ -673,7 +683,7 @@ static const uint8_t Ser22BanResponse = DisableResponseType;
static
const
uint8_t
Ser22Sub
[]
=
{
0xFF
};
static
const
uint8_t
Ser22MinLen
[]
=
{
2
};
static
const
uint8_t
Ser22SubLen
[]
=
{
2
};
static
const
uint16_t
Ser22DIDList
[]
=
{
0xF195
,
0xF193
,
0xF180
,
0xF187
,
0x1024
,
0x1028
};
static
const
uint16_t
Ser22DIDList
[]
=
{
0xF195
,
0xF193
,
0xF180
,
0xF187
,
0x1024
,
0x1028
,
0xF184
};
static
const
uint8_t
Ser22UnlockLevel
[]
=
{
NoNeed
};
static
const
uint8_t
Ser22SupportSession
=
DefaultMode
|
ProgrammingMode
|
ExtendedDiagnosticMode
;
static
const
uint8_t
Ser22SubSupportSession
[]
=
{
DefaultMode
|
ProgrammingMode
|
ExtendedDiagnosticMode
};
...
...
@@ -809,6 +819,14 @@ void UDS_Service_22_Indication(uint16_t A_TA_type, uint16_t A_Length, uint8_t *A
UDS_Service_Response
(
si
,
POSITIVE_RSP
,
DIAG_ID_Tx
,
2
+
8
,
UDS_ISO14229_Transfer
);
break
;
case
0xF184
:
// UUID
for
(
i
=
0
;
i
<
32
;
i
++
)
{
UDS_ISO14229_Transfer
[
i
+
2
]
=
Ser2EDataForDFlash
.
DID_F184
[
i
];
}
UDS_Service_Response
(
0x22
,
POSITIVE_RSP
,
DIAG_ID_Tx
,
2
+
32
,
UDS_ISO14229_Transfer
);
break
;
default:
if
(
FunorPhy
==
DIAG_ID_Rx_FUN
)
{
...
...
@@ -839,6 +857,74 @@ void UDS_Service_22_Indication(uint16_t A_TA_type, uint16_t A_Length, uint8_t *A
}
}
void
UDS_Service_2E_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
)
{
uint16_t
i
;
uint16_t
DID
;
uint8_t
Data
[
8
];
uint8_t
Service2EDiagDataLength
;
uint16_t
FunorPhy
=
0
;
Service2EDiagDataLength
=
A_Length
;
S3_ServerCnt
=
0
;
FunorPhy
=
A_TA_type
;
for
(
i
=
0
;
i
<
Service2EDiagDataLength
;
++
i
)
{
UDS_ISO14229_Transfer
[
i
]
=
*
(
A_Data
+
i
);
}
if
(
FunorPhy
==
0X7DF
)
return
;
if
(
DiagLockFlag
==
0x00
)
{
NegRes
.
code
=
securityAccessDenied
;
//NRC33
UDS_Service_Response
(
0x2E
,
NEGATIVE_RSP
,
DIAG_ID_Tx
,
1
,
(
uint8_t
*
)
(
&
NegRes
.
code
)
);
return
;
}
if
(
Service2EDiagDataLength
<
3
)
{
NegRes
.
code
=
incorrectMessageLength
;
//NRC13
UDS_Service_Response
(
0x2E
,
NEGATIVE_RSP
,
DIAG_ID_Tx
,
1
,
(
uint8_t
*
)
(
&
NegRes
.
code
)
);
return
;
}
if
(
(
SessionType
==
DefaultSession
)
||
(
SessionType
==
ProgrammingSession
))
{
NegRes
.
code
=
serviceNotSupportedInActiveSession
;
//NRC7F
UDS_Service_Response
(
0x2E
,
NEGATIVE_RSP
,
DIAG_ID_Tx
,
1
,
(
uint8_t
*
)
(
&
NegRes
.
code
)
);
return
;
}
DID
=
((
uint16_t
)
UDS_ISO14229_Transfer
[
0
]
<<
8
)
|
((
uint16_t
)
UDS_ISO14229_Transfer
[
1
]);
switch
(
DID
)
{
case
0xF184
:
// 读指纹数据标识符
for
(
i
=
0
;
i
<
33
;
i
++
)
{
Data
[
i
]
=
UDS_ISO14229_Transfer
[
i
+
2
];
}
for
(
i
=
0
;
i
<
(
sizeof
(
Ser2EDataForDFlash
.
DID_F184
));
i
++
)
{
Ser2EDataForDFlash
.
DID_F184
[
i
]
=
Data
[
i
];
}
Ser2EDataForDFlash
.
Flag
=
0x5AA5A77Au
;
// memcpy(Ser2EDataForDFlash.DID_F184, Data, sizeof(Ser2EDataForDFlash.DID_F184));
//擦除扇区
EraseSector
(
0x500600ul
);
//App程序状态和22服务数据全写进去
ProgramPage
(
0x500600ul
,
sizeof
(
Ser2EDataForDFlash
),
(
uint8_t
*
)(
&
Ser2EDataForDFlash
));
UDS_Service_Response
(
0x2E
,
POSITIVE_RSP
,
DIAG_ID_Tx
,
2
,
UDS_ISO14229_Transfer
);
break
;
default:
if
(
FunorPhy
==
0x7df
)
{
return
;
}
NegRes
.
code
=
requestOutOfRange
;
UDS_Service_Response
(
0x2E
,
NEGATIVE_RSP
,
DIAG_ID_Tx
,
1
,
(
uint8_t
*
)
(
&
NegRes
.
code
)
);
break
;
}
}
void
GetSeed
(
void
)
{
uint8_t
SeedHigh
;
...
...
Firmware/Source/UDS/UDS_ISO14229_Services.h
View file @
7b12dfa0
...
...
@@ -347,6 +347,14 @@ typedef struct
uint8_t
Filldata
[
1
];
}
DiagDFlashData
;
extern
DiagDFlashData
DiagDataForDFlash
;
typedef
struct
{
uint32_t
Flag
;
uint8_t
DID_F184
[
32
];
}
Ser2EDFlashData
;
extern
Ser2EDFlashData
Ser2EDataForDFlash
;
typedef
struct
{
uint32_t
Flag
;
...
...
@@ -364,6 +372,7 @@ typedef struct
void
UDS_Service_10_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
);
void
UDS_Service_11_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
);
void
UDS_Service_22_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
);
void
UDS_Service_2E_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
);
void
UDS_Service_27_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
);
void
UDS_Service_28_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
);
void
UDS_Service_3E_Indication
(
uint16_t
A_TA_type
,
uint16_t
A_Length
,
uint8_t
*
A_Data
);
...
...
@@ -389,6 +398,7 @@ uint8_t SerXXNRC7EFilter(const uint8_t *SubSupportSession, uint8_t index);
uint8_t
SerXXNRC7FFilter
(
uint8_t
SupportSession
);
extern
void
Data_Set_DiagPara
(
void
);
void
Write_App_InValid
(
uint32_t
m32
);
void
Data_Read_DiagPara
(
void
);
void
DFlash_init
(
void
);
#endif
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