Commit ec22c3be authored by 李俭双's avatar 李俭双

Merge branch 'dev' into 'release'

Dev

See merge request !111
parents 7147af6d d5d7fac7
......@@ -844,9 +844,9 @@
<FilePath>..\..\..\..\Source\Component\CAN_Signal\CAN_Signal.lib</FilePath>
</File>
<File>
<FileName>eepromManage_TestVersion.lib</FileName>
<FileName>eepromManage_20240926.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\Eeprom\eepromManage_TestVersion.lib</FilePath>
<FilePath>..\..\..\..\Source\Component\Eeprom\eepromManage_20240926.lib</FilePath>
</File>
</Files>
</Group>
......
SET PATH=C:\Keil_v5\ARM\ARMCC\Bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\tyw05\AppData\Local\Microsoft\WindowsApps;
SET ARMCC5_ASMOPT=--diag_suppress=9931
SET ARMCC5_CCOPT=--diag_suppress=9931
SET ARMCC5_LINKOPT=--diag_suppress=9931
SET CPU_TYPE=BAT32G139GK64FB
SET CPU_VENDOR=Cmsemicon
SET UV2_TARGET=TianYing200
......
......@@ -2,7 +2,7 @@
#include "Components.h"
#include "Application.h"
uint16_t CAN_TX_Count = 0;
//uint16_t CAN_TX_Count = 0;
uint16_t AliveCountTimer = 0;
uint8_t Power_KL30_Init_flag = 0;
uint8_t AliveCount_KL30_ResettingFlag = 0;
......@@ -19,7 +19,8 @@ void CAN_TX_Flag_Init(void)
void CAN_TX_Count_Init(void)
{
CAN_TX_Count = 0;
//CAN_TX_Count = 0;
//CAN_Send_Cound = 0;
if(AliveCount_KL30_ResettingFlag > 0)
{
AliveCount_KL30_ResettingFlag = 0;
......
......@@ -9,9 +9,11 @@ __align(4)
uint32_t pRXBuff[CAN_RX_MSG_Block * CAN_CH0_ID_TOTAL_MAX];
uint32_t pTXBuff[CAN_TX_MSG_Block * CAN_CH0_ID_SEND_TOTAL];
static RSCAN0BusoffMonitorStruct RSCAN0Busoff;
uint8_t CAN_Send_Cound = 0;
void Can_Init(void)
{
CAN_Send_Cound = 0;
CAN_TX_Count_Init();
can_config_st_t Can_Config;
Can_Config.ch = CAN_CH_0;
......@@ -317,14 +319,14 @@ void Can_QuickTimer_Init(void)
* @param deltaTime 调用时间 单位ms 10MS调用
*/
uint16_t cjl_cantest = 0;
uint16_t cjl_canflag = 0;
uint16_t CanRxInitflag = 0;
void Can_BusOff_Recover(uint8_t deltaTime)
{
if (get_can_busoff(CAN_CH_0) == 2)
{
cjl_canflag = 1;
CanRxInitflag = 1;
CAN_TX_Count_Init();
CAN_Send_Cound = 0;
if (RSCAN0Busoff.Status == RSCAN0_BUS_STABLE)
{
RSCAN0Busoff.Status = RSCAN0_BUS_OFF_LV1;
......@@ -347,6 +349,7 @@ void Can_BusOff_Recover(uint8_t deltaTime)
}
//需调用CAN中止函数,中止所有硬件buf内要发送的数据
CAN_TX_Count_Init();
CAN_Send_Cound = 0;
Can_QuickTimer_Init();
reset_busoff(CAN_CH_0);
}
......@@ -360,6 +363,7 @@ void Can_BusOff_Recover(uint8_t deltaTime)
RSCAN0Busoff.Timer = 0U;
//需调用CAN中止函数,中止所有硬件buf内要发送的数据
CAN_TX_Count_Init();
CAN_Send_Cound = 0;
Can_QuickTimer_Init();
reset_busoff(CAN_CH_0);
}
......@@ -379,9 +383,9 @@ void Can_BusOff_Recover(uint8_t deltaTime)
RSCAN0Busoff.Timer = 0;
RSCAN0Busoff.Cnt = 0;
}
if(cjl_canflag == 1)
if(CanRxInitflag == 1)
{
cjl_canflag = 0;
CanRxInitflag = 0;
Can_RX_Apply_Buff();
}
}
......@@ -397,9 +401,8 @@ uint8_t Get_Busoff_Status(void)
{
return get_can_busoff(CAN_CH_0);
}
//extern uint8_t Can_341_Flg;
//extern uint8_t Can_580Send_flag;
uint8_t CAN_Send_Cound = 0;
extern uint8_t Tpms_TX_Flag;
uint8_t COM_APP_Process(st_CAN_Msg *Msg)
......
......@@ -41,5 +41,5 @@ extern void Can_Rx_Cak(CanTxRxMsg *Msg);
extern void Busoff(void);
extern uint8_t COM_APP_Process(st_CAN_Msg *Msg);
extern void Can_Write(st_CAN_Msg *Msg);
extern uint8_t CAN_Send_Cound;
#endif
......@@ -66,7 +66,7 @@ typedef struct __attribute__((aligned(4)))
extern uint32_t Get_Current_FaultCode(void);
//extern uint8_t Get_FaultCode_Valid(void);
extern void FaultCode_Init(void);
uint8_t List_Init(FaultCodeList_t *CodeList, uint32_t Arr[], uint8_t Len);
void FaultCode_Servers(void);
......
......@@ -35,9 +35,31 @@ void eeprom_comm_DelayUs(ee_uint32_t time)
EE_FeedDog();
for (i = 0; i < dalayCnt; i++)
{
EE_NOP();
//EE_NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
__NOP();
}
EE_FeedDog();
//EE_FeedDog();
}
/*-------------------------------------------------------------------------
......@@ -50,7 +72,8 @@ void eeprom_comm_DelayUs(ee_uint32_t time)
--------------------------------------------------------------------------*/
void EE_SDA_InConfig(void)
{
RTE_GPIO_Config(EE_SDA, RTE_GPIO_DIR_IN);
//RTE_GPIO_Config(EE_SDA, RTE_GPIO_DIR_IN);
PORT->PM6 |= (1<<1);
}
/*-------------------------------------------------------------------------
* Function Name : EE_SDA_OutConfig
......@@ -62,7 +85,8 @@ void EE_SDA_InConfig(void)
--------------------------------------------------------------------------*/
void EE_SDA_OutConfig(void)
{
RTE_GPIO_Config(EE_SDA, RTE_GPIO_DIR_OUT);
//RTE_GPIO_Config(EE_SDA, RTE_GPIO_DIR_OUT);
PORT->PM6 &= ~(1<<1);
}
/*-------------------------------------------------------------------------
* Function Name : EE_SDA_GetValue
......@@ -90,7 +114,16 @@ ee_uint8_t EE_SDA_GetValue(void)
void EE_SDA_OUT(ee_uint8_t data)
{
// RTE_GPIO_Config(EE_SDA, RTE_GPIO_DIR_OUT | data);
RTE_GPIO_Set_Level(EE_SDA, data);
//RTE_GPIO_Set_Level(EE_SDA, data);
if(data)
{
PORT->P6 |= (1<<1);
}
else
{
PORT->P6 &= ~(1<<1);
}
}
/*-------------------------------------------------------------------------
......@@ -103,7 +136,8 @@ void EE_SDA_OUT(ee_uint8_t data)
--------------------------------------------------------------------------*/
void EE_SCL_OutConfig(void)
{
RTE_GPIO_Config(EE_SCL, RTE_GPIO_DIR_OUT);
//RTE_GPIO_Config(EE_SCL, RTE_GPIO_DIR_OUT);
PORT->PM6 &= ~(1<<0);
}
/*-------------------------------------------------------------------------
* Function Name : EE_SCL_OUT
......@@ -116,7 +150,16 @@ void EE_SCL_OutConfig(void)
void EE_SCL_OUT(ee_uint8_t data)
{
// RTE_GPIO_Config(EE_SCL, RTE_GPIO_DIR_OUT | data);
RTE_GPIO_Set_Level(EE_SCL, data);
//RTE_GPIO_Set_Level(EE_SCL, data);
if(data)
{
PORT->P6 |= (1<<0);
}
else
{
PORT->P6 &= ~(1<<0);
}
}
/*-------------------------------------------------------------------------
......
......@@ -4,6 +4,7 @@
#include "Components.h"
__align(4)
#define CLEAR_EE_LEN 16
#define BACK_MENU_TIME 1500
_Menu_Infor MenuInfor;
_Menu_Data MenuData;
......@@ -38,7 +39,9 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode
if (Common_GetIgnOnTime() >= 3030)
{
Key_Left_Long_Press();
TYW_RESET_ODO();
}
Key_Clear_Time();
break;
case KEY_EVENT_LONG_PRESS_1: //7
......@@ -84,7 +87,7 @@ void Key_Operation_Left(Key_Event_en_t enKeyEvent)//Mode
Tpms_TX_Flag = 0;
}
TYW_RESET_ODO();
// TYW_RESET_ODO();
}
Key_Clear_Time();
break;
......@@ -511,8 +514,8 @@ void MenuData_TCS_Init(void)
uint8_t ClearODO_Flag = 0;
void TYW_RESET_ODO(void)
{
uint8_t Clear_EE[4] = {0xff, 0xff, 0xff, 0xff};
uint8_t Clear_EE_8[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
uint8_t Clear_EE[CLEAR_EE_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
//uint8_t Clear_EE_8[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
if(Common_Get_IG_Sts( ) == COMMON_POWER_ON)
{
if(ClearODO_Flag < 1)
......@@ -522,16 +525,16 @@ void TYW_RESET_ODO(void)
ClearODO_Flag = 1;
Data_Mileage_Clear();
Service_Interval_First_Reset( ); /*保养*/
eeprom_WriteRecord(EEPROM_BLOCK_00, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_01, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_02, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_03, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_04, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_05, ( uint8_t * )&Clear_EE_8, 8);
eeprom_WriteRecord(EEPROM_BLOCK_06, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_07, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_08, ( uint8_t * )&Clear_EE, 4);
eeprom_WriteRecord(EEPROM_BLOCK_09, ( uint8_t * )&Clear_EE, 4);
//eeprom_WriteRecord(EEPROM_BLOCK_00, ( uint8_t * )&Clear_EE, CLEAR_EE_LEN);
//eeprom_WriteRecord(EEPROM_BLOCK_01, ( uint8_t * )&Clear_EE, CLEAR_EE_LEN);
//eeprom_WriteRecord(EEPROM_BLOCK_02, ( uint8_t * )&Clear_EE, CLEAR_EE_LEN);
//eeprom_WriteRecord(EEPROM_BLOCK_03, ( uint8_t * )&Clear_EE, CLEAR_EE_LEN);
//eeprom_WriteRecord(EEPROM_BLOCK_04, ( uint8_t * )&Clear_EE, CLEAR_EE_LEN);
//eeprom_WriteRecord(EEPROM_BLOCK_05, ( uint8_t * )&Clear_EE, CLEAR_EE_LEN);
eeprom_WriteRecord(EEPROM_BLOCK_06, ( uint8_t * )&Clear_EE, CLEAR_EE_LEN);
eeprom_WriteRecord(EEPROM_BLOCK_07, ( uint8_t * )&Clear_EE, CLEAR_EE_LEN);
eeprom_WriteRecord(EEPROM_BLOCK_08, ( uint8_t * )&Clear_EE, CLEAR_EE_LEN);
eeprom_WriteRecord(EEPROM_BLOCK_09, ( uint8_t * )&Clear_EE, CLEAR_EE_LEN);
}
}
}
......
......@@ -37,9 +37,9 @@ Platform_16Bit
typedef enum
{
EM_TRIP_A,
EM_TRIP_B,
EM_TRIP_C,
EM_TRIP_D,
//EM_TRIP_B,
//EM_TRIP_C,
//EM_TRIP_D,
EM_TRIP_MAX,
} DataTripEnum_t;
......
......@@ -6,8 +6,12 @@ uint8_t DataODOBuf[Data_MEM_Block_ODO];
uint8_t DataTripBuf[Data_MEM_Block_Trip * EM_TRIP_MAX];
Mileage_t g_WriteMileage;
Mileage_t g_ReadMileage;
uint8_t odo_writeState;
uint8_t odo_readState;
uint16_t odo_writeState;
uint16_t odoclr_writeState;
uint16_t trip_writeState;
uint16_t trip_readState;
uint16_t odo_readState;
//uint8_t odo_readState;
uint32_t Milleage_InitFlag = 0U;
/******************************************************************************
Function:Data_ODO_KL30Init
......@@ -31,9 +35,9 @@ void Data_User_Mileage_KL30Init(void)
if (TempBuf[0] == 0xFFFFFFFF)
{
MileInit.Mileage = 0u;
}
else
{
}
else
{
MileInit.Mileage = TempBuf[0];
}
Func.Get_Sys_IG_Sts = Common_Get_IG_Sts;
......@@ -63,7 +67,7 @@ void Data_User_Mileage_KL30Init(void)
ODOInit.MaxValue = 1999990;
Data_ODO_KL30_Init(DataODOBuf, &ODOInit, Func.EEPromWrite_Cbk);
(void)Data_User_EEPROM_Read(EM_TRIP_BLOCK, TempBuf + 3, 4);
(void)Data_User_EEPROM_Read(EM_TRIP_BLOCK, TempBuf + 3, 2);
if (TempBuf[3] == 0XFFFFFFFF)
{
TripInit[EM_TRIP_A].Stamp = 0;
......@@ -84,21 +88,21 @@ void Data_User_Mileage_KL30Init(void)
TripInit[EM_TRIP_A].MaxValue = 9999; /* 最大999.9km 进行复位 */
TripInit[EM_TRIP_A].IsRestart = 1u;
TripInit[EM_TRIP_B].Stamp = 0xFFFFFFFFu;
TripInit[EM_TRIP_B].MaxValue = 99999;
TripInit[EM_TRIP_B].IsRestart = 1u;
TripInit[EM_TRIP_C].Stamp = 0xFFFFFFFFu;
TripInit[EM_TRIP_C].MaxValue = 99999;
TripInit[EM_TRIP_C].IsRestart = 1u;
TripInit[EM_TRIP_D].Stamp = 0xFFFFFFFFu;
TripInit[EM_TRIP_D].MaxValue = 99999;
TripInit[EM_TRIP_D].IsRestart = 1u;
//TripInit[EM_TRIP_B].Stamp = 0xFFFFFFFFu;
//TripInit[EM_TRIP_B].MaxValue = 99999;
//TripInit[EM_TRIP_B].IsRestart = 1u;
//
//TripInit[EM_TRIP_C].Stamp = 0xFFFFFFFFu;
//TripInit[EM_TRIP_C].MaxValue = 99999;
//TripInit[EM_TRIP_C].IsRestart = 1u;
//
//TripInit[EM_TRIP_D].Stamp = 0xFFFFFFFFu;
//TripInit[EM_TRIP_D].MaxValue = 99999;
//TripInit[EM_TRIP_D].IsRestart = 1u;
Data_Trip_KL30_Init(DataTripBuf, TripInit, EM_TRIP_MAX, Func.EEPromWrite_Cbk);
//Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TempBuf, 1u);
eeprom_ReadRecord(EEPROM_BLOCK_08, (uint8_t *)TempBufUser, 1);
eeprom_ReadRecord(EEPROM_BLOCK_08, (uint8_t *)TempBufUser, 1);
if (TempBufUser[0u] == 0xFF)
{
MenuData.Tcs_Val = 1;
......@@ -107,7 +111,7 @@ void Data_User_Mileage_KL30Init(void)
}
//Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, TempBuf, 1u);
eeprom_ReadRecord(EEPROM_BLOCK_09, (uint8_t *)TempBufUser, 2);
eeprom_ReadRecord(EEPROM_BLOCK_09, (uint8_t *)TempBufUser, 2);
if (TempBufUser[0u] == 0xFF)
{
TPMSLearn[0] = 0;//MenuData.TPMS_Front_Learn;
......@@ -145,6 +149,7 @@ uint32_t Get_MileageInit_Status(void)
uint32_t Data_User_EEPROM_Read(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len)
{
uint16_t timeout = 0;
switch (u16BlockID)
{
case EM_MILEAGE_BLOCK:
......@@ -153,12 +158,41 @@ uint32_t Data_User_EEPROM_Read(uint16_t u16BlockID, uint32_t u32Data[], uint16_t
break;
case EM_ODO_BLOCK:
eeprom_ReadRecord(EEPROM_BLOCK_01, (uint8_t *)u32Data, u16Len * 4);
timeout = 0;
odo_readState = eeprom_ReadRecord(EEPROM_BLOCK_01, (uint8_t *)u32Data, u16Len * 4);
while(odo_readState != WRITE_COMPLETE)
{
//eeprom_comm_DelayUs(5000);
odo_readState = eeprom_ReadRecord(EEPROM_BLOCK_01, (uint8_t *)u32Data, u16Len * 4);
timeout++;
if(odo_readState == WRITE_COMPLETE)
{
break;
}
if(timeout >= 3)
{
break;
}
}
break;
case EM_TRIP_BLOCK:
eeprom_ReadRecord(EEPROM_BLOCK_03, (uint8_t *)u32Data, u16Len * 4);
timeout = 0;
odo_readState = eeprom_ReadRecord(EEPROM_BLOCK_03, (uint8_t *)u32Data, u16Len * 4);
while(odo_readState != WRITE_COMPLETE)
{
//eeprom_comm_DelayUs(5000);
odo_readState = eeprom_ReadRecord(EEPROM_BLOCK_03, (uint8_t *)u32Data, u16Len * 4);
timeout++;
if(odo_readState == WRITE_COMPLETE)
{
break;
}
if(timeout >= 3)
{
break;
}
}
break;
// case EM_Maintenance_BLOCK:
......@@ -186,7 +220,7 @@ uint32_t Data_User_EEPROM_Read(uint16_t u16BlockID, uint32_t u32Data[], uint16_t
void Data_User_EEPROM_Write(Data_EEPROM_Enum_t BlockID, uint32_t u32Data[], uint16_t u16Len)
{
// uint8_t i = 0u;
uint8_t timeout = 0;
switch (BlockID)
{
case EM_MILEAGE_BLOCK:
......@@ -203,11 +237,41 @@ uint32_t Data_User_EEPROM_Read(uint16_t u16BlockID, uint32_t u32Data[], uint16_t
break;
case EM_ODO_BLOCK:
eeprom_WriteRecord(EEPROM_BLOCK_01, (uint8_t *)u32Data, u16Len * 4);
timeout = 0;
odoclr_writeState = eeprom_WriteRecord(EEPROM_BLOCK_01, (uint8_t *)u32Data, u16Len * 4);
while(odoclr_writeState != WRITE_COMPLETE)
{
//eeprom_comm_DelayUs(5000);
odoclr_writeState = eeprom_WriteRecord(EEPROM_BLOCK_01, (uint8_t *)u32Data, u16Len * 4);
timeout++;
if(odoclr_writeState == WRITE_COMPLETE)
{
break;
}
if(timeout >= 3)
{
return;
}
}
break;
case EM_TRIP_BLOCK:
eeprom_WriteRecord(EEPROM_BLOCK_03, (uint8_t *)u32Data, u16Len * 4);
timeout = 0;
trip_writeState = eeprom_WriteRecord(EEPROM_BLOCK_03, (uint8_t *)u32Data, u16Len * 4);
while(trip_writeState != WRITE_COMPLETE)
{
//eeprom_comm_DelayUs(5000);
trip_writeState = eeprom_WriteRecord(EEPROM_BLOCK_03, (uint8_t *)u32Data, u16Len * 4);
timeout++;
if(trip_writeState == WRITE_COMPLETE)
{
break;
}
if(timeout >= 3)
{
return;
}
}
break;
// case EM_Maintenance_BLOCK:
......
......@@ -108,6 +108,7 @@ static void Power_KL30_Init(void)
extern uint32_t PowerIgnOffTimeLine;
static void Power_Wakeup_Init(void)
{
CAN_Send_Cound = 0;
PowerIgnOffTimeLine = 0;
//RTE_CLOCK_Select_Start();
Gpio_Init(Gpio_WakeUp_Init);
......
......@@ -52,31 +52,42 @@ static void Service_Interval_Write_EEProm(uint32_t u32Data [], uint16_t u16Len)
{
ee_uint16_t tmpWritestatus = 0;
ee_uint16_t Cnt = 0;
ee_uint16_t TimeOut = 0;
tmpWritestatus = eeprom_WriteRecord(EEPROM_BLOCK_05, (uint8_t *)u32Data, u16Len * 4);
while(tmpWritestatus == WRITING)
while(tmpWritestatus != WRITE_COMPLETE)
{
//eeprom_comm_DelayUs(5000);
tmpWritestatus = eeprom_WriteRecord(EEPROM_BLOCK_05, (uint8_t *)u32Data, u16Len * 4);
Cnt++;
if(Cnt >= 1000)
TimeOut++;
if(tmpWritestatus == WRITE_COMPLETE)
{
break;
}
if(TimeOut >= 3)
{
return;
}
}
}
static void Service_Interval_Read_EEProm(uint32_t u32Data [], uint16_t u16Len)
{
ee_uint16_t tmpReadstatus = 0;
ee_uint16_t Cnt = 0;
ee_uint16_t TimeOut = 0;
tmpReadstatus = eeprom_ReadRecord(EEPROM_BLOCK_05, (uint8_t *)u32Data, u16Len * 4);
while(tmpReadstatus == READING)
while(tmpReadstatus != WRITE_COMPLETE)
{
//eeprom_comm_DelayUs(5000);
tmpReadstatus = eeprom_ReadRecord(EEPROM_BLOCK_05, (uint8_t *)u32Data, u16Len * 4);
Cnt++;
if(Cnt >= 1000)
TimeOut++;
if(tmpReadstatus == WRITE_COMPLETE)
{
break;
}
if(TimeOut >= 3)
{
return;
}
}
}
......
......@@ -51,21 +51,21 @@ __align(4)
const LED_Attribute_st LED_Attribute [ LED_Max ] = {
/* 指示灯索引 是否自检 外部信号自检 工作电源状态 自检开始时间 自检持续时间 指示灯点亮条件 指示灯执行函数 */
{em_LED_High_Beam, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_High_Beam_Judgement, LED_High_Beam_Execution},
{em_LED_FAULT_ELECTROSPRAY, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_FAULT_ELECTROSPRAY_Judgement, LED_FAULT_ELECTROSPRAY_Execution},
{em_LED_ABS, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_ABS_Judgement, LED_ABS_Execution},
{em_LED_Oil_Pressure, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Oil_Pressure_Judgement, LED_Oil_Pressure_Execution},
{em_LED_Fuel, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Fuel_Judgement, LED_Fuel_Execution},
{em_LED_Coolant, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Coolant_Judgement, LED_Coolant_Execution},
{em_LED_Bluetooth, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Bluetooth_Judgement, LED_Bluetooth_Execution},
{em_LED_TCS, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_TCS_Judgement, LED_TCS_Execution},
{em_LED_Auto_Start_Stop, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Auto_Start_Judgement, LED_Auto_Start_Execution},
{em_LED_High_Beam, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3030ul, LED_High_Beam_Judgement, LED_High_Beam_Execution},
{em_LED_FAULT_ELECTROSPRAY, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3030ul, LED_FAULT_ELECTROSPRAY_Judgement, LED_FAULT_ELECTROSPRAY_Execution},
{em_LED_ABS, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3030ul, LED_ABS_Judgement, LED_ABS_Execution},
{em_LED_Oil_Pressure, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3030ul, LED_Oil_Pressure_Judgement, LED_Oil_Pressure_Execution},
{em_LED_Fuel, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3030ul, LED_Fuel_Judgement, LED_Fuel_Execution},
{em_LED_Coolant, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3030ul, LED_Coolant_Judgement, LED_Coolant_Execution},
{em_LED_Bluetooth, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3030ul, LED_Bluetooth_Judgement, LED_Bluetooth_Execution},
{em_LED_TCS, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3030ul, LED_TCS_Judgement, LED_TCS_Execution},
{em_LED_Auto_Start_Stop, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3030ul, LED_Auto_Start_Judgement, LED_Auto_Start_Execution},
//{em_LED_Keys, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Keys_Judgement, LED_Keys_Execution},
{em_LED_Maintain, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Maintain_Judgement, LED_Maintain_Execution},
{em_LED_Low_Batt_Vol, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Low_Batt_Judgement, LED_Low_Batt_Execution},
{em_LED_Lateral_Strut, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Lateral_Strut_Judgement, LED_Lateral_Strut_Execution},
{em_LED_Maintain, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3030ul, LED_Maintain_Judgement, LED_Maintain_Execution},
{em_LED_Low_Batt_Vol, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3030ul, LED_Low_Batt_Judgement, LED_Low_Batt_Execution},
{em_LED_Lateral_Strut, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3030ul, LED_Lateral_Strut_Judgement, LED_Lateral_Strut_Execution},
#if(IC_Current == TY200_080000b_ty)
{em_LED_Tire_Pressure_Alarm, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Tire_Pressure_Judgement, LED_Tire_Pressure_Execution},
{em_LED_Tire_Pressure_Alarm, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3030ul, LED_Tire_Pressure_Judgement, LED_Tire_Pressure_Execution},
#endif
//{em_LED_Navigator, SelfCheck, NoExterNalCheck, LED_IGN_ON, 0u, 3000ul, LED_Navigato_Judgement, LED_Navigato_Execution},
......
......@@ -103,7 +103,96 @@ void sci_error_log_internal(int8_t err, const char *file, int32_t line)
/* Do nothing. */
}
}
#if 1
/**
* @brief Calculate the register setting options for baud rate to UART peripheral.
* @param fclk_freq: System clock value on chip.
* @param baud: The target baud rate which want to setting.
* @param pValue: UART baud rate setting option data structure.
* @param cur_sps: current SPS register value, clock sharing it with other channels, Try not to modify it as much as possible.
* if 'cur_sps = 0x00' or 'cur_sps = FORCE_RECONF', Ignore the original register value and force reconfiguration. laidi
* @retval None
*/
float SCIPeriphal_ClockUpdate(SCIAFSelect_TypeDef func, uint32_t fclk, uint32_t ftclk, uint8_t cur_sps, SCIPeriph_Clock_TypeDef *clock)
{
#define CALCULATE_MAX_SPS 0x0F
#define CALCULATE_MAX_SDR 0x7F
#define FORCE_RECONF 0xFF
uint8_t i;
uint8_t min_sdr, max_sps;
uint32_t cal_fmck = 0;
int16_t idea_sdr;
uint8_t sdr_int;
uint16_t max_err = 0xFFFF, temp_err = 0xFFFF;
float ret_err = 100.0;
if(ftclk == 0)
{
return ret_err;
}
if (func & SCI_UART_MASK)
{
min_sdr = 2;
}
else if (func & SCI_I2C_MASK)
{
min_sdr = 1;
}
else
{
min_sdr = 0;
}
if ((cur_sps == 0x00) || (cur_sps == FORCE_RECONF))
{
max_sps = CALCULATE_MAX_SPS + 1;
}
else
{
clock->sps = cur_sps;
max_sps = 1; /* for (i..) loop once */
}
for (i = 0; i < max_sps; i++)
{
/* cac fMCK, SPS reg*/
if ((cur_sps == 0x00) || (cur_sps == FORCE_RECONF))
{
cal_fmck = fclk / sps_tab[i];
}
else
{
i = cur_sps;
cal_fmck = fclk / sps_tab[cur_sps];
}
/* cal_ftclk = cal_fmck /2 /(SDR[15:9]+1), data scaled up 100 times for calculations.*/
idea_sdr = ((cal_fmck >> 1) *100) / ftclk;
if((idea_sdr > (min_sdr*100 +50)) && (idea_sdr < (CALCULATE_MAX_SDR*100 +50)))
{
sdr_int = (idea_sdr + 50)/100;
temp_err = abs((sdr_int * 100) - idea_sdr) * 10000 / idea_sdr;
if(temp_err < max_err)
{
clock->sps = i;
clock->sdr = sdr_int - 1;
max_err = temp_err;
}
if(max_err == 0)
{
return (float)0.0;
}
}
}
ret_err = max_err /(float)100.0;
return ret_err;
}
#endif
#if 0
/**
* @brief Calculate the register setting options for baud rate to UART peripheral.
* @param fclk_freq: System clock value on chip.
......@@ -167,6 +256,7 @@ float SCIPeriphal_ClockUpdate(SCIAFSelect_TypeDef func, uint32_t fclk, uint32_t
return max_err;
}
#endif
/**
* @brief This function is aimed to check sci unit and its channel is used or not
* @param func: The AF function for SCI channel periphal.
......
......@@ -3,6 +3,7 @@
#include "isr.h"
#include "rte_can.h"
CANBuffList_t CanBufList = {0};
CANMSG_Type* CANMSG;
CanTxRxMsg CAN_RecvMsg;
......
......@@ -45,4 +45,5 @@ extern uint8_t rte_can_deinit(CAN_CH ch);
extern uint8_t get_can_busoff(CAN_CH ch);
extern uint8_t reset_busoff(CAN_CH ch);
extern uint8_t Read_RingBuff(CanTxRxMsg *data);
extern void Can_Rx_Cak(CanTxRxMsg *Msg);
#endif /* RTE_CAN_H_ */
......@@ -312,13 +312,13 @@
#define CheckSumErr 7 // Checksum Error
#define UnknownPartID 8 // Unknown Part ID
#define SWV 0x124 // 0x100 = 1.00 software version 软件版本号
#define SWV 0x125 // 0x100 = 1.00 software version 软件版本号
#define HWV 0x103 // 0x100 = 1.00 hardware version 硬件版本号
#define BTV 0x100 // 0x100 = 1.00 bootloader version boot程序版本号
#define INTLV 0x124 // 0x100 = 1.00 internal version 内部版本号
#define INTLV 0x125 // 0x100 = 1.00 internal version 内部版本号
#define PROG_Y 0x24 // 0x24 = 2024年, program year
#define PROG_M 0x09 // 0x03 = 3月, program month
#define PROG_D 0x21 // 0x19 = 19日, program day
#define PROG_M 0x10 // 0x03 = 3月, program month
#define PROG_D 0x08 // 0x19 = 19日, program day
/******************************************************************************
Bootloader Variable
......
This diff is collapsed.
#new Option
#Wed Aug 21 15:17:41 CST 2024
#Tue Oct 08 13:59:37 CST 2024
IsSort=true
MergeFlashIsCompression=false
ChangeAppFilePath=
......@@ -7,7 +7,7 @@ MergeCanXLSPath=
RH850_D1M1AGPIOJSONpath=
DBFFilePath=
MergeCrcTtpe=21
MergeBootFilePath=D\:\\Git\\\u5929\u9E70\\tianying_ty100\\Firmware\\utility\\Boot_Release\\TY200.080000b(ty)\\TY_TY200.080000b(ty)_Boot_B1.04_240820.hex
MergeBootFilePath=D\:\\git\\temp\\tianying_ty100\\Firmware\\utility\\Boot_Release\\TY200.080000b(ty)\\TY_TY200.080000b(ty)_Boot_B1.06_240920.hex
IsMergeChangeAddress=false
MergeFlashOutPutFilePath=
GPIOOutPutPath=
......@@ -30,7 +30,7 @@ AppUpdateFilePath=
FUNID=7DF
IsMergeCreateBin=false
IsOverWrite=false
DllFilePath=D\:\\Git\\\u5929\u9E70\\tianying_ty100\\Firmware\\utility\\\u8BCA\u65AD\u5DE5\u5177\\\u89E3\u9501\u6587\u4EF6\\TY100 x64.dll
DllFilePath=
MergeAudioOutPutPath=
MergeCanOutPutPath=
ChangeOutPutFilePath=
......@@ -56,8 +56,8 @@ IsHexDisplay=true
MergeLineInXLSPath=
MergeFlashInPutFilePath=
MergeFlashIsInternal=false
MergeOutPutFilePath=D\:\\Git\\\u5929\u9E70\\tianying_ty100\\Firmware\\utility\\\u7A0B\u5E8F\u91CA\u653E\\20240821
MergeAppFilePath=D\:\\Git\\\u5929\u9E70\\tianying_ty100\\Firmware\\utility\\\u7A0B\u5E8F\u91CA\u653E\\20240821\\TianYing.hex
MergeOutPutFilePath=D\:\\git\\temp\\tianying_ty100\\Firmware\\utility\\\u7A0B\u5E8F\u91CA\u653E
MergeAppFilePath=D\:\\git\\temp\\tianying_ty100\\Firmware\\Project\\Cmsemicon\\BAT32A239\\MDK_ARM\\Objects\\TianYing.hex
MergeTelltalesXLSPath=
FillingByte=-86
ImageVersion=0
......
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