Commit 5e7728d9 authored by 李茂军's avatar 李茂军

Merge branch 'ZMY' into 'dev'

增加2E服务写入UUID、增大STmin、 修改28服务释放的逻辑、增加BOOT文件

See merge request !26
parents 169bc477 6097f4ab
...@@ -50,6 +50,7 @@ static void Power_KL30_Init(void) ...@@ -50,6 +50,7 @@ static void Power_KL30_Init(void)
Can_Init(); Can_Init();
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable); CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);
DFlash_init(); DFlash_init();
Data_Read_DiagPara();
Analog_Signal_Conv_Init(); Analog_Signal_Conv_Init();
BU98R10_Init(); BU98R10_Init();
Uart0_Init(115200); Uart0_Init(115200);
...@@ -100,6 +101,8 @@ static void Power_Wakeup_Init(void) ...@@ -100,6 +101,8 @@ static void Power_Wakeup_Init(void)
Gpio_Init(Gpio_WakeUp_Init); Gpio_Init(Gpio_WakeUp_Init);
Can_Init(); Can_Init();
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable); CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);
DFlash_init();
Data_Read_DiagPara();
eeprom_StoreInfo_Init(); eeprom_StoreInfo_Init();
Analog_Signal_Conv_Init(); Analog_Signal_Conv_Init();
Data_User_Mileage_WakeupInit(); Data_User_Mileage_WakeupInit();
...@@ -163,6 +166,8 @@ static void Power_IG_ON_Init(void) ...@@ -163,6 +166,8 @@ static void Power_IG_ON_Init(void)
BlueTooth_KL30_KL15_Wakeup_Init(); BlueTooth_KL30_KL15_Wakeup_Init();
Data_TPMS_KL15_WAKE_UP_Init(); Data_TPMS_KL15_WAKE_UP_Init();
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable); CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);
DFlash_init();
Data_Read_DiagPara();
} }
static void Power_Sleep_Init(void) static void Power_Sleep_Init(void)
......
...@@ -716,7 +716,16 @@ void DoCAN_Receive_Flow_Control(void) ...@@ -716,7 +716,16 @@ void DoCAN_Receive_Flow_Control(void)
values 1,10,20,30,40,50 and 60. values 1,10,20,30,40,50 and 60.
-------------------------------------------------------*/ -------------------------------------------------------*/
if ( TpCtrl.Process != TP_TX_CTS ) if ( TpCtrl.Process != TP_TX_CTS )
TpCtrl.STmin = TransportRxData.N_PDU_FC.N_PCI.STmin; {
if(TransportRxData.N_PDU_FC.N_PCI.STmin == 0)
{
TpCtrl.STmin = 1;
}
else
{
TpCtrl.STmin = TransportRxData.N_PDU_FC.N_PCI.STmin;
}
}
/*------------------------------------------------------- /*-------------------------------------------------------
Request a service where the response requires more than Request a service where the response requires more than
......
...@@ -213,6 +213,8 @@ void UDS_Process_Service_Request(void) ...@@ -213,6 +213,8 @@ void UDS_Process_Service_Request(void)
break; 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); 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; 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); 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; 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); 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);
......
...@@ -43,6 +43,7 @@ DiagSendDataNeg NegRes; ...@@ -43,6 +43,7 @@ DiagSendDataNeg NegRes;
uint8_t UDS_ISO14229_Transfer[250]; uint8_t UDS_ISO14229_Transfer[250];
DiagDFlashData DiagDataForDFlash; DiagDFlashData DiagDataForDFlash;
Ser2EDFlashData Ser2EDataForDFlash;
DiagFlag DiagDataForFlag; DiagFlag DiagDataForFlag;
Ser27_FlowCtrlCntUnion Ser27_FlowCtrlCnt; Ser27_FlowCtrlCntUnion Ser27_FlowCtrlCnt;
uint8_t FlashDriverCheckSum = 0; uint8_t FlashDriverCheckSum = 0;
...@@ -160,6 +161,15 @@ void DFlash_init(void) ...@@ -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) void S3_ServerCNTT(void)
{ {
if ( Wait10sFlag == 1 ) if ( Wait10sFlag == 1 )
...@@ -189,6 +199,8 @@ void S3_ServerCNTT(void) ...@@ -189,6 +199,8 @@ void S3_ServerCNTT(void)
if ( S3_ServerCnt >= S3_SERVER ) if ( S3_ServerCnt >= S3_SERVER )
{ {
DIAG_InitParameter( ); DIAG_InitParameter( );
CAN_RX_SetEnable(&CAN_CH0_CanMsgOp, CAN_N_RX_Enable);
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);//S3超时解除
} }
else else
{ {
...@@ -451,6 +463,9 @@ void UDS_Service_10_Indication(uint16_t A_TA_type, uint16_t A_Length, uint8_t *A ...@@ -451,6 +463,9 @@ void UDS_Service_10_Indication(uint16_t A_TA_type, uint16_t A_Length, uint8_t *A
S3_ServerEN = 0; S3_ServerEN = 0;
SessionType = DefaultSession; SessionType = DefaultSession;
DIAG_InitParameter(); DIAG_InitParameter();
CAN_RX_SetEnable(&CAN_CH0_CanMsgOp, CAN_N_RX_Enable);
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);//切会话解除
if (AbleResponseType == Ser10BanResponse) if (AbleResponseType == Ser10BanResponse)
{ {
...@@ -673,7 +688,7 @@ static const uint8_t Ser22BanResponse = DisableResponseType; ...@@ -673,7 +688,7 @@ static const uint8_t Ser22BanResponse = DisableResponseType;
static const uint8_t Ser22Sub [] = {0xFF}; static const uint8_t Ser22Sub [] = {0xFF};
static const uint8_t Ser22MinLen [] = {2}; static const uint8_t Ser22MinLen [] = {2};
static const uint8_t Ser22SubLen [] = {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 Ser22UnlockLevel [] = {NoNeed};
static const uint8_t Ser22SupportSession = DefaultMode | ProgrammingMode | ExtendedDiagnosticMode; static const uint8_t Ser22SupportSession = DefaultMode | ProgrammingMode | ExtendedDiagnosticMode;
static const uint8_t Ser22SubSupportSession [] = {DefaultMode | ProgrammingMode | ExtendedDiagnosticMode}; static const uint8_t Ser22SubSupportSession [] = {DefaultMode | ProgrammingMode | ExtendedDiagnosticMode};
...@@ -809,6 +824,14 @@ void UDS_Service_22_Indication(uint16_t A_TA_type, uint16_t A_Length, uint8_t *A ...@@ -809,6 +824,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); UDS_Service_Response(si, POSITIVE_RSP, DIAG_ID_Tx, 2 + 8, UDS_ISO14229_Transfer);
break; 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: default:
if (FunorPhy == DIAG_ID_Rx_FUN) if (FunorPhy == DIAG_ID_Rx_FUN)
{ {
...@@ -839,6 +862,74 @@ void UDS_Service_22_Indication(uint16_t A_TA_type, uint16_t A_Length, uint8_t *A ...@@ -839,6 +862,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) void GetSeed(void)
{ {
uint8_t SeedHigh; uint8_t SeedHigh;
......
...@@ -347,6 +347,14 @@ typedef struct ...@@ -347,6 +347,14 @@ typedef struct
uint8_t Filldata[1]; uint8_t Filldata[1];
}DiagDFlashData; }DiagDFlashData;
extern DiagDFlashData DiagDataForDFlash; extern DiagDFlashData DiagDataForDFlash;
typedef struct
{
uint32_t Flag;
uint8_t DID_F184[32];
} Ser2EDFlashData;
extern Ser2EDFlashData Ser2EDataForDFlash;
typedef struct typedef struct
{ {
uint32_t Flag; uint32_t Flag;
...@@ -364,6 +372,7 @@ typedef struct ...@@ -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_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_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_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_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_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); 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); ...@@ -389,6 +398,7 @@ uint8_t SerXXNRC7EFilter(const uint8_t *SubSupportSession, uint8_t index);
uint8_t SerXXNRC7FFilter(uint8_t SupportSession); uint8_t SerXXNRC7FFilter(uint8_t SupportSession);
extern void Data_Set_DiagPara(void); extern void Data_Set_DiagPara(void);
void Write_App_InValid(uint32_t m32); void Write_App_InValid(uint32_t m32);
void Data_Read_DiagPara(void);
void DFlash_init(void); void DFlash_init(void);
#endif #endif
----2024/05/10---- ----2024/05/10----
BOOT文件V1.0 BOOT文件V1.0
文件名:TianYing_TY200.080000b_Boot_B1.00_240513.hex 文件名:TianYing_TY200.080000b_Boot_B1.00_240513.hex
变更内容:BOOT文件出版提交 变更内容:BOOT文件出版提交
\ No newline at end of file
----2024/06/02----
BOOT文件V1.0
文件名:TY_TY200.080000b_Boot_B1.01_240602.hex
变更内容:、
1、由于硬件较慢,连续帧发不出来,增加连续帧的延时,增大STmin
2、修改内部版本号
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment