uint32_t resetcause = RCM_GetPreviousResetSources(RCM); //causing hardfault

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

uint32_t resetcause = RCM_GetPreviousResetSources(RCM); //causing hardfault

631 Views
CarlFST60L
Senior Contributor II

#include "MK50D10.h"

Calling 

 

uint32_t error = RCM_GetPreviousResetSources(RCM); // Causing hard fault every time

 

I also updated the driver to be like the MK64 versions which does two unit8_t reads and it still crashes (like this)

static inline uint32_t RCM_GetPreviousResetSources(RCM_Type *base)
{
#if (defined(FSL_FEATURE_RCM_REG_WIDTH) && (FSL_FEATURE_RCM_REG_WIDTH == 32))
return base->SRS;
#else
uint8_t tmpSrs0 = base->SRS0;
uint8_t tmpSrs1 = base->SRS1;
return (uint32_t)((uint32_t)tmpSrs0 | ((uint32_t)tmpSrs1 << 8U));
// return (uint32_t)((uint32_t)base->SRS0 | ((uint32_t)base->SRS1 << 8U));
#endif /* (FSL_FEATURE_RCM_REG_WIDTH == 32) */

Any idea why the MK50 crashes when you call this? I use it everywhere on other projects and have never seen / had a problem except for this.

 

The exact fault is

BFARVALID (7) BusFault address register (BFAR) valid flag

PRECISERR (1) Precise data bus error

If that helps diagnose the issue...

Here is an image showing RCM is there, working, you can inspect it, and the fault after you run it 

CarlFST60L_0-1674679142252.png

 

0 Kudos
3 Replies

604 Views
CarlFST60L
Senior Contributor II

Can someone please tell me how to use RCM_GetPreviousResetSources without a hard fault?

 

I checked the addresses in the RM, ican inspect the values, but cannot read them.

 

I would assume someone at NXP can look into why their down driver causes a hard fault. Its very simple code and very easy to reproduce. 

 

I am happy to work around it but I need to know what the reset cause was for my applications.

0 Kudos

583 Views
RaRo
NXP TechSupport
NXP TechSupport

Hello @CarlFST60L,

Could you please share what you are doing before calling the function?

You point out that that you have worked with RCM driver before, it was with the same MK50 you are using right now? If so, which changes have you made from your other projects to this one?

We test the RCM driver in a FRDM K64 and RCM_GetPreviousResetSources() worked fine.

Best regards, Raul.

0 Kudos

578 Views
CarlFST60L
Senior Contributor II

Hi,

 

As in my first post, K64 works fine, so not sure why you tested something that I said works fine and you didnt test the thing I said does not work fine which is the MK50?

 

Im not doing anything before it, just make default project, and call it anywhere and you get a hard fault (MK50). As you can see in my orginal post you can inspect it and see valid values, but, when you got to actually read the address's it explodes and hard faults as shown in original post in detail.

0 Kudos