Hardfault when we are not using debugger in S32K344

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

Hardfault when we are not using debugger in S32K344

跳至解决方案
480 次查看
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 解答
425 次查看
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 回复数
455 次查看
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 项奖励
回复
446 次查看
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 项奖励
回复
426 次查看
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 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-2151143%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%9C%A8%20S32K344%20%E4%B8%AD%E4%B8%8D%E4%BD%BF%E7%94%A8%E8%B0%83%E8%AF%95%E5%99%A8%E6%97%B6%E5%87%BA%E7%8E%B0%E7%A1%AC%E6%95%85%E9%9A%9C%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2151143%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E5%A4%A7%E5%AE%B6%E5%A5%BD%3C%2FP%3E%3CP%3E%E6%88%91%E9%81%87%E5%88%B0%E4%BA%86%E4%B8%80%E4%B8%AA%E5%A5%87%E6%80%AA%E7%9A%84%E9%97%AE%E9%A2%98%E3%80%82%E5%9C%A8%E8%B0%83%E8%AF%95%E6%A8%A1%E5%BC%8F%E4%B8%8B%E8%BF%90%E8%A1%8C%E4%BB%A3%E7%A0%81%E6%97%B6%EF%BC%8C%E4%B8%80%E5%88%87%E6%AD%A3%E5%B8%B8%EF%BC%88CAN%E3%80%81UART%20%E7%AD%89%EF%BC%89%E3%80%82%3C%2FP%3E%3CP%3E%E4%BD%86%E6%98%AF%E5%BD%93%E6%88%91%E5%8D%B8%E4%B8%8B%E8%B0%83%E8%AF%95%E5%99%A8%E5%B9%B6%20RESET%20%E6%9D%BF%E6%97%B6%EF%BC%8C%E6%88%91%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%88%B0%20CAN%20%E5%92%8C%E5%85%B6%E4%BB%96%E5%A4%96%E5%9B%B4%E8%AE%BE%E5%A4%87%E6%B2%A1%E6%9C%89%E6%8C%89%E6%88%91%E7%9A%84%E9%A2%84%E6%9C%9F%E5%B7%A5%E4%BD%9C%E3%80%82%3C%2FP%3E%3CP%3E%E7%84%B6%E5%90%8E%EF%BC%8C%E6%88%91%E8%BF%9E%E6%8E%A5%E4%BA%86%E8%B0%83%E8%AF%95%E5%99%A8%EF%BC%8C%E6%BF%80%E6%B4%BB%E4%BA%86%E8%AF%A5%E9%80%89%E9%A1%B9%EF%BC%9A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22MVR_0-1755031791882.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MVR_0-1755031791882.png%22%20style%3D%22width%3A%20381px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F352056i59F2F809534D1AE0%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22MVR_0-1755031791882.png%22%20alt%3D%22MVR_0-1755031791882.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E6%88%91%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%88%B0%E7%B3%BB%E7%BB%9F%E8%BE%BE%E5%88%B0%E4%BA%86%E7%A1%AC%E6%95%85%E9%9A%9C%EF%BC%9A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22MVR_1-1755032079675.png%22%20style%3D%22width%3A%20449px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MVR_1-1755032079675.png%22%20style%3D%22width%3A%20449px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F352059i8E44BE09F33A891C%2Fimage-dimensions%2F449x98%3Fv%3Dv2%22%20width%3D%22449%22%20height%3D%2298%22%20role%3D%22button%22%20title%3D%22MVR_1-1755032079675.png%22%20alt%3D%22MVR_1-1755032079675.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E4%BB%A5%E5%89%8D%EF%BC%8C%E6%88%91%E9%81%87%E5%88%B0%E4%BA%86%E5%90%8C%E6%A0%B7%E7%9A%84%E9%97%AE%E9%A2%98%EF%BC%88%E4%BD%BF%E7%94%A8%E8%B0%83%E8%AF%95%E5%99%A8%EF%BC%89%EF%BC%8C%E6%88%91%E5%8F%91%E7%8E%B0%E9%97%AE%E9%A2%98%E5%87%BA%E5%9C%A8Platform_Init%EF%BC%88%EF%BC%89%E4%B8%AD%E7%9A%84%E4%B8%AD%E6%96%AD%E7%9B%91%E6%B5%8B%EF%BC%8C%E5%BD%93%E6%88%91%E5%9C%A8Tresos%2029.0.0%E4%B8%8A%E5%88%A0%E9%99%A4%E6%AD%A4%E9%85%8D%E7%BD%AE%EF%BC%88%E7%A6%81%E7%94%A8INTM%EF%BC%89%E6%97%B6%EF%BC%8C%E6%88%91%E5%BC%80%E5%A7%8B%E5%9C%A8Mcl_Init%EF%BC%88%EF%BC%89%E7%9A%84%E8%BF%99%E4%B8%AA%E6%96%B0%E7%82%B9%E5%87%BA%E7%8E%B0%E7%A1%AC%E6%95%85%E9%9A%9C%EF%BC%8C%E5%A6%82%E4%B8%8B%E6%89%80%E7%A4%BA%E3%80%82%3C%2FP%3E%3CP%3E%E6%AD%A4%E5%A4%96%EF%BC%8C%E6%88%91%E8%BF%98%E5%8F%91%E7%8E%B0%EF%BC%8C%E5%A6%82%E6%9E%9C%E6%B3%A8%E9%87%8A%E6%8E%89%20Mcl_init()%EF%BC%8C%E5%9C%A8%20Uart_Init()%E4%B8%AD%E4%B9%9F%E4%BC%9A%E5%87%BA%E7%8E%B0%E7%A1%AC%E6%95%85%E9%9A%9C%EF%BC%9A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22MVR_3-1755032834466.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MVR_3-1755032834466.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F352069iECC068E97DC73706%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22MVR_3-1755032834466.png%22%20alt%3D%22MVR_3-1755032834466.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E5%90%8C%E6%A0%B7%EF%BC%8C%E5%9C%A8%E8%B0%83%E8%AF%95%E6%A8%A1%E5%BC%8F%E4%B8%8B%E4%BD%BF%E7%94%A8%E7%B3%BB%E7%BB%9F%E6%97%B6%EF%BC%8C%E4%B9%9F%E6%B2%A1%E6%9C%89%E5%87%BA%E7%8E%B0%E8%BF%99%E7%A7%8D%E6%83%85%E5%86%B5%E3%80%82%E6%9C%89%E4%BA%BA%E8%83%BD%E5%B8%AE%E6%88%91%E8%A7%A3%E5%86%B3%E8%BF%99%E4%B8%AA%E9%97%AE%E9%A2%98%E5%90%97%EF%BC%9F%20%3C%2FP%3E%3CP%3E%E6%88%91%E7%9C%8B%E5%88%B0%E4%B8%80%E4%BA%9B%E4%B8%8E%E6%AD%A4%E9%97%AE%E9%A2%98%E7%9B%B8%E5%85%B3%E7%9A%84%E4%B8%BB%E9%A2%98%EF%BC%8C%E6%9C%89%E4%BA%BA%E8%AF%B4%20HSE_CLK%20%E5%BA%94%E8%AF%A5%E6%98%AF%20CORE_CLK%2F2%EF%BC%8C%E4%BD%86%E5%AE%83%E5%B7%B2%E7%BB%8F%E6%98%AF%E8%BF%99%E6%A0%B7%E9%85%8D%E7%BD%AE%E7%9A%84%E4%BA%86%EF%BC%9A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22MVR_2-1755032234658.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MVR_2-1755032234658.png%22%20style%3D%22width%3A%20377px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F352061i2B892A2050E7B52E%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22MVR_2-1755032234658.png%22%20alt%3D%22MVR_2-1755032234658.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E8%B0%A2%E8%B0%A2%EF%BC%81%3C%2FP%3E%3CP%3EMVR%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2152227%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Hardfault%20when%20we%20are%20not%20using%20debugger%20in%20S32K344%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2152227%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%3EHi%40MVR%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%E6%88%91%E6%B5%8B%E8%AF%95%E4%BA%86%E4%BD%A0%E7%9A%84%E4%BB%A3%E7%A0%81%EF%BC%8C%E4%BD%A0%E9%9C%80%E8%A6%81%E4%BD%BF%E7%94%A8%22MCU_SetMode()%22%20%E6%89%93%E5%BC%80%E5%A4%96%E8%AE%BE%E6%97%B6%E9%92%9F%EF%BC%8C%E8%BF%99%E5%B0%B1%E6%98%AF%E8%BF%9B%E5%85%A5%E7%A1%AC%E6%95%85%E9%9A%9C%E7%9A%84%E5%8E%9F%E5%9B%A0%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%22Senlent_0-1755160640927.png%22%20style%3D%22width%3A%20454px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Senlent_0-1755160640927.png%22%20style%3D%22width%3A%20454px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F352413i12011E59068318C7%2Fimage-dimensions%2F454x245%3Fv%3Dv2%22%20width%3D%22454%22%20height%3D%22245%22%20role%3D%22button%22%20title%3D%22Senlent_0-1755160640927.png%22%20alt%3D%22Senlent_0-1755160640927.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2151678%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Hardfault%20when%20we%20are%20not%20using%20debugger%20in%20S32K344%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2151678%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E7%94%B1%E4%BA%8E%E4%BF%9D%E5%AF%86%E5%8E%9F%E5%9B%A0%EF%BC%8C%E5%B7%B2%E9%80%9A%E8%BF%87%E7%A7%81%E4%BA%BA%E4%BF%A1%E6%81%AF%E5%8F%91%E9%80%81%E7%BB%99%E6%82%A8...%3C%2FP%3E%3CP%3E%E4%BD%86%E4%B8%80%E6%97%A6%E6%88%91%E4%BB%AC%E8%A7%A3%E5%86%B3%E4%BA%86%E8%BF%99%E4%B8%AA%E9%97%AE%E9%A2%98%EF%BC%8C%E6%88%91%E5%B0%B1%E4%BC%9A%E5%9C%A8%E8%BF%99%E9%87%8C%E5%8F%91%E5%B8%83%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%EF%BC%8C%E4%BB%A5%E5%B8%AE%E5%8A%A9%E7%A4%BE%E5%8C%BA%E3%80%82%3C%2FP%3E%3CP%3E%E8%B0%A2%E8%B0%A2%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2151359%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Hardfault%20when%20we%20are%20not%20using%20debugger%20in%20S32K344%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2151359%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CA%20href%3D%22mailto%3AHi%40MVR%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EHi%40MVR%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%22%3CSPAN%3E%E5%9C%A8%E8%B0%83%E8%AF%95%E6%A8%A1%E5%BC%8F%E4%B8%8B%E8%BF%90%E8%A1%8C%E4%BB%A3%E7%A0%81%E6%97%B6%EF%BC%8C%E4%B8%80%E5%88%87%E6%AD%A3%E5%B8%B8%EF%BC%88CAN%E3%80%81UART%20%E7%AD%89%EF%BC%89%E3%80%82%3C%2FSPAN%3E%22%3C%2FP%3E%0A%3CP%3E%E8%BF%99%E4%BA%9B%E9%97%AE%E9%A2%98%E5%A4%A7%E5%A4%9A%E4%B8%8E%E6%97%B6%E9%92%9F%E9%85%8D%E7%BD%AE%E6%9C%89%E5%85%B3%E3%80%82%3C%2FP%3E%0A%3CP%3E%E5%A6%82%E6%9E%9C%E6%82%A8%E8%83%BD%E6%8F%90%E4%BE%9B%E4%B8%80%E4%B8%AA%E5%AE%8C%E6%95%B4%E7%9A%84%E9%A1%B9%E7%9B%AE%EF%BC%8C%E6%88%91%E5%8F%AF%E4%BB%A5%E5%B8%AE%E6%82%A8%E6%A3%80%E6%9F%A5%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E