Hardfault problem in S32K344

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

Hardfault problem in S32K344

Jump to solution
1,047 Views
Andrew101
Contributor II

Hello everyone,

I reused an example code named "SIUL2_DIO_Ip_Example_S32K344" and added UART peripheral. However, when I called the init function of UART, the program jumped to hardfault function. I suspect that the clock of this peripherals is not configed correctly but I don't know how to fix it. Besides, does it have any reasons causing to hardfault? Here are some picture of my program. Thanks for your help. 

khanhhuy_0-1760005964705.png

khanhhuy_1-1760006011426.pngkhanhhuy_2-1760006074533.pngkhanhhuy_3-1760006094256.png

 

 

0 Kudos
Reply
1 Solution
983 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Andrew101,

If you have the peripheral's clock gated in the Clocks GUI, the register should be updated to 1 after calling Clock_Ip_Init(). To do it manually, you must add the "Power" component to the project, and individually enable the clocks in the McuPeripheral tab: 

Julin_AragnM_1-1760109825953.png

Julin_AragnM_0-1760109770657.png

After this, you also need to call the initialization and set mode functions:

Power_Ip_Init(&Power_Ip_HwIPsConfigPB);

Power_Ip_SetMode(&Power_Ip_aModeConfigPB[0]);

 

Best regards,
Julián

View solution in original post

0 Kudos
Reply
3 Replies
1,017 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Andrew101,

Please check if UART0 is gated in the Clocks view, and if the Lpuart component has your clock config correctly assigned:

Snag_5acb455.png

Snag_5acfbbe.png

You can also check the register for the specific clock enable register:

Snag_5af5668.png

Best regards,
Julián

0 Kudos
Reply
1,001 Views
Andrew101
Contributor II
Thanks for your answer. When I checked as your guide, actually the clock of this peripheral was not turn on . In this case, I need to turn on it manually by register or do I have a another way?
0 Kudos
Reply
984 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Andrew101,

If you have the peripheral's clock gated in the Clocks GUI, the register should be updated to 1 after calling Clock_Ip_Init(). To do it manually, you must add the "Power" component to the project, and individually enable the clocks in the McuPeripheral tab: 

Julin_AragnM_1-1760109825953.png

Julin_AragnM_0-1760109770657.png

After this, you also need to call the initialization and set mode functions:

Power_Ip_Init(&Power_Ip_HwIPsConfigPB);

Power_Ip_SetMode(&Power_Ip_aModeConfigPB[0]);

 

Best regards,
Julián

0 Kudos
Reply