Hardfault when we are not using debugger in S32K344

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

Hardfault when we are not using debugger in S32K344

跳至解决方案
357 次查看
MVR
Contributor V

Hello everyone,

I'm facing a weird issue. When I run my code in the debug mode, everything works properly (CAN, UART and so on).

But when I remove the debugger and reset the board, I can see that the CAN and other peripherals don't work as I expected.

Then, I attached the debugger activating this option:

MVR_0-1755031791882.png

And I could see that the system reaches the hardfault:

MVR_1-1755032079675.png

Before, I was facing the same issue (with debugger) and I could find out that the problem was the Interrupt Monitor into the Platform_Init(), when I removed this configuration on Tresos 29.0.0 (disable the INTM), I started to get hardfault in this new point into Mcl_Init(), showed below.

Also, I could see that if I commented out the Mcl_init(), I get hardfault as well in the Uart_Init(), in this point:

MVR_3-1755032834466.png

Again, using the system in debug mode, it doesn't happened. Can anyone help me with this problem? 

I could see some topics related this issue and the people saying that HSE_CLK should be CORE_CLK/2, but it is already configured this way:

MVR_2-1755032234658.png

Thank you,

MVR

标记 (3)
0 项奖励
回复
1 解答
302 次查看
Senlent
NXP TechSupport
NXP TechSupport

Hi@MVR

I tested your code, you need to use "MCU_SetMode()" to turn on the peripheral clock, this is the reason for entering hardfault

Senlent_0-1755160640927.png

 

在原帖中查看解决方案

0 项奖励
回复
3 回复数
332 次查看
Senlent
NXP TechSupport
NXP TechSupport

Hi@MVR

"When I run my code in the debug mode, everything works properly (CAN, UART and so on)."

Most of these problems should be related to the clock configuration.

If you can provide a complete project, I can help you check it.

0 项奖励
回复
323 次查看
MVR
Contributor V

Sent you via private message due to confidentiality...

But as soon as we fixed this issue, I will post the solution here to help the community.

Thanks.

0 项奖励
回复
303 次查看
Senlent
NXP TechSupport
NXP TechSupport

Hi@MVR

I tested your code, you need to use "MCU_SetMode()" to turn on the peripheral clock, this is the reason for entering hardfault

Senlent_0-1755160640927.png

 

0 项奖励
回复