Hard Fault with Power_Ip_SetMode() Using Predefined Structure on S32K324 Controller

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

Hard Fault with Power_Ip_SetMode() Using Predefined Structure on S32K324 Controller

1,223 Views
Prasad_330
Contributor III

Hello,

I am encountering a hard fault when using the predefined structure Power_Ip_aModeConfigPB[1] (declared in Power_Ip_PBcfg.c) to enter standby mode with the Power_Ip_SetMode() function. However, when I copy the structure and assign it a different name, Power_Ip_aModeConfigPB_1[0], it works as expected.

I am using the S32K324 controller for this setup.

Screenshots of the original structure

Pre-defined structure.png

Screenshots of the modified structure

user defined strcture.png

Screenshots of the function call   

function call.png

Could anyone help me understand why this is happening and how I can resolve this issue?

Thank you in advance!

Tags (1)
0 Kudos
Reply
9 Replies

1,058 Views
Prasad_330
Contributor III

Thanks  Danielmartynek,

The issue was caused by the use of #pragma pack (1), and the problem occurred because I wasn't using the unpack directive in the other folder. The hard fault issue is solved

 

I am trying to use the 'Prepare for Standby' mode just before entering standby, but I have observed that there is little to no difference in current consumption, whether I use it or not. Could you please help me understand why?

 

0 Kudos
Reply

1,029 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Prasad_330,

Have a look at the source code (Power_Ip.c) to see how the modes are called and what they do.

danielmartynek_0-1743691859277.png

 

Regards,

Daniel

 

0 Kudos
Reply

1,198 Views
Prasad_330
Contributor III

Thanks danielmartynek,

 

  • I am trying to watch the content of the predefined structure Power_Ip_aModeConfigPB[1] in the watch window.

  • The values displayed are not as expected:

    • ModeConfigId is defined as 1.

    • PowerMode is defined as POWER_IP_STANDBY_MODE (16).

  • However, in the watch window, the values are different:

    • ModeConfigId shows a value of 16795441.

    • PowerMode shows 268435456.

  • For a user-defined structure, the values match what is defined.

  • I have attached a screenshot for reference.

 

 

Prasad_330_0-1743066834519.png

 

0 Kudos
Reply

1,193 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Which RTD revision is it?

Can you share the .mex file?

 

Thank you

0 Kudos
Reply

1,179 Views
Prasad_330
Contributor III

We are currently using the RTD version S32K3_RTD_3_0_0_P07_D2306_ASR_REL_4_7_REV_0000_20230629. Please find the attached .mex file for your reference.

Tags (1)
0 Kudos
Reply

1,173 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @Prasad_330,

I don't see any .mex file attached.

Also, please confirm the compiler options are set correctly, and provide more information about the fault exception.

 

Thanks,

BR, Daniel

0 Kudos
Reply

1,165 Views
Prasad_330
Contributor III

yes i have missed the attachment

I am sharing the .mex file  

Please find the attachment

Tags (1)
0 Kudos
Reply

1,139 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Prasad_330,

Thanks for the .mex.

I see you disable CM7_0 clock, which is not correct.

danielmartynek_0-1743410484479.png

 

Refer to this thread:

https://community.nxp.com/t5/S32K/S32K344-StangBy-Configuration-Options/m-p/2005542

 

Regards,

Daniel

0 Kudos
Reply

1,207 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Prasad_330,

I don't see any reason for a fault exception in the description you shared, just to be sure, please check all the compiler options in the project - it must be set precisely as per to RTD release notes.

Can you share the configuration of the power mode?

Can you step through the function and locate the fault instruction?

In general, follow these documents to debug the fault exception:

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K312-HARDFAULT-Handling-Interrupt-DS3-5-...

https://community.nxp.com/t5/S32K-Knowledge-Base/How-To-Debug-A-Fault-Exception-On-ARM-Cortex-M-V7M-...

https://community.nxp.com/t5/S32K-Knowledge-Base/Fault-handling-on-S32K14x/ta-p/1114447

 

Best regards,

Daniel

0 Kudos
Reply