S32K312 CAN Wakeup Using ICU Channel

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32K312 CAN Wakeup Using ICU Channel

2,994件の閲覧回数
harsh_95
Contributor II

Hi,

Micro: S32K312

We are using ICU Channel as a Wakeup unit for CAN. Attaching the ICU Channel configuration.

As per our understanding, ICU Channel will invoke the interrupt when there is a CAN Message (voltage change detected on ICU Channel) and below sequence of Functions will get executed.

Icu_ReportWakeupAndOverflow()
EcuM_CheckWakeup(WkpSource);
Icu_CheckWakeup(WkpSource);
Ecum_SetWakeupEvent();
etc.....

Problem:
We are able to generate the interrupt on ICU Wakeup channel configured as a Wakeup Capable once we send NM Message. We could execute  the Icu_ReportWakeupAndOverflow(); also, but we are not able to Execute Ecum_CheckWakeup(); because the channel state is always  ICU_CHANNEL_STATE_IDLE (we are making ICU Mode to sleep while triggering sleep for ECU)As the channel state is Idle, and the ICU Mode is Sleep, the condition is getting invalid to execute EcuM_CheckWakeup();


Please go through the below Executing sequence once we receive the interrupt for ICU:

harsh_95_0-1733310259278.pngharsh_95_1-1733310300089.pngharsh_95_2-1733310456395.png

Please find the below screen shot for ICU Channel configuration:

harsh_95_3-1733310613875.pngharsh_95_4-1733310630543.pngharsh_95_5-1733310651492.pngharsh_95_6-1733310673868.pngharsh_95_7-1733310692715.pngharsh_95_8-1733310710096.png

harsh_95_9-1733310737852.png

 






 

0 件の賞賛
返信
11 返答(返信)

2,911件の閲覧回数
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @harsh_95,

Are you able to share your main.c to see if all of the configurations shown in the picture are done correctly? 

Just keep in mind that the EcuM_CheckWakeup function is a function stub only. You need to have enabled the respective module (in this case ICU) for the function to work correctly (or call Icu_CheckWakeup directly)

I have also sent you a private message through the community.

Julin_AragnM_1-1733784955887.png

Best regards,
Julián

0 件の賞賛
返信

2,842件の閲覧回数
harsh_95
Contributor II

HI Julian, 

Thank you very much for the quick response. I went through your comments and the demo project you shared. 

Point -1 Unfortunately, I will not be able to share the code for main.c, but we are just calling EcuM_Init() in the main() which will initialize all my peripherals and OS. (This is executing properly).

Point-2 We have enabled the EcuM module and calling Icu_Checkwakeup() inside EcuM_CheckWakeup(). But the problem is we are not able to trigger the EcuM_CheckWakeup when there is a ICU Wakeup Event. (because the channel state is RUNNING which is not allowing to call EcuM_CheckWakeup())

One more Point which I would like to know,

Will the Functional reset happen automatically while waking up after going to Normal Standby Mode for the Microcontroller? 
Because I see many posts where they are referring as FastStandBy Mode and providing the address of Reset handler (Same as example code). But no idea on how the microcontroller behavior will be after Normal Standby mode.


0 件の賞賛
返信

2,833件の閲覧回数
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @harsh_95,

Point-2 I believe this comes from the AUTOSAR specification since it is established that the function can be called from a wakeup ISR, but the K3 family shares the same ISR for all of the wakeup sources:

Julin_AragnM_0-1734554951643.png

Julin_AragnM_1-1734554987279.png

You can call the EcuM_CheckWakeup in the fast standby user defined boot address, so it is the first thing after exiting standby:

Julin_AragnM_2-1734555079329.png

 

Let me check the functionality with EcuM module for checking wakeup sources with the internal application team, I will get back with you as soon as I get an answer.

Point-3 You can refer to the previous picture. After normal standby exit, a functional reset will be asserted and the MCU will run the reset handler back into the main code. When using fast standby exit will skip sBAF and HSE initialization and will run a user defined boot address so you can handle higher priority wakeup sources.

You can find some examples for this in these community posts: 

Best regards,
Julián 

0 件の賞賛
返信

2,816件の閲覧回数
harsh_95
Contributor II

Hi Julian,

Appreciate your quick support

Regarding Point 2, we could able to resolve the issue after invoking the proper Sleep and wakeup sequence of ICU. So now we are able to call the EcuM_CheckWakeup() whenever there is a wakeup interrupt detected.

Regarding Point 3: As you mentioned -> After normal standby exit, a functional reset will be asserted and the MCU will run the reset handler back into the main code. 


I have a 2 Questions on Point 3:


1) Who will do the Functional Reset? Is it done by Microcontroller by Itself after wakeup or we have to trigger it explicitly after wakeup? (In our case, We are not observing any Functional reset after wakeup, so we are not able to come to main(), which is a main pain point for us).

2) If we have to trigger the Functional reset after wakeup, where should we call the reset handler? (As in our Case we are waking up by ICU channel capable of wakeup)

Note: We went through the demo code which you have shared, but  I couldn't find any procedure for Normal Wakeup (Let me know incase if I am missing anything) . Though it was helpful and I could understand the Fast Standby Exit procedure.

0 件の賞賛
返信

2,797件の閲覧回数
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @harsh_95,

After normal standby exit, the MCU performs a reset. If using fast standby exit, you can implement a reset handler after your user defined boot address, as shown in the bottom of the following image:

Julin_AragnM_0-1734621053925.png

Best regards,
Julián

0 件の賞賛
返信

2,766件の閲覧回数
harsh_95
Contributor II

HI Julian,

Thanks for the quick support.

As of now, the Microcontroller is not doing any Rest while waking up. Even the control is not going to bootloader also.  Instead, the control is in application and it starts the normal communication.

But, We have observed that while waking up, sometimes we go into OS_Endlessloop() because of OS_CORTEXM_EX_SYS_TICK exception. The behavior is sporadic. 

Tricks we tried:

1) Changed the OS timer from STM0 to PIT2.
2) Validated the OS priorities.

If you can help us on what can be the reason for this exception. Below is the screen shots of the function where exception is occurred.

harsh_95_1-1734696775642.png

 

harsh_95_0-1734696758381.png

 

0 件の賞賛
返信

2,756件の閲覧回数
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @harsh_95,

Could you clarify if you are using fast standby exit? If so, you need to implement the reset handler as shown in my previous response. 

0 件の賞賛
返信

2,714件の閲覧回数
harsh_95
Contributor II

Hi Julian, 

Yes, we are using Fast standby exit.  Below are the configuration screen shot. The problem we are facing is we are not able to jump to the configured Boot base address. 

As per the configured Boot base address, we were trying to jump to application after wakeup, but we are not able to. (Just for understanding as of now, we are trying to jump to main(),  but we want to jump to reset handler)

We are using bootloader and Application.

Let me know incase the configuration parameter needs to be corrected. 

harsh_95_2-1734962191849.png

harsh_95_0-1734962085715.png

harsh_95_1-1734962117247.png

 

 

0 件の賞賛
返信

2,660件の閲覧回数
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @harsh_95,

Is there a reason you need to do a fast standby exit then? If you need to go into a reset handler after wakeup, and no other important process needs to happen in-between, you can simply do a normal standby exit which will trigger a functional reset without having to specify a boot address.

Please test the example projects so you can understand the functionality of wakeup. The normal standby exit procedure will proceed with a reset sequence (initialize HSE if installed) and will start back in main.

Best regards,
Julián

0 件の賞賛
返信

2,638件の閲覧回数
harsh_95
Contributor II

HI Julian,

There is no specific reason to do FastWakeup. But the problem is during normal Standby exit, we don't see functional reset is getting triggered. That's the reason we thought to look for an alternative to trigger the reset after wakeup and we tried with FastStandby.

We are trying to find why the functional reset is not getting triggered by MCU after wakeup. (FYI- We don't have HSE).

Verified the demo project also, but that also is not working. Not sure where we are missing the link.

0 件の賞賛
返信

2,601件の閲覧回数
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @harsh_95,

Is this custom hardware? Or have you tested the projects in the S32K312-EVB? If the example code is not working, it could point to hardware issues. If it is tested with the EVB, make sure the jumpers are configured correctly.

You can follow the Hardware Design Guidelines under the HW Design Package.

Best regards,
Julián.

0 件の賞賛
返信