Hardfault problem in S32K344

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

Hardfault problem in S32K344

Jump to solution
1,063 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
999 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,033 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,017 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
1,000 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
%3CLINGO-SUB%20id%3D%22lingo-sub-2182964%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHardfault%20problem%20in%20S32K344%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2182964%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20everyone%2C%3C%2FP%3E%3CP%3EI%20reused%20an%20example%20code%20named%20%22SIUL2_DIO_Ip_Example_S32K344%22%20and%20%3CSTRONG%3Eadded%20UART%20peripheral%3C%2FSTRONG%3E.%20However%2C%20when%20I%20called%20the%20init%20function%20of%20UART%2C%20the%20program%20jumped%20to%20hardfault%20function.%20I%20suspect%20that%20the%20clock%20of%20this%20peripherals%20is%20not%20configed%20correctly%20but%20I%20don't%20know%20how%20to%20fix%20it.%20Besides%2C%20does%20it%20have%20any%20reasons%20causing%20to%20hardfault%3F%20Here%20are%20some%20picture%20of%20my%20program.%20Thanks%20for%20your%20help.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22khanhhuy_0-1760005964705.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22khanhhuy_0-1760005964705.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360042iE642076423FA68C5%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22khanhhuy_0-1760005964705.png%22%20alt%3D%22khanhhuy_0-1760005964705.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22khanhhuy_1-1760006011426.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22khanhhuy_1-1760006011426.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360043i5A13B054979A308E%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22khanhhuy_1-1760006011426.png%22%20alt%3D%22khanhhuy_1-1760006011426.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22khanhhuy_2-1760006074533.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22khanhhuy_2-1760006074533.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360044i084FE7AEF50F46BF%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22khanhhuy_2-1760006074533.png%22%20alt%3D%22khanhhuy_2-1760006074533.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22khanhhuy_3-1760006094256.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22khanhhuy_3-1760006094256.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360045i24E3FE81EEFD6D26%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22khanhhuy_3-1760006094256.png%22%20alt%3D%22khanhhuy_3-1760006094256.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2183966%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Hardfault%20problem%20in%20S32K344%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2183966%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F254964%22%20target%3D%22_blank%22%3E%40Andrew101%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EIf%20you%20have%20the%20peripheral's%20clock%20gated%20in%20the%20Clocks%20GUI%2C%20the%20register%20should%20be%20updated%20to%201%20after%20calling%20Clock_Ip_Init().%20To%20do%20it%20manually%2C%20you%20must%20add%20the%20%22Power%22%20component%20to%20the%20project%2C%20and%20individually%20enable%20the%20clocks%20in%20the%20McuPeripheral%20tab%3A%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Julin_AragnM_1-1760109825953.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Julin_AragnM_1-1760109825953.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360285iFE54477B443889ED%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Julin_AragnM_1-1760109825953.png%22%20alt%3D%22Julin_AragnM_1-1760109825953.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Julin_AragnM_0-1760109770657.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Julin_AragnM_0-1760109770657.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360284iFB974CCDC8C5C11B%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Julin_AragnM_0-1760109770657.png%22%20alt%3D%22Julin_AragnM_0-1760109770657.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAfter%20this%2C%20you%20also%20need%20to%20call%20the%20initialization%20and%20set%20mode%20functions%3A%3C%2FP%3E%0A%3CDIV%20style%3D%22background-color%3A%20%23ffffff%3B%20padding%3A%200px%200px%200px%202px%3B%22%3E%0A%3CDIV%20style%3D%22color%3A%20%23000000%3B%20background-color%3A%20%23ffffff%3B%20font-family%3A%20'Courier%20New'%3B%20font-size%3A%2010pt%3B%20white-space%3A%20pre%3B%22%3E%0A%3CP%20style%3D%22margin%3A%200%3B%22%3E%3CSPAN%3EPower_Ip_Init(%26amp%3BPower_Ip_HwIPsConfigPB)%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200%3B%22%3E%3CSPAN%3EPower_Ip_SetMode(%26amp%3BPower_Ip_aModeConfigPB%5B0%5D)%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3EBest%20regards%2C%3CBR%20%2F%3EJuli%C3%A1n%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2183585%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Hardfault%20problem%20in%20S32K344%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2183585%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EThanks%20for%20your%20answer.%20When%20I%20checked%20as%20your%20guide%2C%20actually%20the%20clock%20of%20this%20peripheral%20was%20not%20turn%20on%20.%20In%20this%20case%2C%20I%20need%20to%20turn%20on%20it%20manually%20by%20register%20or%20do%20I%20have%20a%20another%20way%3F%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2183220%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Hardfault%20problem%20in%20S32K344%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2183220%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F254964%22%20target%3D%22_blank%22%3E%40Andrew101%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EPlease%20check%20if%20UART0%20is%20gated%20in%20the%20Clocks%20view%2C%20and%20if%20the%20Lpuart%20component%20has%20your%20clock%20config%20correctly%20assigned%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Snag_5acb455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Snag_5acb455.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360094i50C6CFD022BE6563%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Snag_5acb455.png%22%20alt%3D%22Snag_5acb455.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Snag_5acfbbe.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Snag_5acfbbe.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360095iD17E7E7F4D96F7EC%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Snag_5acfbbe.png%22%20alt%3D%22Snag_5acfbbe.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EYou%20can%20also%20check%20the%20register%20for%20the%20specific%20clock%20enable%20register%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Snag_5af5668.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Snag_5af5668.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F360096i029B558D28A08AE6%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Snag_5af5668.png%22%20alt%3D%22Snag_5af5668.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EBest%20regards%2C%3CBR%20%2F%3EJuli%C3%A1n%3C%2FP%3E%3C%2FLINGO-BODY%3E