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.
已解决! 转到解答。
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:
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
Hi @Andrew101,
Please check if UART0 is gated in the Clocks view, and if the Lpuart component has your clock config correctly assigned:
You can also check the register for the specific clock enable register:
Best regards,
Julián
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:
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