Unable to keep ICU Mode to sleep because of conflicting with 2 ICU Channels

Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to keep ICU Mode to sleep because of conflicting with 2 ICU Channels

Contributor II

Dear Nxp Support,

I am working with S32K146 controller. I am working on Battery Management System (12v , 4 cells)

I have two ICU Channels configured as below:

1. ICU Channel for CAN Interrupt (PTA12)
2. ICU Channel for NMI Interrupt (PTD3)

Before the ECU goes to sleep, I have following code in "EcuM_McuSetMode"
Icu_EnableWakeup(IcuChannel_Rx); //Enabling the wakeup capability of CAN ICU Channel
Icu_EnableWakeup(IcuChannel_NMI_DI); //Enabling the wakeup capability of NMI ICU Channel
Icu_EnableNotification(IcuChannel_Rx); //Enabling the Notification of CAN ICU Channel
Icu_EnableNotification(IcuChannel_NMI_DI); //Enabling the Notification of NMI ICU Channel
Icu_SetMode(ICU_MODE_SLEEP); // Setting ICU Mode to sleep
Mcu_SetMode(McuMode); // Setting MCU Mode to sleep (VLPS Mode)

After ECU goes to sleep, I am sending Nm Frame and ECU wakes up. Since, the ICU Mode is sleep, it will invoke "EcuM_CheckWakeup" in the API "Icu_ReportWakeupAndOverflow". I have implemented following code in "EcuM_CheckWakeup"
if(wakeupSource == ECUM_WKSOURCE_CAN_2_Cluster)
Mcu_SetMode(McuConf_McuModeSettingConf_McuModeSettingConf_0); // RUN Mode
while (MCU_PLL_LOCKED != Mcu_GetPllStatus());
Icu_SetMode(ICU_MODE_NORMAL); // Keeping the ICU Mode to Normal

After "EcuM_CheckWakeup", the callback notification for CAN Rx Channel is invoking and ECU goes to Full communication. After sometime, the ECU goes to silent Communication and after that it goes to Full Communication and after some time it goes to silent communication and then it goes to No Communication. After then the control will go to "EcuM_GoHalt", and then the control will go to "EcuM_McuSetMode" (It took 20 seconds for the control which will go from Full communication to No Communication).

For Non-Maskable Interrupt (NMI), I need to keep one of the cell voltage from 3.3v to 4.5v to create an interrupt on NMI Pin.
As long as i keep the cell voltage to 4.5v, the ECU will not go to sleep and when i change the cell voltage from 4.5v to 3.3v, the ECU goes to sleep.

when i wakeup through NMI, I have the Following code in "EcuM_CheckWakeup"

if(wakeupSource == ECUM_WKSOURCE_ECUM_WakeupSource_NMI)
while (MCU_PLL_LOCKED != Mcu_GetPllStatus());

I am able to wakeup the ECU with both sending Nm Frame or creating over voltage(NMI) independently.

Now, i have a scenario where i need to wakeup the ECU with sending Nm Frame and creating Over voltage condition (So, the ECU won't go to sleep) and wait for 20 seconds and trigger Nm frame to see the communication.

While doing the above part, when i sent the Nm Frame, ECU wakes up and the control goes to "EcuM_CheckWakeup" since the ICU Mode is sleep. when i create the Over voltage Condition (NMI) the control didn't go to "EcuM_CheckWakeup", because the ICU Mode changes to Normal after wakeup by sending Nm Frame. After 20 seconds, i have sent Nm Frame and the control didn't go to "EcuM_CheckWakeup", because the ICU Mode is still Normal (CAN Communication is not happening after 20 seconds, because the "EcuM_CheckWakeup" didn't get invoke).

I have the following code in ICU Driver

bChWakeupCapable = (ICU_CHANNEL_STATE_WKUP == Icu_GetBitChState (Channel, ICU_CHANNEL_STATE_WKUP)) ? \
(boolean)TRUE : (boolean)FALSE ;
bCrtModeSleep = (ICU_MODE_SLEEP == Icu_CurrentMode)? (boolean)TRUE : (boolean)FALSE ;

if (((boolean)TRUE == bChWakeupCapable) && ((boolean)TRUE == bCrtModeSleep))

Can anyone please provide the solution how to solve the above problem?

1 Reply

NXP Employee
NXP Employee

Hi surya phani teja,

You can use IcuTimestampNotification instead of EcuM_CheckWakeup