Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
RT_RMR42E
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
时昊
RT_RMR42E
Commits
e5be831f
Commit
e5be831f
authored
Mar 05, 2025
by
李冠华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:增加仪表CAN信号唤醒功能,优化仪表休眠流程
parent
33e78888
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
9 deletions
+81
-9
Can_User.c
Firmware/Source/Application/CAN_User/Can_User.c
+17
-0
Can_User.h
Firmware/Source/Application/CAN_User/Can_User.h
+2
-1
PowerManag_user.c
Firmware/Source/Component/PowerManagement/PowerManag_user.c
+57
-8
DeepSleep.c
...urce/Device/Cmsemicon/BAT32A239/RTE/DeepSleep/DeepSleep.c
+3
-0
DeepSleep.h
...urce/Device/Cmsemicon/BAT32A239/RTE/DeepSleep/DeepSleep.h
+1
-0
Sys_Task_List.c
Firmware/Source/System/Sys_Task_List.c
+1
-0
No files found.
Firmware/Source/Application/CAN_User/Can_User.c
View file @
e5be831f
...
...
@@ -5,6 +5,8 @@
#include "can.h"
#include "RTE.h"
uint16_t
EnterDeepSleepCount
=
0U
;
__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
];
...
...
@@ -341,6 +343,7 @@ void Can_Tx_Apply_Buff(void)
*/
void
Can_Rx_Cak
(
CanTxRxMsg
*
Msg
)
{
EnterDeepSleepCount
=
0U
;
Co_Can_Buff_Set
(
&
CAN_CH0_CanMsgOp
,
Co_Can_ConvertSubID_CAN_CH0
(
Msg
->
Id
),
Msg
->
DLC
,
Msg
->
Data
);
if
((
Msg
->
Id
==
DIAG_ID_Rx_FUN
)
||
(
Msg
->
Id
==
DIAG_ID_Rx_PHY
))
...
...
@@ -348,6 +351,20 @@ void Can_Rx_Cak(CanTxRxMsg *Msg)
DoCAN_L_Data_Indication
(
Msg
->
Id
,
Msg
->
DLC
,
Msg
->
Data
);
}
}
/*放到哪个任务中调用,就传入time的值是多少,如:100ms任务中就传入100*/
void
CAN_Offline_Count
(
uint8_t
time
)
{
if
(
Get_CAN_Power_State
()
<
KEY_ACC
)
{
EnterDeepSleepCount
+=
time
;
}
else
{
EnterDeepSleepCount
=
0U
;
}
}
/**
* @brief CAN库初始化TX/RX
*
...
...
Firmware/Source/Application/CAN_User/Can_User.h
View file @
e5be831f
...
...
@@ -30,7 +30,7 @@ typedef struct
uint8_t
RecoverTimer
;
}
RSCAN0BusoffMonitorStruct
;
extern
uint16_t
EnterDeepSleepCount
;
extern
void
CAN_TX_Init
(
void
);
extern
void
Can_Tx_Apply_Buff
(
void
);
...
...
@@ -39,6 +39,7 @@ extern void Can_BusOff_Recover(uint8_t deltaTime);
extern
void
COM_CAN_Init
(
void
);
extern
void
Can_Init
(
void
);
extern
void
Can_Rx_Cak
(
CanTxRxMsg
*
Msg
);
extern
void
CAN_Offline_Count
(
uint8_t
time
);
extern
uint8_t
COM_APP_Process
(
st_CAN_Msg
*
Msg
);
extern
void
Can_Write
(
st_CAN_Msg
*
Msg
);
...
...
Firmware/Source/Component/PowerManagement/PowerManag_user.c
View file @
e5be831f
...
...
@@ -71,7 +71,7 @@ static void Power_KL30_Init(void)
g_stRTCInformation
.
u8RTCMonth
=
1
;
g_stRTCInformation
.
u8RTCYear
=
20
;
RTE_RTC_Init
(
g_stRTCInformation
);
RTE_DEEPSLEEP_GPIO_Interrupt_Enable
(
KL15_AD_IN
,
Trigger_Rising
);
//
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN,Trigger_Rising);
Data_Soc_KL30_Init
();
Data_Time_KL30_Init
();
Data_Gear_KL30_Init
();
...
...
@@ -84,6 +84,7 @@ extern uint32_t PowerIgnOffTimeLine;
static
void
Power_Wakeup_Init
(
void
)
{
PowerIgnOffTimeLine
=
0
;
g_u8CanrxSleepstate
=
0U
;
Simulated_IIC_2_Init
();
Gpio_Init
(
Gpio_WakeUp_Init
);
Can_Init
();
...
...
@@ -100,7 +101,7 @@ static void Power_Wakeup_Init(void)
TimerM_PWM_CH_Output_init
(
TIMERM_COUNTER0
,
TIMERM_CHD
,
ActiveLevel_High
);
TimerM_PWM_CH_Output_init
(
TIMERM_COUNTER1
,
TIMERM_CHB
,
ActiveLevel_High
);
Telltales_Init
();
RTE_DEEPSLEEP_GPIO_Interrupt_Enable
(
KL15_AD_IN
,
Trigger_Rising
);
//
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(KL15_AD_IN,Trigger_Rising);
}
static
void
Power_LVP_Init
(
void
)
...
...
@@ -146,7 +147,9 @@ static void Power_Sleep_Init(void)
LED_Driver_Init_Sleep
();
LED_Driver_Service
();
Analog_Signal_Conv_Stop
();
RTE_DEEPSLEEP_Enable
();
// RTE_DEEPSLEEP_Enable();
RTE_DEEPSLEEP_GPIO_Interrupt_Enable
(
CAN_MCU_RXD
,
Trigger_Falling
);
g_u8CanrxSleepstate
=
0U
;
}
static
Power_Status_em
Power_Stay_ON
(
void
)
...
...
@@ -170,8 +173,8 @@ static Power_Status_em Power_Stay_OFF(void)
{
Power_Status_em
u8PowerSts
;
u8PowerSts
=
EM_IGN_OFF
;
if
(
SYS_OPR_STAT_IGN
_ON
)
#if (PART_NUMBER == RMR42E_60)
if
(
Common_Get_IG_Sts
(
)
==
COMMON_POWER
_ON
)
{
u8PowerSts
=
EM_IGN_ON_Init
;
}
...
...
@@ -186,7 +189,38 @@ static Power_Status_em Power_Stay_OFF(void)
// u8PowerSts = EM_IGN_Sleep_Init;
// }
}
#else
if
(
Get_CAN_Power_State
()
==
KEY_ACC
)
{
u8PowerSts
=
EM_IGN_ON_Init
;
}
else
{
if
(
Get_CAN_Power_State
()
==
PKEY_ON
)
{
if
(
EnterDeepSleepCount
>=
5000
)
{
u8PowerSts
=
EM_IGN_Sleep_Init
;
}
else
{
u8PowerSts
=
EM_IGN_OFF
;
}
}
else
{
if
((
Common_GetIgnOffTime
()
<
5000
))
{
u8PowerSts
=
EM_IGN_OFF
;
}
else
{
u8PowerSts
=
EM_IGN_Sleep_Init
;
}
}
}
#endif
return
u8PowerSts
;
}
...
...
@@ -262,7 +296,7 @@ static Power_Status_em Power_Stay_Protect(void)
static
Power_Status_em
Power_Stay_Sleep
(
void
)
{
Power_Status_em
u8PowerSts
=
EM_IGN_Sleep
;
#if (PART_NUMBER == RMR42E_60)
while
(
1
)
{
RTE_WDT_Clear
();
...
...
@@ -272,7 +306,22 @@ static Power_Status_em Power_Stay_Sleep(void)
break
;
}
}
#else
while
(
1
)
{
RTE_WDT_Clear
();
if
((
Get_CAN_Power_State
()
==
PKEY_ON
)
&&
(
g_u8CanrxSleepstate
==
1U
))
/*当电源状态出于PKEY_ON,且接到CAN信号时,才能触发唤醒*/
{
u8PowerSts
=
EM_IGN_Wakeup
;
g_u8CanrxSleepstate
=
0U
;
break
;
}
else
{
RTE_DEEPSLEEP_Enable
();
}
}
#endif
return
u8PowerSts
;
}
...
...
Firmware/Source/Device/Cmsemicon/BAT32A239/RTE/DeepSleep/DeepSleep.c
View file @
e5be831f
...
...
@@ -177,10 +177,13 @@ void DEEPSLEEP_EXTI0_IRQHandler(void *msg)
* @warning None
* @since 1.0.0
*/
unsigned
char
g_u8CanrxSleepstate
=
0U
;
void
DEEPSLEEP_EXTI1_IRQHandler
(
void
*
msg
)
{
/* ����жϱ�־ */
INTC_ClearPendingIRQ
(
INTP1_IRQn
);
g_u8CanrxSleepstate
=
1U
;
}
/**
...
...
Firmware/Source/Device/Cmsemicon/BAT32A239/RTE/DeepSleep/DeepSleep.h
View file @
e5be831f
...
...
@@ -5,6 +5,7 @@
#include "gpio.h"
#include "intp.h"
extern
unsigned
char
g_u8CanrxSleepstate
;
extern
void
RTE_DEEPSLEEP_GPIO_Interrupt_Enable
(
uint16_t
u16Pin
,
Trigger_TypeDef
EXTI_Trigger
);
extern
void
RTE_DEEPSLEEP_Enable
(
void
);
...
...
Firmware/Source/System/Sys_Task_List.c
View file @
e5be831f
...
...
@@ -36,6 +36,7 @@ void Sys_10ms_Tasks(void)
Data_CumulativeWorkHours_EEPROM_Write
();
BackLight_Service
();
Fault_Code_Service
();
CAN_Offline_Count
(
10U
);
}
void
Sys_20ms_Tasks
(
void
)
...
...
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