Hardfault problem in S32K344

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Hardfault problem in S32K344

跳至解决方案
373 次查看
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 项奖励
回复
1 解答
309 次查看
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 项奖励
回复
3 回复数
343 次查看
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 项奖励
回复
327 次查看
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 项奖励
回复
310 次查看
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 项奖励
回复